class Yapstone::TokenApi
Attributes
Public Class Methods
# File lib/yapstone-payments/api/token_api.rb, line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end
Public Instance Methods
Create a Token
Create a token to make a payment. In your request you specify the type of instrument and you are returned a token for that instrument in the response. @param authorization [String] Authorization @param x_yapstone_ip_address [String] IP Address
of the client @param [Hash] opts the optional parameters @option opts [String] :x_yapstone_trace_id Optionally provide a unique identifier for this request, for use later if you need to debug this request with Yapstone
support. Can be any arbitrary string. @option opts [String] :x_yapstone_fpsid Device Finger Print Id @option opts [TokenRequest] :token_request @return [Token]
# File lib/yapstone-payments/api/token_api.rb, line 31 def create_token(authorization, x_yapstone_ip_address, opts = {}) data, _status_code, _headers = create_token_with_http_info(authorization, x_yapstone_ip_address, opts) data end
Create a Token
Create a token to make a payment. In your request you specify the type of instrument and you are returned a token for that instrument in the response. @param authorization [String] Authorization @param x_yapstone_ip_address [String] IP Address
of the client @param [Hash] opts the optional parameters @option opts [String] :x_yapstone_trace_id Optionally provide a unique identifier for this request, for use later if you need to debug this request with Yapstone
support. Can be any arbitrary string. @option opts [String] :x_yapstone_fpsid Device Finger Print Id @option opts [TokenRequest] :token_request @return [Array<(Token
, Integer, Hash)>] Token
data, response status code and response headers
# File lib/yapstone-payments/api/token_api.rb, line 45 def create_token_with_http_info(authorization, x_yapstone_ip_address, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TokenApi.create_token ...' end # verify the required parameter 'authorization' is set if @api_client.config.client_side_validation && authorization.nil? fail ArgumentError, "Missing the required parameter 'authorization' when calling TokenApi.create_token" end # verify the required parameter 'x_yapstone_ip_address' is set if @api_client.config.client_side_validation && x_yapstone_ip_address.nil? fail ArgumentError, "Missing the required parameter 'x_yapstone_ip_address' when calling TokenApi.create_token" end # resource path local_var_path = '/v2/token' # 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' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params[:'Authorization'] = authorization header_params[:'X-Yapstone-IPAddress'] = x_yapstone_ip_address header_params[:'X-Yapstone-Trace-Id'] = opts[:'x_yapstone_trace_id'] if !opts[:'x_yapstone_trace_id'].nil? header_params[:'X-Yapstone-fpsid'] = opts[:'x_yapstone_fpsid'] if !opts[:'x_yapstone_fpsid'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(opts[:'token_request']) # return_type return_type = opts[:return_type] || 'Token' # auth_names auth_names = opts[:auth_names] || ['Bearer'] new_options = opts.merge( :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, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: TokenApi#create_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Lookup a Token
Lookup a token to make a payment. Submit the token ID to retrieve details about the token. @param authorization [String] Authorization @param x_yapstone_ip_address [String] IP Address
of the client @param [Hash] opts the optional parameters @option opts [String] :x_yapstone_trace_id Optionally provide a unique identifier for this request, for use later if you need to debug this request with Yapstone
support. Can be any arbitrary string. @option opts [String] :x_yapstone_fpsid Device Finger Print Id @option opts [Token] :token @return [TokenResponse]
# File lib/yapstone-payments/api/token_api.rb, line 111 def lookup_token(authorization, x_yapstone_ip_address, opts = {}) data, _status_code, _headers = lookup_token_with_http_info(authorization, x_yapstone_ip_address, opts) data end
Lookup a Token
Lookup a token to make a payment. Submit the token ID to retrieve details about the token. @param authorization [String] Authorization @param x_yapstone_ip_address [String] IP Address
of the client @param [Hash] opts the optional parameters @option opts [String] :x_yapstone_trace_id Optionally provide a unique identifier for this request, for use later if you need to debug this request with Yapstone
support. Can be any arbitrary string. @option opts [String] :x_yapstone_fpsid Device Finger Print Id @option opts [Token] :token @return [Array<(TokenResponse
, Integer, Hash)>] TokenResponse
data, response status code and response headers
# File lib/yapstone-payments/api/token_api.rb, line 125 def lookup_token_with_http_info(authorization, x_yapstone_ip_address, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TokenApi.lookup_token ...' end # verify the required parameter 'authorization' is set if @api_client.config.client_side_validation && authorization.nil? fail ArgumentError, "Missing the required parameter 'authorization' when calling TokenApi.lookup_token" end # verify the required parameter 'x_yapstone_ip_address' is set if @api_client.config.client_side_validation && x_yapstone_ip_address.nil? fail ArgumentError, "Missing the required parameter 'x_yapstone_ip_address' when calling TokenApi.lookup_token" end # resource path local_var_path = '/v2/token/lookup' # 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' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params[:'Authorization'] = authorization header_params[:'X-Yapstone-IPAddress'] = x_yapstone_ip_address header_params[:'X-Yapstone-Trace-Id'] = opts[:'x_yapstone_trace_id'] if !opts[:'x_yapstone_trace_id'].nil? header_params[:'X-Yapstone-fpsid'] = opts[:'x_yapstone_fpsid'] if !opts[:'x_yapstone_fpsid'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(opts[:'token']) # return_type return_type = opts[:return_type] || 'TokenResponse' # auth_names auth_names = opts[:auth_names] || ['Bearer'] new_options = opts.merge( :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, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: TokenApi#lookup_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end