Class: TransactPro::Gateway
- Inherits:
-
Object
- Object
- TransactPro::Gateway
- Defined in:
- lib/transact_pro/gateway.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(options) ⇒ Gateway
constructor
A new instance of Gateway.
- #request(request_options) ⇒ Object
Constructor Details
#initialize(options) ⇒ Gateway
Returns a new instance of Gateway.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/transact_pro/gateway.rb', line 4 def initialize() test = TransactPro::DEFAULTS[:TEST] || !![:TEST] verbose = !![:VERBOSE] env_key = (test ? :TEST_ENV : :PRODUCTION_ENV) @options = { pwd: Digest::SHA1.hexdigest([:PASSWORD].to_s), guid: [:GUID].to_s }.merge(TransactPro::DEFAULTS[env_key]) @options.merge!(.merge(TEST: test, VERBOSE: verbose)) unless @options[:GUID].to_s[%r'\A(?:\w){4}-(?:\w){4}-(?:\w){4}-(?:\w){4}\z'] raise ArgumentError.new( "'#{@options[:GUID]}' is not a valid GUID for a gateway" ) end unless @options[:PASSWORD].to_s.size > 0 raise ArgumentError.new( "'#{@options[:PASSWORD]}' is not a valid PASSWORD for a gateway" ) end if @options[:ACCOUNT_3D].to_s.size < 1 && @options[:ACCOUNT_NON3D].to_s.size < 1 raise ArgumentError.new( "As a minimum specify a ACCOUNT_3D or a ACCOUNT_NON3D for a gateway" ) end end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
2 3 4 |
# File 'lib/transact_pro/gateway.rb', line 2 def @options end |
Instance Method Details
#request(request_options) ⇒ Object
36 37 38 |
# File 'lib/transact_pro/gateway.rb', line 36 def request() TransactPro::Request.new(.merge()) end |