Class: Lithic::Resources::Accounts

Inherits:
Object
  • Object
show all
Defined in:
lib/lithic/resources/accounts.rb

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:



128
129
130
# File 'lib/lithic/resources/accounts.rb', line 128

def initialize(client:)
  @client = client
end

Instance Method Details

#list(begin_: nil, end_: nil, ending_before: nil, page_size: nil, starting_after: nil, request_options: {}) ⇒ Lithic::Internal::CursorPage<Lithic::Models::Account>

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

List account configurations.

Parameters:

  • begin_ (Time)

    Date string in RFC 3339 format. Only entries created after the specified time wi

  • end_ (Time)

    Date string in RFC 3339 format. Only entries created before the specified time w

  • ending_before (String)

    A cursor representing an item’s token before which a page of results should end.

  • page_size (Integer)

    Page size (for pagination).

  • starting_after (String)

    A cursor representing an item’s token after which a page of results should begin

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

Returns:

See Also:



89
90
91
92
93
94
95
96
97
98
99
# File 'lib/lithic/resources/accounts.rb', line 89

def list(params = {})
  parsed, options = Lithic::AccountListParams.dump_request(params)
  @client.request(
    method: :get,
    path: "v1/accounts",
    query: parsed.transform_keys(begin_: "begin", end_: "end"),
    page: Lithic::Internal::CursorPage,
    model: Lithic::,
    options: options
  )
end

#retrieve(account_token, request_options: {}) ⇒ Lithic::Models::Account

Get account configuration such as spend limits.

Parameters:

  • account_token (String)

    Globally unique identifier for account.

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

Returns:

See Also:



17
18
19
20
21
22
23
24
# File 'lib/lithic/resources/accounts.rb', line 17

def retrieve(, params = {})
  @client.request(
    method: :get,
    path: ["v1/accounts/%1$s", ],
    model: Lithic::,
    options: params[:request_options]
  )
end

#retrieve_spend_limits(account_token, request_options: {}) ⇒ Lithic::Models::AccountSpendLimits

Get an Account’s available spend limits, which is based on the spend limit configured on the Account and the amount already spent over the spend limit’s duration. For example, if the Account has a daily spend limit of $1000 configured, and has spent $600 in the last 24 hours, the available spend limit returned would be $400.

Parameters:

  • account_token (String)

    Globally unique identifier for account.

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

Returns:

See Also:



116
117
118
119
120
121
122
123
# File 'lib/lithic/resources/accounts.rb', line 116

def retrieve_spend_limits(, params = {})
  @client.request(
    method: :get,
    path: ["v1/accounts/%1$s/spend_limits", ],
    model: Lithic::AccountSpendLimits,
    options: params[:request_options]
  )
end

#update(account_token, comment: nil, daily_spend_limit: nil, lifetime_spend_limit: nil, monthly_spend_limit: nil, state: nil, substatus: nil, verification_address: nil, request_options: {}) ⇒ Lithic::Models::Account

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

Update account configuration such as state or spend limits. Can only be run on accounts that are part of the program managed by this API key. Accounts that are in the ‘PAUSED` state will not be able to transact or create new cards.

Parameters:

  • account_token (String)

    Globally unique identifier for account.

  • comment (String)

    Additional context or information related to the account.

  • daily_spend_limit (Integer)

    Amount (in cents) for the account’s daily spend limit (e.g. 100000 would be a $1

  • lifetime_spend_limit (Integer)

    Amount (in cents) for the account’s lifetime spend limit (e.g. 100000 would be a

  • monthly_spend_limit (Integer)

    Amount (in cents) for the account’s monthly spend limit (e.g. 100000 would be a

  • state (Symbol, Lithic::Models::AccountUpdateParams::State)

    Account states.

  • substatus (Symbol, Lithic::Models::AccountUpdateParams::Substatus)

    Account state substatus values:

  • verification_address (Lithic::Models::AccountUpdateParams::VerificationAddress)

    Address used during Address Verification Service (AVS) checks during transaction

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

Returns:

See Also:



56
57
58
59
60
61
62
63
64
65
# File 'lib/lithic/resources/accounts.rb', line 56

def update(, params = {})
  parsed, options = Lithic::AccountUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["v1/accounts/%1$s", ],
    body: parsed,
    model: Lithic::,
    options: options
  )
end