Class: Aimastering::PaymentApi
- Inherits:
-
Object
- Object
- Aimastering::PaymentApi
- Defined in:
- lib/aimastering/api/payment_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#create_payment(product_token, service, opts = {}) ⇒ Payment
Create a new payment.
-
#create_payment_with_http_info(product_token, service, opts = {}) ⇒ Array<(Payment, Fixnum, Hash)>
Create a new payment.
-
#execute_payment(id, payer_id, opts = {}) ⇒ Payment
Execute a payment by id.
-
#execute_payment_with_http_info(id, payer_id, opts = {}) ⇒ Array<(Payment, Fixnum, Hash)>
Execute a payment by id.
-
#get_payment(id, opts = {}) ⇒ Payment
Get a payment by id.
-
#get_payment_with_http_info(id, opts = {}) ⇒ Array<(Payment, Fixnum, Hash)>
Get a payment by id.
-
#initialize(api_client = ApiClient.default) ⇒ PaymentApi
constructor
A new instance of PaymentApi.
-
#list_payments(opts = {}) ⇒ Array<Payment>
Get all accessable payments.
-
#list_payments_with_http_info(opts = {}) ⇒ Array<(Array<Payment>, Fixnum, Hash)>
Get all accessable payments.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ PaymentApi
Returns a new instance of PaymentApi.
19 20 21 |
# File 'lib/aimastering/api/payment_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/aimastering/api/payment_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#create_payment(product_token, service, opts = {}) ⇒ Payment
Create a new payment.
30 31 32 33 |
# File 'lib/aimastering/api/payment_api.rb', line 30 def create_payment(product_token, service, opts = {}) data, _status_code, _headers = create_payment_with_http_info(product_token, service, opts) return data end |
#create_payment_with_http_info(product_token, service, opts = {}) ⇒ Array<(Payment, Fixnum, Hash)>
Create a new payment.
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 |
# File 'lib/aimastering/api/payment_api.rb', line 42 def create_payment_with_http_info(product_token, service, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: PaymentApi.create_payment ..." end # verify the required parameter 'product_token' is set if @api_client.config.client_side_validation && product_token.nil? fail ArgumentError, "Missing the required parameter 'product_token' when calling PaymentApi.create_payment" end # verify the required parameter 'service' is set if @api_client.config.client_side_validation && service.nil? fail ArgumentError, "Missing the required parameter 'service' when calling PaymentApi.create_payment" end # verify enum value if @api_client.config.client_side_validation && !['paypal', 'stripe'].include?(service) fail ArgumentError, "invalid value for 'service', must be one of paypal, stripe" end # resource path local_var_path = "/payments" # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data']) # form parameters form_params = {} form_params["product_token"] = product_token form_params["service"] = service form_params["token"] = opts[:'token'] if !opts[:'token'].nil? # http body (model) post_body = nil auth_names = ['bearer'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Payment') if @api_client.config.debugging @api_client.config.logger.debug "API called: PaymentApi#create_payment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#execute_payment(id, payer_id, opts = {}) ⇒ Payment
Execute a payment by id.
99 100 101 102 |
# File 'lib/aimastering/api/payment_api.rb', line 99 def execute_payment(id, payer_id, opts = {}) data, _status_code, _headers = execute_payment_with_http_info(id, payer_id, opts) return data end |
#execute_payment_with_http_info(id, payer_id, opts = {}) ⇒ Array<(Payment, Fixnum, Hash)>
Execute a payment by id.
110 111 112 113 114 115 116 117 118 119 120 121 122 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 |
# File 'lib/aimastering/api/payment_api.rb', line 110 def execute_payment_with_http_info(id, payer_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: PaymentApi.execute_payment ..." 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 PaymentApi.execute_payment" end if @api_client.config.client_side_validation && id < 1 fail ArgumentError, 'invalid value for "id" when calling PaymentApi.execute_payment, must be greater than or equal to 1.' end # verify the required parameter 'payer_id' is set if @api_client.config.client_side_validation && payer_id.nil? fail ArgumentError, "Missing the required parameter 'payer_id' when calling PaymentApi.execute_payment" end # resource path local_var_path = "/payments/{id}/execute".sub('{' + 'id' + '}', id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data']) # form parameters form_params = {} form_params["payer_id"] = payer_id # http body (model) post_body = nil auth_names = ['bearer'] data, status_code, headers = @api_client.call_api(:PUT, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Payment') if @api_client.config.debugging @api_client.config.logger.debug "API called: PaymentApi#execute_payment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_payment(id, opts = {}) ⇒ Payment
Get a payment by id.
164 165 166 167 |
# File 'lib/aimastering/api/payment_api.rb', line 164 def get_payment(id, opts = {}) data, _status_code, _headers = get_payment_with_http_info(id, opts) return data end |
#get_payment_with_http_info(id, opts = {}) ⇒ Array<(Payment, Fixnum, Hash)>
Get a payment by id.
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'lib/aimastering/api/payment_api.rb', line 174 def get_payment_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: PaymentApi.get_payment ..." 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 PaymentApi.get_payment" end if @api_client.config.client_side_validation && id < 1 fail ArgumentError, 'invalid value for "id" when calling PaymentApi.get_payment, must be greater than or equal to 1.' end # resource path local_var_path = "/payments/{id}".sub('{' + 'id' + '}', id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['bearer'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Payment') if @api_client.config.debugging @api_client.config.logger.debug "API called: PaymentApi#get_payment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#list_payments(opts = {}) ⇒ Array<Payment>
Get all accessable payments.
220 221 222 223 |
# File 'lib/aimastering/api/payment_api.rb', line 220 def list_payments(opts = {}) data, _status_code, _headers = list_payments_with_http_info(opts) return data end |
#list_payments_with_http_info(opts = {}) ⇒ Array<(Array<Payment>, Fixnum, Hash)>
Get all accessable payments.
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 |
# File 'lib/aimastering/api/payment_api.rb', line 229 def list_payments_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: PaymentApi.list_payments ..." end # resource path local_var_path = "/payments" # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['bearer'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Array<Payment>') if @api_client.config.debugging @api_client.config.logger.debug "API called: PaymentApi#list_payments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |