Class: Kount::Request
- Inherits:
-
Object
- Object
- Kount::Request
- Defined in:
- lib/kount/request.rb
Overview
This class acts as an abstract class for each type of request.
Instance Attribute Summary collapse
-
#params ⇒ Object
Returns the value of attribute params.
Instance Method Summary collapse
-
#add_lbin(lbin) ⇒ Object
Add LBIN to request DEPRECATED: Please provide
in the request constructor hash paraminstead. -
#add_params(hash) ⇒ Object
Add params to the current request object.
-
#initialize(initial_params = {}) ⇒ Request
constructor
Initialize a Request object.
-
#prepare_params(version, merchant_id, response_format, _ksalt = '') ⇒ Object
This method creates the final state of the params collection such that it can be sent to RIS.
Constructor Details
#initialize(initial_params = {}) ⇒ Request
Initialize a Request object
Example usage
Not used directly. Use Inquiry or Update instead.
13 14 15 |
# File 'lib/kount/request.rb', line 13 def initialize(initial_params = {}) @params = initial_params end |
Instance Attribute Details
#params ⇒ Object
Returns the value of attribute params.
5 6 7 |
# File 'lib/kount/request.rb', line 5 def params @params end |
Instance Method Details
#add_lbin(lbin) ⇒ Object
Add LBIN to request DEPRECATED: Please provide in the request constructor hash param instead. Supports BIN lengths of 6 digits or greater
42 43 44 45 |
# 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) ⇒ Object
Add params to the current request object
19 20 21 |
# File 'lib/kount/request.rb', line 19 def add_params(hash) @params.merge!(hash) end |
#prepare_params(version, merchant_id, response_format, _ksalt = '') ⇒ Object
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.
32 33 34 35 36 |
# 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 |