Class: ModernTreasury::Resources::InternalAccounts

Inherits:
Object
  • Object
show all
Defined in:
lib/modern_treasury/resources/internal_accounts.rb,
lib/modern_treasury/resources/internal_accounts/balance_reports.rb,
sig/modern_treasury/resources/internal_accounts.rbs,
sig/modern_treasury/resources/internal_accounts/balance_reports.rbs

Defined Under Namespace

Classes: BalanceReports

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ InternalAccounts

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 InternalAccounts.

Parameters:



223
224
225
226
# File 'lib/modern_treasury/resources/internal_accounts.rb', line 223

def initialize(client:)
  @client = client
  @balance_reports = ModernTreasury::Resources::InternalAccounts::BalanceReports.new(client: client)
end

Instance Attribute Details

#balance_reportsModernTreasury::Resources::InternalAccounts::BalanceReports (readonly)



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

def balance_reports
  @balance_reports
end

Instance Method Details

#create(currency:, name:, account_capabilities: nil, account_type: nil, connection_id: nil, counterparty_id: nil, debitable: nil, external_id: nil, legal_entity_id: nil, metadata: nil, parent_account_id: nil, party_address: nil, party_name: nil, requested_account_number_types: nil, vendor_attributes: nil, request_options: {}) ⇒ ModernTreasury::Models::InternalAccount

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

create internal account

Parameters:

Returns:

See Also:



51
52
53
54
55
56
57
58
59
60
# File 'lib/modern_treasury/resources/internal_accounts.rb', line 51

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

#list(after_cursor: nil, counterparty_id: nil, currency: nil, external_id: nil, legal_entity_id: nil, metadata: nil, payment_direction: nil, payment_type: nil, per_page: nil, status: nil, request_options: {}) ⇒ ModernTreasury::Internal::Page<ModernTreasury::Models::InternalAccount>

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

list internal accounts

Parameters:

Returns:

See Also:



153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/modern_treasury/resources/internal_accounts.rb', line 153

def list(params = {})
  parsed, options = ModernTreasury::InternalAccountListParams.dump_request(params)
  query = ModernTreasury::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "api/internal_accounts",
    query: query,
    page: ModernTreasury::Internal::Page,
    model: ModernTreasury::InternalAccount,
    options: options
  )
end

#request_closure(id, request_options: {}) ⇒ ModernTreasury::Models::InternalAccount

request closure of internal account

Parameters:

Returns:

See Also:



177
178
179
180
181
182
183
184
# File 'lib/modern_treasury/resources/internal_accounts.rb', line 177

def request_closure(id, params = {})
  @client.request(
    method: :post,
    path: ["api/internal_accounts/%1$s/request_closure", id],
    model: ModernTreasury::InternalAccount,
    options: params[:request_options]
  )
end

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

get internal account

Parameters:

Returns:

See Also:



73
74
75
76
77
78
79
80
# File 'lib/modern_treasury/resources/internal_accounts.rb', line 73

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

#update(id, contra_ledger_account_id: nil, counterparty_id: nil, external_id: nil, ledger_account_id: nil, metadata: nil, name: nil, parent_account_id: nil, request_options: {}) ⇒ ModernTreasury::Models::InternalAccount

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

update internal account

Parameters:

  • id (String)

    Unique identifier for the account.

  • contra_ledger_account_id (String)

    The Contra Ledger Account associated to this account.

  • counterparty_id (String)

    The Counterparty associated to this account.

  • external_id (String, nil)

    An optional user-defined 180 character unique identifier.

  • ledger_account_id (String)

    The Ledger Account associated to this account.

  • metadata (Hash{Symbol=>String})

    Additional data in the form of key-value pairs. Pairs can be removed by passing

  • name (String)

    The nickname for the internal account.

  • parent_account_id (String)

    The parent internal account for this account.

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

Returns:

See Also:



110
111
112
113
114
115
116
117
118
119
# File 'lib/modern_treasury/resources/internal_accounts.rb', line 110

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

#update_account_capability(id, internal_account_id:, identifier:, request_options: {}) ⇒ ModernTreasury::Models::InternalAccountUpdateAccountCapabilityResponse

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

update account_capability

Parameters:

  • id (String)

    Path param: Unique identifier for the account capability.

  • internal_account_id (String)

    Path param: Unique identifier for the internal account.

  • identifier (String)

    Body param: A unique reference assigned by your bank for tracking and recognizin

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

Returns:

See Also:



205
206
207
208
209
210
211
212
213
214
215
216
217
218
# File 'lib/modern_treasury/resources/internal_accounts.rb', line 205

def (id, params)
  parsed, options = ModernTreasury::InternalAccountUpdateAccountCapabilityParams.dump_request(params)
   =
    parsed.delete(:internal_account_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :patch,
    path: ["api/internal_accounts/%1$s/account_capabilities/%2$s", , id],
    body: parsed,
    model: ModernTreasury::Models::InternalAccountUpdateAccountCapabilityResponse,
    options: options
  )
end