Class: Transbank::Webpay::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/transbank/webpay/request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(wsdl_url, action, params = {}) ⇒ Request

Returns a new instance of Request.



6
7
8
9
10
11
# File 'lib/transbank/webpay/request.rb', line 6

def initialize(wsdl_url, action, params = {})
  @params = params
  @action = action
  @document = Document.new(action, params)
  @client = Client.new wsdl_url
end

Instance Attribute Details

#actionObject

Returns the value of attribute action.



4
5
6
# File 'lib/transbank/webpay/request.rb', line 4

def action
  @action
end

#clientObject

Returns the value of attribute client.



4
5
6
# File 'lib/transbank/webpay/request.rb', line 4

def client
  @client
end

#documentObject

Returns the value of attribute document.



4
5
6
# File 'lib/transbank/webpay/request.rb', line 4

def document
  @document
end

#paramsObject

Returns the value of attribute params.



4
5
6
# File 'lib/transbank/webpay/request.rb', line 4

def params
  @params
end

Instance Method Details

#responseObject



13
14
15
16
17
18
19
20
21
# File 'lib/transbank/webpay/request.rb', line 13

def response
  rescue_exceptions = Transbank::Webpay.configuration.rescue_exceptions

  @response ||= begin
    Response.new client.post(document.to_xml), action, params
  rescue match_class(rescue_exceptions) => error
    ExceptionResponse.new error, action, params
  end
end