Class: Transbank::Oneclick::Client

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

Constant Summary collapse

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opt = {}) ⇒ Client

Returns a new instance of Client.



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

def initialize(opt = {})
  opt = Transbank::Oneclick.configuration.http_options.merge(opt)
  self.uri = URI.parse Transbank::Oneclick.configuration.url
  self.http = Net::HTTP.new uri.host, uri.port

  # load options
  set_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/oneclick/client.rb', line 4

def http
  @http
end

#uriObject

Returns the value of attribute uri.



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

def uri
  @uri
end

Instance Method Details

#post(xml_canonicalize) ⇒ Object



20
21
22
# File 'lib/transbank/oneclick/client.rb', line 20

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