Class: MethodRuby::Resources::Accounts

Inherits:
Object
  • Object
show all
Defined in:
lib/method_ruby/resources/accounts.rb,
lib/method_ruby/resources/accounts/consent.rb,
lib/method_ruby/resources/accounts/payoffs.rb,
lib/method_ruby/resources/accounts/updates.rb,
lib/method_ruby/resources/accounts/balances.rb,
lib/method_ruby/resources/accounts/products.rb,
lib/method_ruby/resources/accounts/sensitive.rb,
lib/method_ruby/resources/accounts/attributes.rb,
lib/method_ruby/resources/accounts/card_brands.rb,
lib/method_ruby/resources/accounts/transactions.rb,
lib/method_ruby/resources/accounts/subscriptions.rb,
lib/method_ruby/resources/accounts/payment_instruments.rb,
lib/method_ruby/resources/accounts/verification_sessions.rb,
lib/method_ruby/resources/accounts/verification_sessions/amounts.rb

Overview

Financial accounts (ACH, liability, clearing, debit card)

Defined Under Namespace

Classes: Attributes, Balances, CardBrands, Consent, PaymentInstruments, Payoffs, Products, Sensitive, Subscriptions, Transactions, Updates, VerificationSessions

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Accounts

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

Parameters:



234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/method_ruby/resources/accounts.rb', line 234

def initialize(client:)
  @client = client
  @verification_sessions = MethodRuby::Resources::Accounts::VerificationSessions.new(client: client)
  @sensitive = MethodRuby::Resources::Accounts::Sensitive.new(client: client)
  @consent = MethodRuby::Resources::Accounts::Consent.new(client: client)
  @payoffs = MethodRuby::Resources::Accounts::Payoffs.new(client: client)
  @balances = MethodRuby::Resources::Accounts::Balances.new(client: client)
  @card_brands = MethodRuby::Resources::Accounts::CardBrands.new(client: client)
  @updates = MethodRuby::Resources::Accounts::Updates.new(client: client)
  @products = MethodRuby::Resources::Accounts::Products.new(client: client)
  @subscriptions = MethodRuby::Resources::Accounts::Subscriptions.new(client: client)
  @attributes = MethodRuby::Resources::Accounts::Attributes.new(client: client)
  @payment_instruments = MethodRuby::Resources::Accounts::PaymentInstruments.new(client: client)
  @transactions = MethodRuby::Resources::Accounts::Transactions.new(client: client)
end

Instance Attribute Details

#attributesMethodRuby::Resources::Accounts::Attributes (readonly)

Attribute data for accounts



45
46
47
# File 'lib/method_ruby/resources/accounts.rb', line 45

def attributes
  @attributes
end

#balancesMethodRuby::Resources::Accounts::Balances (readonly)

Balance data for accounts



25
26
27
# File 'lib/method_ruby/resources/accounts.rb', line 25

def balances
  @balances
end

#card_brandsMethodRuby::Resources::Accounts::CardBrands (readonly)

Card brand information for accounts



29
30
31
# File 'lib/method_ruby/resources/accounts.rb', line 29

def card_brands
  @card_brands
end

Consent management for accounts



17
18
19
# File 'lib/method_ruby/resources/accounts.rb', line 17

def consent
  @consent
end

#payment_instrumentsMethodRuby::Resources::Accounts::PaymentInstruments (readonly)

Payment instruments for accounts



49
50
51
# File 'lib/method_ruby/resources/accounts.rb', line 49

def payment_instruments
  @payment_instruments
end

#payoffsMethodRuby::Resources::Accounts::Payoffs (readonly)

Payoff data for accounts



21
22
23
# File 'lib/method_ruby/resources/accounts.rb', line 21

def payoffs
  @payoffs
end

#productsMethodRuby::Resources::Accounts::Products (readonly)

Products associated with accounts



37
38
39
# File 'lib/method_ruby/resources/accounts.rb', line 37

def products
  @products
end

#sensitiveMethodRuby::Resources::Accounts::Sensitive (readonly)

Sensitive data for accounts



13
14
15
# File 'lib/method_ruby/resources/accounts.rb', line 13

def sensitive
  @sensitive
end

#subscriptionsMethodRuby::Resources::Accounts::Subscriptions (readonly)

Subscriptions for accounts



41
42
43
# File 'lib/method_ruby/resources/accounts.rb', line 41

def subscriptions
  @subscriptions
end

#transactionsMethodRuby::Resources::Accounts::Transactions (readonly)

Transactions for accounts



53
54
55
# File 'lib/method_ruby/resources/accounts.rb', line 53

def transactions
  @transactions
end

#updatesMethodRuby::Resources::Accounts::Updates (readonly)

Update records for accounts



33
34
35
# File 'lib/method_ruby/resources/accounts.rb', line 33

def updates
  @updates
end

#verification_sessionsMethodRuby::Resources::Accounts::VerificationSessions (readonly)

Verification sessions for accounts



9
10
11
# File 'lib/method_ruby/resources/accounts.rb', line 9

def verification_sessions
  @verification_sessions
end

Instance Method Details

#create(body:, method_version:, idempotency_key: nil, request_options: {}) ⇒ MethodRuby::Models::AccountCreateResponse

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

Creates a new account for the specified entity. The request body must include exactly one of ‘ach`, `liability`, `clearing`, or `debit_card` to determine the account type.

Parameters:

Returns:

See Also:



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/method_ruby/resources/accounts.rb', line 75

def create(params)
  parsed, options = MethodRuby::AccountCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "accounts",
    headers: parsed.except(:body).transform_keys(
      method_version: "method-version",
      idempotency_key: "idempotency-key"
    ),
    body: parsed[:body],
    model: MethodRuby::Models::AccountCreateResponse,
    security: {secret_key: true},
    options: options
  )
end

#list(method_version:, consent_status: nil, expand: nil, from_date: nil, holder_id: nil, holder_ids: nil, include_pending_consent: nil, liability: nil, page: nil, page_cursor: nil, page_limit: nil, status: nil, to_date: nil, type: nil, request_options: {}) ⇒ MethodRuby::Models::AccountListResponse

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

Returns a paginated list of accounts. Results can be filtered by status, type, holder, and date range.

Parameters:

Returns:

See Also:



201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# File 'lib/method_ruby/resources/accounts.rb', line 201

def list(params)
  query_params =
    [
      :consent_status,
      :expand,
      :from_date,
      :holder_id,
      :holder_ids,
      :include_pending_consent,
      :liability,
      :page,
      :page_cursor,
      :page_limit,
      :status,
      :to_date,
      :type
    ]
  parsed, options = MethodRuby::AccountListParams.dump_request(params)
  query = MethodRuby::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    method: :get,
    path: "accounts",
    query: query,
    headers: parsed.except(*query_params).transform_keys(method_version: "method-version"),
    model: MethodRuby::Models::AccountListResponse,
    security: {secret_key: true},
    options: options
  )
end

#retrieve(account_id, method_version:, expand: nil, request_options: {}) ⇒ MethodRuby::Models::AccountRetrieveResponse

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

Retrieves an account by its unique identifier.

Parameters:

Returns:

See Also:



109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/method_ruby/resources/accounts.rb', line 109

def retrieve(, params)
  query_params = [:expand]
  parsed, options = MethodRuby::AccountRetrieveParams.dump_request(params)
  query = MethodRuby::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    method: :get,
    path: ["accounts/%1$s", ],
    query: query,
    headers: parsed.except(*query_params).transform_keys(method_version: "method-version"),
    model: MethodRuby::Models::AccountRetrieveResponse,
    security: {secret_key: true},
    options: options
  )
end

#update(account_id, method_version:, liability: nil, metadata: nil, idempotency_key: nil, request_options: {}) ⇒ MethodRuby::Models::AccountUpdateResponse

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

Updates an account’s metadata or liability account number.

Parameters:

  • account_id (String)

    Path param: Unique identifier for the account.

  • method_version (Symbol, MethodRuby::Models::AccountUpdateParams::MethodVersion)

    Header param: API version to use for this request. This spec targets ‘2025-12-01

  • liability (MethodRuby::Models::AccountUpdateParams::Liability)

    Body param: Liability-specific update fields. Use either mortgage or credit_card

  • metadata (Hash{Symbol=>Object}, nil)

    Body param: Arbitrary key-value metadata attached to the resource.

  • idempotency_key (String)

    Header param: Idempotency key for safely retrying a write request. Reuse the sam

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

Returns:

See Also:



146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/method_ruby/resources/accounts.rb', line 146

def update(, params)
  parsed, options = MethodRuby::AccountUpdateParams.dump_request(params)
  header_params = {method_version: "method-version", idempotency_key: "idempotency-key"}
  @client.request(
    method: :put,
    path: ["accounts/%1$s", ],
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: MethodRuby::Models::AccountUpdateResponse,
    security: {secret_key: true},
    options: options
  )
end