Class: MassPayRubySdk::SpendBackApi
- Inherits:
-
Object
- Object
- MassPayRubySdk::SpendBackApi
- Defined in:
- lib/masspay_ruby_sdk/api/spend_back_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#get_user_spendbacks_by_token(user_token, opts = {}) ⇒ Array<SpendBacks>
Get history of spend backs by user token This GET endpoint is used to retrieve the history of spendbacks for a specific user token.
-
#get_user_spendbacks_by_token_with_http_info(user_token, opts = {}) ⇒ Array<(Array<SpendBacks>, Integer, Hash)>
Get history of spend backs by user token This GET endpoint is used to retrieve the history of spendbacks for a specific user token.
-
#initialize(api_client = ApiClient.default) ⇒ SpendBackApi
constructor
A new instance of SpendBackApi.
-
#initiate_spendback(user_token, opts = {}) ⇒ SpendBackTxnResp
Initiate a spend back transaction This POST endpoint is used to initiate a spendback transaction to a provided user token.
-
#initiate_spendback_with_http_info(user_token, opts = {}) ⇒ Array<(SpendBackTxnResp, Integer, Hash)>
Initiate a spend back transaction This POST endpoint is used to initiate a spendback transaction to a provided user token.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ SpendBackApi
Returns a new instance of SpendBackApi.
18 19 20 |
# File 'lib/masspay_ruby_sdk/api/spend_back_api.rb', line 18 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
16 17 18 |
# File 'lib/masspay_ruby_sdk/api/spend_back_api.rb', line 16 def api_client @api_client end |
Instance Method Details
#get_user_spendbacks_by_token(user_token, opts = {}) ⇒ Array<SpendBacks>
Get history of spend backs by user token This GET endpoint is used to retrieve the history of spendbacks for a specific user token.
You can use this endpoint to help manage your payment operations and track the usage of funds by your users.
To use this endpoint, you need to provide the user_token as a parameter in the URL Path.
The endpoint will then return a list of all the historical spendbacks for the provided user token. The response will contain a JSON array with details for each spendback transaction.
27 28 29 30 |
# File 'lib/masspay_ruby_sdk/api/spend_back_api.rb', line 27 def get_user_spendbacks_by_token(user_token, opts = {}) data, _status_code, _headers = get_user_spendbacks_by_token_with_http_info(user_token, opts) data end |
#get_user_spendbacks_by_token_with_http_info(user_token, opts = {}) ⇒ Array<(Array<SpendBacks>, Integer, Hash)>
Get history of spend backs by user token This GET endpoint is used to retrieve the history of spendbacks for a specific user token. <br> You can use this endpoint to help manage your payment operations and track the usage of funds by your users. <br> To use this endpoint, you need to provide the `user_token` as a parameter in the URL Path. <br> The endpoint will then return a list of all the historical spendbacks for the provided user token. The response will contain a JSON array with details for each spendback transaction.
38 39 40 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 |
# File 'lib/masspay_ruby_sdk/api/spend_back_api.rb', line 38 def get_user_spendbacks_by_token_with_http_info(user_token, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SpendBackApi.get_user_spendbacks_by_token ...' end # verify the required parameter 'user_token' is set if @api_client.config.client_side_validation && user_token.nil? fail ArgumentError, "Missing the required parameter 'user_token' when calling SpendBackApi.get_user_spendbacks_by_token" end # resource path local_var_path = '/spendback/{user_token}'.sub('{' + 'user_token' + '}', CGI.escape(user_token.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Array<SpendBacks>' # auth_names auth_names = opts[:debug_auth_names] || ['AUTHORIZER_NAME'] = opts.merge( :operation => :"SpendBackApi.get_user_spendbacks_by_token", :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: SpendBackApi#get_user_spendbacks_by_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#initiate_spendback(user_token, opts = {}) ⇒ SpendBackTxnResp
Initiate a spend back transaction This POST endpoint is used to initiate a spendback transaction to a provided user token.
You can use this endpoint to enable spendback transactions for your users and help them manage their funds more effectively.
To use this endpoint, you need to provide the user_token as a parameter in the URL Path, along with the required parameters in the request Body, including client_spendback_id, source_token, source_currency_code and amount.
The endpoint will then initiate the spendback transaction, transferring funds from the source token to the user token. The response will contain a JSON object indicating the status of the request and any relevant transaction details.
94 95 96 97 |
# File 'lib/masspay_ruby_sdk/api/spend_back_api.rb', line 94 def initiate_spendback(user_token, opts = {}) data, _status_code, _headers = initiate_spendback_with_http_info(user_token, opts) data end |
#initiate_spendback_with_http_info(user_token, opts = {}) ⇒ Array<(SpendBackTxnResp, Integer, Hash)>
Initiate a spend back transaction This POST endpoint is used to initiate a spendback transaction to a provided user token. <br> You can use this endpoint to enable spendback transactions for your users and help them manage their funds more effectively. <br> To use this endpoint, you need to provide the `user_token` as a parameter in the URL Path, along with the required parameters in the request Body, including `client_spendback_id`, `source_token`, `source_currency_code` and `amount`. <br> The endpoint will then initiate the spendback transaction, transferring funds from the source token to the user token. The response will contain a JSON object indicating the status of the request and any relevant transaction details.
106 107 108 109 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 158 |
# File 'lib/masspay_ruby_sdk/api/spend_back_api.rb', line 106 def initiate_spendback_with_http_info(user_token, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SpendBackApi.initiate_spendback ...' end # verify the required parameter 'user_token' is set if @api_client.config.client_side_validation && user_token.nil? fail ArgumentError, "Missing the required parameter 'user_token' when calling SpendBackApi.initiate_spendback" end # resource path local_var_path = '/spendback/{user_token}'.sub('{' + 'user_token' + '}', CGI.escape(user_token.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'spend_back_txn']) # return_type return_type = opts[:debug_return_type] || 'SpendBackTxnResp' # auth_names auth_names = opts[:debug_auth_names] || ['AUTHORIZER_NAME'] = opts.merge( :operation => :"SpendBackApi.initiate_spendback", :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(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: SpendBackApi#initiate_spendback\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |