Class: MethodRuby::Resources::Accounts::PaymentInstruments
- Inherits:
-
Object
- Object
- MethodRuby::Resources::Accounts::PaymentInstruments
- Defined in:
- lib/method_ruby/resources/accounts/payment_instruments.rb
Overview
Payment instruments for accounts
Instance Method Summary collapse
-
#create(account_id, type:, method_version:, idempotency_key: nil, request_options: {}) ⇒ MethodRuby::Models::Accounts::PaymentInstrumentCreateResponse
Some parameter documentations has been truncated, see Models::Accounts::PaymentInstrumentCreateParams for more details.
-
#delete(pmt_ins_id, account_id:, method_version:, idempotency_key: nil, request_options: {}) ⇒ MethodRuby::Models::Accounts::PaymentInstrumentDeleteResponse
Some parameter documentations has been truncated, see Models::Accounts::PaymentInstrumentDeleteParams for more details.
-
#initialize(client:) ⇒ PaymentInstruments
constructor
private
A new instance of PaymentInstruments.
-
#list(account_id, method_version:, page: nil, page_cursor: nil, page_limit: nil, request_options: {}) ⇒ MethodRuby::Models::Accounts::PaymentInstrumentListResponse
Some parameter documentations has been truncated, see Models::Accounts::PaymentInstrumentListParams for more details.
-
#retrieve(pmt_ins_id, account_id:, method_version:, request_options: {}) ⇒ MethodRuby::Models::Accounts::PaymentInstrumentRetrieveResponse
Some parameter documentations has been truncated, see Models::Accounts::PaymentInstrumentRetrieveParams for more details.
Constructor Details
#initialize(client:) ⇒ PaymentInstruments
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 PaymentInstruments.
157 158 159 |
# File 'lib/method_ruby/resources/accounts/payment_instruments.rb', line 157 def initialize(client:) @client = client end |
Instance Method Details
#create(account_id, type:, method_version:, idempotency_key: nil, request_options: {}) ⇒ MethodRuby::Models::Accounts::PaymentInstrumentCreateResponse
Some parameter documentations has been truncated, see Models::Accounts::PaymentInstrumentCreateParams for more details.
Creates a new payment instrument for the specified account.
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/method_ruby/resources/accounts/payment_instruments.rb', line 28 def create(account_id, params) parsed, = MethodRuby::Accounts::PaymentInstrumentCreateParams.dump_request(params) header_params = {method_version: "method-version", idempotency_key: "idempotency-key"} @client.request( method: :post, path: ["accounts/%1$s/payment_instruments", account_id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: MethodRuby::Models::Accounts::PaymentInstrumentCreateResponse, security: {secret_key: true}, options: ) end |
#delete(pmt_ins_id, account_id:, method_version:, idempotency_key: nil, request_options: {}) ⇒ MethodRuby::Models::Accounts::PaymentInstrumentDeleteResponse
Some parameter documentations has been truncated, see Models::Accounts::PaymentInstrumentDeleteParams for more details.
Closes an account payment instrument. This endpoint is only available starting with API version ‘2025-12-01`.
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/method_ruby/resources/accounts/payment_instruments.rb', line 135 def delete(pmt_ins_id, params) parsed, = MethodRuby::Accounts::PaymentInstrumentDeleteParams.dump_request(params) account_id = parsed.delete(:account_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :delete, path: ["accounts/%1$s/payment_instruments/%2$s", account_id, pmt_ins_id], headers: parsed.transform_keys( method_version: "method-version", idempotency_key: "idempotency-key" ), model: MethodRuby::Models::Accounts::PaymentInstrumentDeleteResponse, security: {secret_key: true}, options: ) end |
#list(account_id, method_version:, page: nil, page_cursor: nil, page_limit: nil, request_options: {}) ⇒ MethodRuby::Models::Accounts::PaymentInstrumentListResponse
Some parameter documentations has been truncated, see Models::Accounts::PaymentInstrumentListParams for more details.
Returns a list of payment instruments for the specified account.
99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/method_ruby/resources/accounts/payment_instruments.rb', line 99 def list(account_id, params) query_params = [:page, :page_cursor, :page_limit] parsed, = MethodRuby::Accounts::PaymentInstrumentListParams.dump_request(params) query = MethodRuby::Internal::Util.encode_query_params(parsed.slice(*query_params)) @client.request( method: :get, path: ["accounts/%1$s/payment_instruments", account_id], query: query, headers: parsed.except(*query_params).transform_keys(method_version: "method-version"), model: MethodRuby::Models::Accounts::PaymentInstrumentListResponse, security: {secret_key: true}, options: ) end |
#retrieve(pmt_ins_id, account_id:, method_version:, request_options: {}) ⇒ MethodRuby::Models::Accounts::PaymentInstrumentRetrieveResponse
Some parameter documentations has been truncated, see Models::Accounts::PaymentInstrumentRetrieveParams for more details.
Retrieves an account payment instrument by its unique identifier.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/method_ruby/resources/accounts/payment_instruments.rb', line 61 def retrieve(pmt_ins_id, params) parsed, = MethodRuby::Accounts::PaymentInstrumentRetrieveParams.dump_request(params) account_id = parsed.delete(:account_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :get, path: ["accounts/%1$s/payment_instruments/%2$s", account_id, pmt_ins_id], headers: parsed.transform_keys(method_version: "method-version"), model: MethodRuby::Models::Accounts::PaymentInstrumentRetrieveResponse, security: {secret_key: true}, options: ) end |