Class: Transbank::Oneclick::Request
- Inherits:
-
Object
- Object
- Transbank::Oneclick::Request
- Defined in:
- lib/transbank/oneclick/request.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the value of attribute action.
-
#client ⇒ Object
Returns the value of attribute client.
-
#rescue_exceptions ⇒ Object
Returns the value of attribute rescue_exceptions.
-
#xml ⇒ Object
Returns the value of attribute xml.
Instance Method Summary collapse
-
#initialize(action, params = {}, opt = {}) ⇒ Request
constructor
A new instance of Request.
- #response ⇒ Object
Constructor Details
#initialize(action, params = {}, opt = {}) ⇒ Request
Returns a new instance of Request.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/transbank/oneclick/request.rb', line 6 def initialize(action, params = {}, opt = {}) opt = { rescue_exceptions: Transbank::Oneclick.configuration.rescue_exceptions, http_options: {} }.merge(opt) self.action = action self.rescue_exceptions = opt[:rescue_exceptions] self.xml = Document.new(action, params) self.client = Client.new opt.delete(:http_options) end |
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
4 5 6 |
# File 'lib/transbank/oneclick/request.rb', line 4 def action @action end |
#client ⇒ Object
Returns the value of attribute client.
4 5 6 |
# File 'lib/transbank/oneclick/request.rb', line 4 def client @client end |
#rescue_exceptions ⇒ Object
Returns the value of attribute rescue_exceptions.
4 5 6 |
# File 'lib/transbank/oneclick/request.rb', line 4 def rescue_exceptions @rescue_exceptions end |
#xml ⇒ Object
Returns the value of attribute xml.
4 5 6 |
# File 'lib/transbank/oneclick/request.rb', line 4 def xml @xml end |
Instance Method Details
#response ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/transbank/oneclick/request.rb', line 18 def response @Response ||= begin Response.new client.post(xml.canonicalize), action rescue match_class(rescue_exceptions) => error ExceptionResponse.new error, action end end |