Class: MassPayRubySdk::AttributeApi
- Inherits:
-
Object
- Object
- MassPayRubySdk::AttributeApi
- Defined in:
- lib/masspay_ruby_sdk/api/attribute_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#get_attrs(currency, user_token, destination_token, opts = {}) ⇒ Array<AttrsRequirement>
Get user attributes for destination_token This GET endpoint is used to retrieve user attributes for a specific destination token.
-
#get_attrs_with_http_info(currency, user_token, destination_token, opts = {}) ⇒ Array<(Array<AttrsRequirement>, Integer, Hash)>
Get user attributes for destination_token This GET endpoint is used to retrieve user attributes for a specific destination token.
-
#initialize(api_client = ApiClient.default) ⇒ AttributeApi
constructor
A new instance of AttributeApi.
-
#store_attrs(currency, user_token, destination_token, attr_txn, opts = {}) ⇒ nil
Store user attributes This POST endpoint is used to store user attributes, allowing you to associate additional data with a user token.
-
#store_attrs_with_http_info(currency, user_token, destination_token, attr_txn, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Store user attributes This POST endpoint is used to store user attributes, allowing you to associate additional data with a user token.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ AttributeApi
Returns a new instance of AttributeApi.
18 19 20 |
# File 'lib/masspay_ruby_sdk/api/attribute_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/attribute_api.rb', line 16 def api_client @api_client end |
Instance Method Details
#get_attrs(currency, user_token, destination_token, opts = {}) ⇒ Array<AttrsRequirement>
Get user attributes for destination_token This GET endpoint is used to retrieve user attributes for a specific destination token.
You can use this endpoint to retrieve user attributes and provide personalized service to your users based on their preferences, demographic data, or other relevant information.
To use this endpoint, you need to provide the user_token, destination_token, and currency as parameters in the URL Path.
The endpoint will then return all the required attributes for the provided user for the specified destination token. If any of the attributes already have a stored value, it will be returned as well.
29 30 31 32 |
# File 'lib/masspay_ruby_sdk/api/attribute_api.rb', line 29 def get_attrs(currency, user_token, destination_token, opts = {}) data, _status_code, _headers = get_attrs_with_http_info(currency, user_token, destination_token, opts) data end |
#get_attrs_with_http_info(currency, user_token, destination_token, opts = {}) ⇒ Array<(Array<AttrsRequirement>, Integer, Hash)>
Get user attributes for destination_token This GET endpoint is used to retrieve user attributes for a specific destination token. <br> You can use this endpoint to retrieve user attributes and provide personalized service to your users based on their preferences, demographic data, or other relevant information. <br> To use this endpoint, you need to provide the `user_token`, `destination_token`, and currency as parameters in the URL Path. <br> The endpoint will then return all the required attributes for the provided user for the specified destination token. If any of the attributes already have a stored value, it will be returned as well.
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 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/masspay_ruby_sdk/api/attribute_api.rb', line 42 def get_attrs_with_http_info(currency, user_token, destination_token, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AttributeApi.get_attrs ...' end # verify the required parameter 'currency' is set if @api_client.config.client_side_validation && currency.nil? fail ArgumentError, "Missing the required parameter 'currency' when calling AttributeApi.get_attrs" end if @api_client.config.client_side_validation && currency.to_s.length > 3 fail ArgumentError, 'invalid value for "currency" when calling AttributeApi.get_attrs, the character length must be smaller than or equal to 3.' end if @api_client.config.client_side_validation && currency.to_s.length < 3 fail ArgumentError, 'invalid value for "currency" when calling AttributeApi.get_attrs, the character length must be great than or equal to 3.' end pattern = Regexp.new(/^[A-Z]{3}$/) if @api_client.config.client_side_validation && currency !~ pattern fail ArgumentError, "invalid value for 'currency' when calling AttributeApi.get_attrs, must conform to the pattern #{pattern}." 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 AttributeApi.get_attrs" end # verify the required parameter 'destination_token' is set if @api_client.config.client_side_validation && destination_token.nil? fail ArgumentError, "Missing the required parameter 'destination_token' when calling AttributeApi.get_attrs" end # resource path local_var_path = '/attribute/{user_token}/{destination_token}/{currency}'.sub('{' + 'currency' + '}', CGI.escape(currency.to_s)).sub('{' + 'user_token' + '}', CGI.escape(user_token.to_s)).sub('{' + 'destination_token' + '}', CGI.escape(destination_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<AttrsRequirement>' # auth_names auth_names = opts[:debug_auth_names] || ['AUTHORIZER_NAME'] = opts.merge( :operation => :"AttributeApi.get_attrs", :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: AttributeApi#get_attrs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#store_attrs(currency, user_token, destination_token, attr_txn, opts = {}) ⇒ nil
Store user attributes This POST endpoint is used to store user attributes, allowing you to associate additional data with a user token.
To use this endpoint, you need to provide the user_token, destination_token, and currency as parameters in the URL Path. You also need to provide the attribute values as JSON parameters in the Request body.
If existing attributes are already stored for the user, this call will override their values.
121 122 123 124 |
# File 'lib/masspay_ruby_sdk/api/attribute_api.rb', line 121 def store_attrs(currency, user_token, destination_token, attr_txn, opts = {}) store_attrs_with_http_info(currency, user_token, destination_token, attr_txn, opts) nil end |
#store_attrs_with_http_info(currency, user_token, destination_token, attr_txn, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Store user attributes This POST endpoint is used to store user attributes, allowing you to associate additional data with a user token. <br> To use this endpoint, you need to provide the `user_token`, `destination_token`, and currency as parameters in the URL Path. You also need to provide the attribute values as JSON parameters in the Request body. <br> If existing attributes are already stored for the user, this call will override their values.
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 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 |
# File 'lib/masspay_ruby_sdk/api/attribute_api.rb', line 135 def store_attrs_with_http_info(currency, user_token, destination_token, attr_txn, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AttributeApi.store_attrs ...' end # verify the required parameter 'currency' is set if @api_client.config.client_side_validation && currency.nil? fail ArgumentError, "Missing the required parameter 'currency' when calling AttributeApi.store_attrs" end if @api_client.config.client_side_validation && currency.to_s.length > 3 fail ArgumentError, 'invalid value for "currency" when calling AttributeApi.store_attrs, the character length must be smaller than or equal to 3.' end if @api_client.config.client_side_validation && currency.to_s.length < 3 fail ArgumentError, 'invalid value for "currency" when calling AttributeApi.store_attrs, the character length must be great than or equal to 3.' end pattern = Regexp.new(/^[A-Z]{3}$/) if @api_client.config.client_side_validation && currency !~ pattern fail ArgumentError, "invalid value for 'currency' when calling AttributeApi.store_attrs, must conform to the pattern #{pattern}." 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 AttributeApi.store_attrs" end # verify the required parameter 'destination_token' is set if @api_client.config.client_side_validation && destination_token.nil? fail ArgumentError, "Missing the required parameter 'destination_token' when calling AttributeApi.store_attrs" end # verify the required parameter 'attr_txn' is set if @api_client.config.client_side_validation && attr_txn.nil? fail ArgumentError, "Missing the required parameter 'attr_txn' when calling AttributeApi.store_attrs" end # resource path local_var_path = '/attribute/{user_token}/{destination_token}/{currency}'.sub('{' + 'currency' + '}', CGI.escape(currency.to_s)).sub('{' + 'user_token' + '}', CGI.escape(user_token.to_s)).sub('{' + 'destination_token' + '}', CGI.escape(destination_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(attr_txn) # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['AUTHORIZER_NAME'] = opts.merge( :operation => :"AttributeApi.store_attrs", :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: AttributeApi#store_attrs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |