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

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:



219
220
221
222
# File 'lib/modern_treasury/resources/internal_accounts.rb', line 219

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(connection_id:, currency:, name:, party_name:, account_capabilities: nil, account_type: nil, counterparty_id: nil, external_id: nil, legal_entity_id: nil, metadata: nil, parent_account_id: nil, party_address: 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:

  • connection_id (String)

    The identifier of the financial institution the account belongs to.

  • currency (Symbol, ModernTreasury::Models::InternalAccountCreateParams::Currency)

    The currency of the internal account. Supports “USD” and “CAD” for fiat, and “US

  • name (String)

    The nickname of the account.

  • party_name (String)

    The legal name of the entity which owns the account.

  • account_capabilities (Array<ModernTreasury::Models::InternalAccountCreateParams::AccountCapability>)

    An array of AccountCapability objects that list the originating abilities of the

  • account_type (Symbol, ModernTreasury::Models::InternalAccountCreateParams::AccountType)

    The account type, used to provision the appropriate account at the financial ins

  • counterparty_id (String)

    The Counterparty associated to this account.

  • external_id (String, nil)

    An optional user-defined 180 character unique identifier.

  • legal_entity_id (String)

    The LegalEntity associated to this account.

  • metadata (Hash{Symbol=>String})

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

  • parent_account_id (String)

    The parent internal account of this new account.

  • party_address (ModernTreasury::Models::InternalAccountCreateParams::PartyAddress)

    The address associated with the owner or null.

  • vendor_attributes (Hash{Symbol=>String})

    A hash of vendor specific attributes that will be used when creating the account

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

Returns:

See Also:



47
48
49
50
51
52
53
54
55
56
# File 'lib/modern_treasury/resources/internal_accounts.rb', line 47

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:



149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/modern_treasury/resources/internal_accounts.rb', line 149

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:



173
174
175
176
177
178
179
180
# File 'lib/modern_treasury/resources/internal_accounts.rb', line 173

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:



69
70
71
72
73
74
75
76
# File 'lib/modern_treasury/resources/internal_accounts.rb', line 69

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:



106
107
108
109
110
111
112
113
114
115
# File 'lib/modern_treasury/resources/internal_accounts.rb', line 106

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:



201
202
203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/modern_treasury/resources/internal_accounts.rb', line 201

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