Class: Mosaic::Sdk::Models::Clone

Inherits:
Base
  • Object
show all
Defined in:
lib/mosaic/sdk/models/clone.rb

Overview

Represents the collection of clones (fund share classes) from the Mosaic API.

Clones can be accessed either standalone via /v2/clones or nested under a DNA via /v2/dnas/:dna_id/clones. The context is determined automatically based on the presence of a :dna_id in the extra context.

Examples:

List all clones

clones = Mosaic::Sdk.Clone.list

List clones for a specific DNA

dna = Mosaic::Sdk.Dna(42)
dna.clones.list

Create a clone

clone = Mosaic::Sdk.Clone.create(
  name: 'My Clone', codes: [{ type: 'isin', value: 'FR001' }],
  source: 'manual', dna_id: 42
)

Search for clones

clones = Mosaic::Sdk.Clone.list('My Clone')

Search and filter by code type

clones = Mosaic::Sdk.Clone.list('My Clone', type: 'isin')

Access a specific clone

clone = Mosaic::Sdk.Clone(7)
clone.data

Defined Under Namespace

Classes: Instance

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Mosaic::Sdk::Models::Base

Instance Method Details

#create(name:, codes:, source:, dna_id: @extra[:dna_id], account_references: []) ⇒ Instance

Creates a new clone.

Parameters:

  • name (String)

    the clone name

  • codes (Array<Hash>)

    list of codes, each with :type and :value (e.g. [{ type: 'isin', value: 'FR0000000001' }])

  • source (String)

    the data source

  • dna_id (Integer) (defaults to: @extra[:dna_id])

    the parent DNA ID (inferred from context when chaining)

  • account_references (Array<String>) (defaults to: [])

    optional list of account references

Returns:

  • (Instance)

    the created clone instance

#list(query = nil, type: nil) ⇒ Array<Instance>

Lists clones, optionally filtered by a search query and/or code type.

Parameters:

  • query (String, nil) (defaults to: nil)

    an optional search string to filter results

  • type (String, nil) (defaults to: nil)

    an optional code type to narrow results (e.g. 'isin'); only effective when query is also provided

Returns:

  • (Array<Instance>)

    array of clone instances