Class: Lithic::Resources::Accounts
- Inherits:
-
Object
- Object
- Lithic::Resources::Accounts
- Defined in:
- lib/lithic/resources/accounts.rb
Instance Method Summary collapse
-
#initialize(client:) ⇒ Accounts
constructor
private
A new instance of Accounts.
-
#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.
-
#retrieve(account_token, request_options: {}) ⇒ Lithic::Models::Account
Get account configuration such as spend limits.
-
#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.
-
#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.
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.
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.
89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/lithic/resources/accounts.rb', line 89 def list(params = {}) parsed, = 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::Account, options: ) end |
#retrieve(account_token, request_options: {}) ⇒ Lithic::Models::Account
Get account configuration such as spend limits.
17 18 19 20 21 22 23 24 |
# File 'lib/lithic/resources/accounts.rb', line 17 def retrieve(account_token, params = {}) @client.request( method: :get, path: ["v1/accounts/%1$s", account_token], model: Lithic::Account, 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.
116 117 118 119 120 121 122 123 |
# File 'lib/lithic/resources/accounts.rb', line 116 def retrieve_spend_limits(account_token, params = {}) @client.request( method: :get, path: ["v1/accounts/%1$s/spend_limits", account_token], 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.
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/lithic/resources/accounts.rb', line 56 def update(account_token, params = {}) parsed, = Lithic::AccountUpdateParams.dump_request(params) @client.request( method: :patch, path: ["v1/accounts/%1$s", account_token], body: parsed, model: Lithic::Account, options: ) end |