class Kount::Request

This class acts as an abstract class for each type of request.

Attributes

params[RW]

Public Class Methods

new(initial_params = {}) click to toggle source

Initialize a Request object

Example usage

Not used directly. Use Inquiry or Update instead.

@param initial_params [Hash] Initial params for request

# File lib/kount/request.rb, line 13
def initialize(initial_params = {})
  @params = initial_params
end

Public Instance Methods

add_lbin(lbin) click to toggle source

Add LBIN to request DEPRECATED: Please provide in the request constructor hash param instead. Supports BIN lengths of 6 digits or greater @param lbin [String] Long Bank Identification Number

# File lib/kount/request.rb, line 42
def add_lbin(lbin)
  warn "[DEPRECATION] LBIN should be provided in the constructor hash instead"
  params.merge!(LBIN: lbin)
end
add_params(hash) click to toggle source

Add params to the current request object @param hash [Hash] Hash of values to be added

# File lib/kount/request.rb, line 19
def add_params(hash)
  @params.merge!(hash)
end
prepare_params(version, merchant_id, response_format, _ksalt = '') click to toggle source

This method creates the final state of the params collection such that it can be sent to RIS. Items that are specific to either the Inquiry or Update calls are delegated to the prepare_params method in each respective class.

@param version [String] RIS version @param merchant_id [String] Merchant ID @param response_format [String] Response format (JSON) @param _ksalt [String] Kount supplied secret salt for KHASH

# File lib/kount/request.rb, line 32
def prepare_params(version, merchant_id, response_format, _ksalt = '')
  # The KSALT is not used here, however, it is used in the corresponding
  # subclass prepare_params methods.
  params.merge!(VERS: version, MERC: merchant_id, FRMT: response_format)
end