Class: Ledger::Sdk::Models::Container

Inherits:
Base
  • Object
show all
Defined in:
lib/ledger/sdk/models/container.rb

Overview

Represents the collection of containers (portfolios) from the Ledger API.

Allows listing containers via the /containers endpoint, and creating one (#create). The SDK is otherwise read-only on containers, except for a container's characteristics (Instance#update) and its fees/fee-exclusions management (Instance#fees and Instance#fee_exclusions).

Examples:

List all containers

containers = Ledger::Sdk.Container.list

Create a container

Ledger::Sdk.Container.create(reference: 'MODEL.RESILIENCE', primary_currency: 'EUR')

Access a container by ID (includes its accounts)

container = Ledger::Sdk.Container(42)
container.data # => { 'id' => 42, 'reference' => 'PTF-001', ... }

Defined Under Namespace

Classes: Instance

Instance Method Summary collapse

Methods inherited from Base

#initialize, #list

Constructor Details

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

Instance Method Details

#create(attributes) ⇒ Instance

Creates a container.

A container normally comes into being on its own, named by the lines of an import (see Import#create). This endpoint is for the producer that has no lines to send yet and still needs the container to exist — a portfolio built by hand rather than fed by a bank.

Attributes are wrapped under a container key, like Ledger::Sdk::Models::Container::Instance#update and unlike the flat import payload. reference (unique) and primary_currency (a valid ISO code) are required by Ledger; manager_id, custodian_id, account_keeper_id, management_mode and portfolio_manager_name are optional. A duplicate reference answers 422.

Parameters:

  • attributes (Hash)

    the container attributes, e.g. { reference: 'MODEL.RESILIENCE', primary_currency: 'EUR' }

Returns:

  • (Instance)

    the created container instance