Class: Centralpos::Core::Gateway
- Inherits:
-
Object
- Object
- Centralpos::Core::Gateway
- Defined in:
- lib/centralpos/core/gateway.rb
Instance Attribute Summary collapse
-
#mode ⇒ Object
readonly
Returns the value of attribute mode.
Instance Method Summary collapse
- #call(method, extra_data = {}) ⇒ Object
-
#initialize(username, password, mode = :sandbox) ⇒ Gateway
constructor
A new instance of Gateway.
- #live ⇒ Object
- #sandbox ⇒ Object
Constructor Details
#initialize(username, password, mode = :sandbox) ⇒ Gateway
Returns a new instance of Gateway.
6 7 8 9 10 |
# File 'lib/centralpos/core/gateway.rb', line 6 def initialize(username, password, mode = :sandbox) @username = username @password = password @mode = mode end |
Instance Attribute Details
#mode ⇒ Object (readonly)
Returns the value of attribute mode.
4 5 6 |
# File 'lib/centralpos/core/gateway.rb', line 4 def mode @mode end |
Instance Method Details
#call(method, extra_data = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/centralpos/core/gateway.rb', line 12 def call(method, extra_data = {}) = authentication_params.merge(extra_data) response = client.call(method, message: ) parse_result(response, method) rescue Savon::Error, Errno::ENETUNREACH => error handle_exception(error) end |
#live ⇒ Object
27 28 29 30 |
# File 'lib/centralpos/core/gateway.rb', line 27 def live @client = nil @mode = :live end |
#sandbox ⇒ Object
22 23 24 25 |
# File 'lib/centralpos/core/gateway.rb', line 22 def sandbox @client = nil @mode = :sandbox end |