Class: ModernTreasury::Resources::LedgerAccountSettlements

Inherits:
Object
  • Object
show all
Defined in:
lib/modern_treasury/resources/ledger_account_settlements.rb,
lib/modern_treasury/resources/ledger_account_settlements/account_entries.rb

Defined Under Namespace

Classes: AccountEntries

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ LedgerAccountSettlements

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of LedgerAccountSettlements.

Parameters:



146
147
148
149
150
# File 'lib/modern_treasury/resources/ledger_account_settlements.rb', line 146

def initialize(client:)
  @client = client
  @account_entries =
    ModernTreasury::Resources::LedgerAccountSettlements::AccountEntries.new(client: client)
end

Instance Attribute Details

#account_entriesModernTreasury::Resources::LedgerAccountSettlements::AccountEntries (readonly)



7
8
9
# File 'lib/modern_treasury/resources/ledger_account_settlements.rb', line 7

def 
  @account_entries
end

Instance Method Details

#create(contra_ledger_account_id: , settled_ledger_account_id: , allow_either_direction: nil, description: nil, effective_at_upper_bound: nil, metadata: nil, skip_settlement_ledger_transaction: nil, status: nil, request_options: {}) ⇒ ModernTreasury::Models::LedgerAccountSettlement

Some parameter documentations has been truncated, see Models::LedgerAccountSettlementCreateParams for more details.

Create a ledger account settlement.

Parameters:

  • contra_ledger_account_id (String)

    The id of the contra ledger account that sends to or receives funds from the set

  • settled_ledger_account_id (String)

    The id of the settled ledger account whose ledger entries are queried against, a

  • allow_either_direction (Boolean, nil)

    If true, the settlement amount and settlement_entry_direction will bring the set

  • description (String, nil)

    The description of the ledger account settlement.

  • effective_at_upper_bound (Time, nil)

    The exclusive upper bound of the effective_at timestamp of the ledger entries to

  • metadata (Hash{Symbol=>String})

    Additional data represented as key-value pairs. Both the key and value must be s

  • skip_settlement_ledger_transaction (Boolean, nil)

    It is set to ‘false` by default. It should be set to `true` when migrating exist

  • status (Symbol, ModernTreasury::Models::LedgerAccountSettlementCreateParams::Status, nil)

    The status of the ledger account settlement. It is set to ‘pending` by default.

  • request_options (ModernTreasury::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



37
38
39
40
41
42
43
44
45
46
# File 'lib/modern_treasury/resources/ledger_account_settlements.rb', line 37

def create(params)
  parsed, options = ModernTreasury::LedgerAccountSettlementCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "api/ledger_account_settlements",
    body: parsed,
    model: ModernTreasury::LedgerAccountSettlement,
    options: options
  )
end

#list(id: nil, after_cursor: nil, created_at: nil, ledger_id: nil, ledger_transaction_id: nil, metadata: nil, per_page: nil, settled_ledger_account_id: nil, settlement_entry_direction: nil, updated_at: nil, request_options: {}) ⇒ ModernTreasury::Internal::Page<ModernTreasury::Models::LedgerAccountSettlement>

Some parameter documentations has been truncated, see Models::LedgerAccountSettlementListParams for more details.

Get a list of ledger account settlements.

Parameters:

  • id (Array<String>)

    If you have specific IDs to retrieve in bulk, you can pass them as query paramet

  • after_cursor (String, nil)
  • created_at (Hash{Symbol=>Time})

    Use ‘gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to filter by the cre

  • ledger_id (String)
  • ledger_transaction_id (String)
  • metadata (Hash{Symbol=>String})

    For example, if you want to query for records with metadata key ‘Type` and value

  • per_page (Integer)
  • settled_ledger_account_id (String)
  • settlement_entry_direction (String)
  • updated_at (Hash{Symbol=>Time})

    Use ‘gt` (>), `gte` (>=), `lt` (<), `lte` (<=), or `eq` (=) to filter by the upd

  • request_options (ModernTreasury::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



131
132
133
134
135
136
137
138
139
140
141
# File 'lib/modern_treasury/resources/ledger_account_settlements.rb', line 131

def list(params = {})
  parsed, options = ModernTreasury::LedgerAccountSettlementListParams.dump_request(params)
  @client.request(
    method: :get,
    path: "api/ledger_account_settlements",
    query: parsed,
    page: ModernTreasury::Internal::Page,
    model: ModernTreasury::LedgerAccountSettlement,
    options: options
  )
end

#retrieve(id, request_options: {}) ⇒ ModernTreasury::Models::LedgerAccountSettlement

Get details on a single ledger account settlement.

Parameters:

Returns:

See Also:



59
60
61
62
63
64
65
66
# File 'lib/modern_treasury/resources/ledger_account_settlements.rb', line 59

def retrieve(id, params = {})
  @client.request(
    method: :get,
    path: ["api/ledger_account_settlements/%1$s", id],
    model: ModernTreasury::LedgerAccountSettlement,
    options: params[:request_options]
  )
end

#update(id, description: nil, metadata: nil, status: nil, request_options: {}) ⇒ ModernTreasury::Models::LedgerAccountSettlement

Some parameter documentations has been truncated, see Models::LedgerAccountSettlementUpdateParams for more details.

Update the details of a ledger account settlement.

Parameters:

Returns:

See Also:



88
89
90
91
92
93
94
95
96
97
# File 'lib/modern_treasury/resources/ledger_account_settlements.rb', line 88

def update(id, params = {})
  parsed, options = ModernTreasury::LedgerAccountSettlementUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["api/ledger_account_settlements/%1$s", id],
    body: parsed,
    model: ModernTreasury::LedgerAccountSettlement,
    options: options
  )
end