Class: Transbank::Webpay::Client

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

Constant Summary collapse

HEADER =
{ 'Content-Type' => 'application/soap+xml; charset=utf-8' }.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(wsdl_url) ⇒ Client

Returns a new instance of Client.



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/transbank/webpay/client.rb', line 8

def initialize(wsdl_url)
  opt = Transbank::Webpay.configuration.http_options
  self.uri = URI.parse wsdl_url
  self.http = Net::HTTP.new uri.host, uri.port

  # load options
  define_options(opt)

  # default options
  http.use_ssl = true
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE
end

Instance Attribute Details

#httpObject

Returns the value of attribute http.



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

def http
  @http
end

#uriObject

Returns the value of attribute uri.



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

def uri
  @uri
end

Instance Method Details

#post(xml) ⇒ Object



21
22
23
# File 'lib/transbank/webpay/client.rb', line 21

def post(xml)
  http.post(uri.path, xml, HEADER)
end