Class: SubfiPay::ChargesApi
- Inherits:
-
Object
- Object
- SubfiPay::ChargesApi
- Defined in:
- lib/subfi_pay/api/charges_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#get_charge(x_api_version, x_account_id, id, opts = {}) ⇒ ChargeResponse
Retrieve a charge.
-
#get_charge_with_http_info(x_api_version, x_account_id, id, opts = {}) ⇒ Array<(ChargeResponse, Integer, Hash)>
Retrieve a charge.
-
#initialize(api_client = ApiClient.default) ⇒ ChargesApi
constructor
A new instance of ChargesApi.
-
#list_charges(x_api_version, x_account_id, opts = {}) ⇒ ListChargesResponse
List all charges.
-
#list_charges_with_http_info(x_api_version, x_account_id, opts = {}) ⇒ Array<(ListChargesResponse, Integer, Hash)>
List all charges.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ ChargesApi
Returns a new instance of ChargesApi.
19 20 21 |
# File 'lib/subfi_pay/api/charges_api.rb', line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/subfi_pay/api/charges_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#get_charge(x_api_version, x_account_id, id, opts = {}) ⇒ ChargeResponse
Retrieve a charge
29 30 31 32 |
# File 'lib/subfi_pay/api/charges_api.rb', line 29 def get_charge(x_api_version, x_account_id, id, opts = {}) data, _status_code, _headers = get_charge_with_http_info(x_api_version, x_account_id, id, opts) data end |
#get_charge_with_http_info(x_api_version, x_account_id, id, opts = {}) ⇒ Array<(ChargeResponse, Integer, Hash)>
Retrieve a charge
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/subfi_pay/api/charges_api.rb', line 41 def get_charge_with_http_info(x_api_version, x_account_id, id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ChargesApi.get_charge ...' end # verify the required parameter 'x_api_version' is set if @api_client.config.client_side_validation && x_api_version.nil? fail ArgumentError, "Missing the required parameter 'x_api_version' when calling ChargesApi.get_charge" end # verify the required parameter 'x_account_id' is set if @api_client.config.client_side_validation && x_account_id.nil? fail ArgumentError, "Missing the required parameter 'x_account_id' when calling ChargesApi.get_charge" end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling ChargesApi.get_charge" end # resource path local_var_path = '/charges/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'connected_account_id'] = opts[:'connected_account_id'] if !opts[:'connected_account_id'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) header_params[:'X-Api-Version'] = x_api_version header_params[:'X-Account-Id'] = x_account_id # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'ChargeResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ApiKeyAuth'] = opts.merge( :operation => :"ChargesApi.get_charge", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ChargesApi#get_charge\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#list_charges(x_api_version, x_account_id, opts = {}) ⇒ ListChargesResponse
List all charges
109 110 111 112 |
# File 'lib/subfi_pay/api/charges_api.rb', line 109 def list_charges(x_api_version, x_account_id, opts = {}) data, _status_code, _headers = list_charges_with_http_info(x_api_version, x_account_id, opts) data end |
#list_charges_with_http_info(x_api_version, x_account_id, opts = {}) ⇒ Array<(ListChargesResponse, Integer, Hash)>
List all charges
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
# File 'lib/subfi_pay/api/charges_api.rb', line 123 def list_charges_with_http_info(x_api_version, x_account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ChargesApi.list_charges ...' end # verify the required parameter 'x_api_version' is set if @api_client.config.client_side_validation && x_api_version.nil? fail ArgumentError, "Missing the required parameter 'x_api_version' when calling ChargesApi.list_charges" end # verify the required parameter 'x_account_id' is set if @api_client.config.client_side_validation && x_account_id.nil? fail ArgumentError, "Missing the required parameter 'x_account_id' when calling ChargesApi.list_charges" end # resource path local_var_path = '/charges' # query parameters query_params = opts[:query_params] || {} query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil? query_params[:'connected_account_id'] = opts[:'connected_account_id'] if !opts[:'connected_account_id'].nil? query_params[:'payment_intent_id'] = opts[:'payment_intent_id'] if !opts[:'payment_intent_id'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) header_params[:'X-Api-Version'] = x_api_version header_params[:'X-Account-Id'] = x_account_id # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'ListChargesResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ApiKeyAuth'] = opts.merge( :operation => :"ChargesApi.list_charges", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ChargesApi#list_charges\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |