Class: MassPayRubySdk::UserApi
- Inherits:
-
Object
- Object
- MassPayRubySdk::UserApi
- Defined in:
- lib/masspay_ruby_sdk/api/user_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#create_user(user, opts = {}) ⇒ StoredUser
Create a user This POST endpoint is used to create a new user in MassPay.
-
#create_user_with_http_info(user, opts = {}) ⇒ Array<(StoredUser, Integer, Hash)>
Create a user This POST endpoint is used to create a new user in MassPay.
-
#get_user_by_token(user_token, opts = {}) ⇒ StoredUser
Get user by user token This GET endpoint is used to retrieve a user’s profile by their user token in MassPay.
-
#get_user_by_token_with_http_info(user_token, opts = {}) ⇒ Array<(StoredUser, Integer, Hash)>
Get user by user token This GET endpoint is used to retrieve a user's profile by their user token in MassPay.
-
#get_user_history(user_token, opts = {}) ⇒ Array<TxnHistoryResp>
Transactions history This GET endpoint is used to retrieve a list of all transactions, including payouts, loads, and spendbacks, for a provider user with the provided user token.
-
#get_user_history_with_http_info(user_token, opts = {}) ⇒ Array<(Array<TxnHistoryResp>, Integer, Hash)>
Transactions history This GET endpoint is used to retrieve a list of all transactions, including payouts, loads, and spendbacks, for a provider user with the provided user token.
-
#initialize(api_client = ApiClient.default) ⇒ UserApi
constructor
A new instance of UserApi.
-
#update_user(user_token, update_user, opts = {}) ⇒ StoredUser
Updated user This PUT endpoint is used to update the profile information of a user with the provided user token.
-
#update_user_with_http_info(user_token, update_user, opts = {}) ⇒ Array<(StoredUser, Integer, Hash)>
Updated user This PUT endpoint is used to update the profile information of a user with the provided user token.
-
#user_lookup(email, first_name, internal_user_id, opts = {}) ⇒ FoundUser
Lookup an existing user This GET endpoint is used to lookup whether a user with the provided email and first name exists in the MassPay system.
-
#user_lookup_with_http_info(email, first_name, internal_user_id, opts = {}) ⇒ Array<(FoundUser, Integer, Hash)>
Lookup an existing user This GET endpoint is used to lookup whether a user with the provided email and first name exists in the MassPay system.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ UserApi
Returns a new instance of UserApi.
18 19 20 |
# File 'lib/masspay_ruby_sdk/api/user_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/user_api.rb', line 16 def api_client @api_client end |
Instance Method Details
#create_user(user, opts = {}) ⇒ StoredUser
Create a user This POST endpoint is used to create a new user in MassPay.
You can use this endpoint to create a new user with the specified user details in JSON format in the request Body.
To use this endpoint, you need to provide the internal_user_id, country, first_name, last_name, and email as required parameters in the Request Body.
The response will include details about the newly created user.
26 27 28 29 |
# File 'lib/masspay_ruby_sdk/api/user_api.rb', line 26 def create_user(user, opts = {}) data, _status_code, _headers = create_user_with_http_info(user, opts) data end |
#create_user_with_http_info(user, opts = {}) ⇒ Array<(StoredUser, Integer, Hash)>
Create a user This POST endpoint is used to create a new user in MassPay. <br> You can use this endpoint to create a new user with the specified user details in JSON format in the request Body. <br> To use this endpoint, you need to provide the `internal_user_id`, `country`, `first_name`, `last_name`, and `email` as required parameters in the Request Body. <br> The response will include details about the newly created user.
36 37 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 86 87 |
# File 'lib/masspay_ruby_sdk/api/user_api.rb', line 36 def create_user_with_http_info(user, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UserApi.create_user ...' end # verify the required parameter 'user' is set if @api_client.config.client_side_validation && user.nil? fail ArgumentError, "Missing the required parameter 'user' when calling UserApi.create_user" end # resource path local_var_path = '/user' # 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 # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(user) # return_type return_type = opts[:debug_return_type] || 'StoredUser' # auth_names auth_names = opts[:debug_auth_names] || ['AUTHORIZER_NAME'] = opts.merge( :operation => :"UserApi.create_user", :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: UserApi#create_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_user_by_token(user_token, opts = {}) ⇒ StoredUser
Get user by user token This GET endpoint is used to retrieve a user’s profile by their user token in MassPay.
You can use this endpoint to obtain a user profile for a specified user token.
To use this endpoint, you need to provide the user_token as a required parameter in the URL Path.
The response will include all available details for the user.
95 96 97 98 |
# File 'lib/masspay_ruby_sdk/api/user_api.rb', line 95 def get_user_by_token(user_token, opts = {}) data, _status_code, _headers = get_user_by_token_with_http_info(user_token, opts) data end |
#get_user_by_token_with_http_info(user_token, opts = {}) ⇒ Array<(StoredUser, Integer, Hash)>
Get user by user token This GET endpoint is used to retrieve a user's profile by their user token in MassPay. <br> You can use this endpoint to obtain a user profile for a specified user token. <br> To use this endpoint, you need to provide the `user_token` as a required parameter in the URL Path. <br> The response will include all available details for the user.
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 |
# File 'lib/masspay_ruby_sdk/api/user_api.rb', line 106 def get_user_by_token_with_http_info(user_token, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UserApi.get_user_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 UserApi.get_user_by_token" end # resource path local_var_path = '/user/{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] || 'StoredUser' # auth_names auth_names = opts[:debug_auth_names] || ['AUTHORIZER_NAME'] = opts.merge( :operation => :"UserApi.get_user_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: UserApi#get_user_by_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_user_history(user_token, opts = {}) ⇒ Array<TxnHistoryResp>
Transactions history This GET endpoint is used to retrieve a list of all transactions, including payouts, loads, and spendbacks, for a provider user with the provided user token.
You can use this endpoint to obtain a comprehensive history of transactions for the provider user, allowing you to track and analyze their payment activities over time.
To use this endpoint, you need to provide the user_token as a parameter in the URL Path.
The response will contain a JSON array of transaction objects, each including transactions details.
168 169 170 171 |
# File 'lib/masspay_ruby_sdk/api/user_api.rb', line 168 def get_user_history(user_token, opts = {}) data, _status_code, _headers = get_user_history_with_http_info(user_token, opts) data end |
#get_user_history_with_http_info(user_token, opts = {}) ⇒ Array<(Array<TxnHistoryResp>, Integer, Hash)>
Transactions history This GET endpoint is used to retrieve a list of all transactions, including payouts, loads, and spendbacks, for a provider user with the provided user token. <br> You can use this endpoint to obtain a comprehensive history of transactions for the provider user, allowing you to track and analyze their payment activities over time. <br> To use this endpoint, you need to provide the `user_token` as a parameter in the URL Path. <br> The response will contain a JSON array of transaction objects, each including transactions details.
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 215 216 217 218 219 220 221 222 223 224 225 226 227 228 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 |
# File 'lib/masspay_ruby_sdk/api/user_api.rb', line 186 def get_user_history_with_http_info(user_token, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UserApi.get_user_history ...' 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 UserApi.get_user_history" end pattern = Regexp.new(/^[\d]{4}-[\d]{2}-[\d]{2}$/) if @api_client.config.client_side_validation && !opts[:'start_date'].nil? && opts[:'start_date'] !~ pattern fail ArgumentError, "invalid value for 'opts[:\"start_date\"]' when calling UserApi.get_user_history, must conform to the pattern #{pattern}." end pattern = Regexp.new(/^[\d]{4}-[\d]{2}-[\d]{2}$/) if @api_client.config.client_side_validation && !opts[:'end_date'].nil? && opts[:'end_date'] !~ pattern fail ArgumentError, "invalid value for 'opts[:\"end_date\"]' when calling UserApi.get_user_history, must conform to the pattern #{pattern}." end if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1 fail ArgumentError, 'invalid value for "opts[:"page"]" when calling UserApi.get_user_history, must be greater than or equal to 1.' end allowable_values = ["payout", "load", "spendback"] if @api_client.config.client_side_validation && opts[:'type'] && !allowable_values.include?(opts[:'type']) fail ArgumentError, "invalid value for \"type\", must be one of #{allowable_values}" end # resource path local_var_path = '/user/{user_token}/history'.sub('{' + 'user_token' + '}', CGI.escape(user_token.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'number_of_records'] = opts[:'number_of_records'] if !opts[:'number_of_records'].nil? query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil? query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil? query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil? query_params[:'wallet_token'] = opts[:'wallet_token'] if !opts[:'wallet_token'].nil? query_params[:'show_all_clients'] = opts[:'show_all_clients'] if !opts[:'show_all_clients'].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[:'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<TxnHistoryResp>' # auth_names auth_names = opts[:debug_auth_names] || ['AUTHORIZER_NAME'] = opts.merge( :operation => :"UserApi.get_user_history", :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: UserApi#get_user_history\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#update_user(user_token, update_user, opts = {}) ⇒ StoredUser
Updated user This PUT endpoint is used to update the profile information of a user with the provided user token.
You need to provide the user_token in the URL path to identify the user whose information you want to update. The updated information should be provided in the request Body as a JSON object. This endpoint can be used to update various profile information, such as the user’s name, email address, phone number, and more.
The response will contain the updated user information in a JSON format.
267 268 269 270 |
# File 'lib/masspay_ruby_sdk/api/user_api.rb', line 267 def update_user(user_token, update_user, opts = {}) data, _status_code, _headers = update_user_with_http_info(user_token, update_user, opts) data end |
#update_user_with_http_info(user_token, update_user, opts = {}) ⇒ Array<(StoredUser, Integer, Hash)>
Updated user This PUT endpoint is used to update the profile information of a user with the provided user token. <br> You need to provide the `user_token` in the URL path to identify the user whose information you want to update. The updated information should be provided in the request Body as a JSON object. This endpoint can be used to update various profile information, such as the user's name, email address, phone number, and more. <br> The response will contain the updated user information in a JSON format.
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 |
# File 'lib/masspay_ruby_sdk/api/user_api.rb', line 279 def update_user_with_http_info(user_token, update_user, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UserApi.update_user ...' 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 UserApi.update_user" end # verify the required parameter 'update_user' is set if @api_client.config.client_side_validation && update_user.nil? fail ArgumentError, "Missing the required parameter 'update_user' when calling UserApi.update_user" end # resource path local_var_path = '/user/{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(update_user) # return_type return_type = opts[:debug_return_type] || 'StoredUser' # auth_names auth_names = opts[:debug_auth_names] || ['AUTHORIZER_NAME'] = opts.merge( :operation => :"UserApi.update_user", :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(:PUT, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: UserApi#update_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#user_lookup(email, first_name, internal_user_id, opts = {}) ⇒ FoundUser
Lookup an existing user This GET endpoint is used to lookup whether a user with the provided email and first name exists in the MassPay system.
To use this endpoint, you need to provide the email, first_name, and internal_user_id as Query parameters in the URL.
The endpoint will then search for the user based on the provided information and return a JSON response indicating whether the user exists or not. If the user exists, the response will also contain the user’s details, user_token, first_name, last_name and internal_user_id.
345 346 347 348 |
# File 'lib/masspay_ruby_sdk/api/user_api.rb', line 345 def user_lookup(email, first_name, internal_user_id, opts = {}) data, _status_code, _headers = user_lookup_with_http_info(email, first_name, internal_user_id, opts) data end |
#user_lookup_with_http_info(email, first_name, internal_user_id, opts = {}) ⇒ Array<(FoundUser, Integer, Hash)>
Lookup an existing user This GET endpoint is used to lookup whether a user with the provided email and first name exists in the MassPay system. <br> To use this endpoint, you need to provide the `email`, `first_name`, and `internal_user_id` as Query parameters in the URL. <br> The endpoint will then search for the user based on the provided information and return a JSON response indicating whether the user exists or not. If the user exists, the response will also contain the user's details, `user_token`, `first_name`, `last_name` and `internal_user_id`.
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 |
# File 'lib/masspay_ruby_sdk/api/user_api.rb', line 358 def user_lookup_with_http_info(email, first_name, internal_user_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UserApi.user_lookup ...' end # verify the required parameter 'email' is set if @api_client.config.client_side_validation && email.nil? fail ArgumentError, "Missing the required parameter 'email' when calling UserApi.user_lookup" end # verify the required parameter 'first_name' is set if @api_client.config.client_side_validation && first_name.nil? fail ArgumentError, "Missing the required parameter 'first_name' when calling UserApi.user_lookup" end # verify the required parameter 'internal_user_id' is set if @api_client.config.client_side_validation && internal_user_id.nil? fail ArgumentError, "Missing the required parameter 'internal_user_id' when calling UserApi.user_lookup" end # resource path local_var_path = '/user/lookup' # query parameters query_params = opts[:query_params] || {} query_params[:'email'] = email query_params[:'first_name'] = first_name query_params[:'internal_user_id'] = internal_user_id # 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] || 'FoundUser' # auth_names auth_names = opts[:debug_auth_names] || ['AUTHORIZER_NAME'] = opts.merge( :operation => :"UserApi.user_lookup", :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: UserApi#user_lookup\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |