transbank-oneclick 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 66c30378531b72b12060f22a24a8e153acdcf901
4
+ data.tar.gz: a025f5fa8a78c0fab6e3d408ea820c136fbe484f
5
+ SHA512:
6
+ metadata.gz: 360024f64022ca88b85760953e8ae1dcca24d9a894ab6712112fea83cde62800d43396672f18322eab610111ab4bca889fe125f27e4bf9e78761206752a01521
7
+ data.tar.gz: 971e8cea4b212189e7c3e604556c8a141862a5d8d8e29e82c2206381d8e8b94ea0668a03cadee3b9ba6222d6e76a6dee2c8311b009fa5bfd49486a8768e35472
data/.gitignore ADDED
@@ -0,0 +1,28 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
15
+
16
+
17
+ # OSX
18
+ .DS_Store
19
+ .AppleDouble
20
+ .LSOverride
21
+ # Icon must end with two \r
22
+ Icon
23
+
24
+ # Thumbnails
25
+ ._*
26
+ # Files that might appear on external disk
27
+ .Spotlight-V100
28
+ .Trashes
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in transbank-oneclick.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Ramón Soto
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,155 @@
1
+ # Transbank::Oneclick
2
+
3
+ Ruby Implementation of Transbank Oneclick API SOAP
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'transbank-oneclick'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install transbank-oneclick
20
+
21
+ Run the generator:
22
+
23
+ $ rails generate transbank_oneclick:install
24
+
25
+ ## Usage
26
+
27
+ **Init Inscription**
28
+
29
+ ```ruby
30
+ response = Transbank::Oneclick.init_inscription({
31
+ email: "username@domain",
32
+ username: "username",
33
+ response_url: "http://domain/card"
34
+ })
35
+ => #<Transbank::Oneclick::Response valid: true, token: "sb7068703be6aaed4660ec5c64c861a0705ad0c3104b17608d4c34dd3a32b334", url_webpay: "https://webpay3g.cl/webpayserver/bp_inscription.cgi" >
36
+ response.token
37
+ => "sb7068703be6aaed4660ec5c64c861a0705ad0c3104b17608d4c34dd3a32b334"
38
+ response.url_webpay
39
+ => "https://webpay3g.cl/webpayserver/bp_inscription.cgi"
40
+ response.valid?
41
+ => true
42
+ ```
43
+
44
+ **Finish Inscription**
45
+
46
+ ```ruby
47
+ response = Transbank::Oneclick.finish_inscription(tbk_token)
48
+ => #<Transbank::Oneclick::Response valid: true, auth_code: "1415", credit_card_type: "Visa", last4_card_digits: "3792", response_code: "0", tbk_user: "e5ed4d5a-21bc-30a1-82ac-5hfa3835812p" >
49
+ response.auth_code
50
+ => "1415"
51
+ response.credit_card_type
52
+ => "Visa"
53
+ response.last4_card_digits
54
+ => "3792"
55
+ response.response_code
56
+ => "0"
57
+ response.tbk_user
58
+ => "e5ed4d5a-21bc-30a1-82ac-5hfa3835812p"
59
+ response.valid?
60
+ => true
61
+ ```
62
+
63
+ **Remove User**
64
+
65
+ ```ruby
66
+ response = Transbank::Oneclick.remove_user({
67
+ tbk_user: "35700491-cb03-4bbb-8ab7-29dd7b0771ab",
68
+ username: "username"
69
+ })
70
+ => #<Transbank::Oneclick::Response valid: true, text: "true" >
71
+ response.text
72
+ => true
73
+ response.valid?
74
+ => true
75
+ ```
76
+
77
+ **Authorize**
78
+
79
+ ```ruby
80
+ response = Transbank::Oneclick.authorize({
81
+ amount: "9990",
82
+ tbk_user: "35700491-cb03-4bbb-8ab7-29dd7b0771ab",
83
+ username: "username",
84
+ buy_order: "20110715115550003"
85
+ })
86
+ => #<Transbank::Oneclick::Response valid: true, authorization_code: "1415", credit_card_type: "Visa", last4_card_digits: "3792", response_code: "0", transaction_id: "21695" >
87
+ response.authorization_code
88
+ => "1415"
89
+ response.credit_card_type
90
+ => "Visa"
91
+ response.last4_card_digits
92
+ => "3792"
93
+ response.response_code
94
+ => "0"
95
+ response.transaction_id
96
+ => "21695"
97
+ response.valid?
98
+ => true
99
+ ```
100
+
101
+ **Reverse**
102
+
103
+ ```ruby
104
+ response = Transbank::Oneclick.reverse(buy_order)
105
+ => #<Transbank::Oneclick::Response valid: true, reverse_code: "7597387618992517508", reversed: "true" >
106
+ response.reverse_code
107
+ => "7597387618992517508"
108
+ response.reversed
109
+ => "true"
110
+ response.valid?
111
+ => true
112
+ ```
113
+
114
+ **Available response methods:**
115
+
116
+
117
+ ```ruby
118
+ response.valid? # true or false if any errors occurred (exceptions included)
119
+ response.errors # errors array
120
+ response.errors_display? # errors for human
121
+ response.exception? # true or false if an exception occurred
122
+ response.exception # exception object
123
+ response.attributes # hash attributes response (token, reverse_code . . .)
124
+ ```
125
+
126
+ ## Configuration
127
+
128
+ First, you need to set up your configuration:
129
+
130
+ `rails generate transbank_oneclick:install`
131
+
132
+ Then edit (config/initializers/transbank_oneclick.rb):
133
+
134
+ ```ruby
135
+ Transbank::Oneclick.configure do |config|
136
+ config.url = "ONECLICK_SOAP_URL"
137
+ config.cert_path = "RELATIVE_PATH_TO_CRT_FILE"
138
+ config.key_path = "RELATIVE_PATH_TO_KEY_FILE"
139
+ end
140
+ ```
141
+ ## TODO
142
+ - Testing, testing, testing
143
+ - Refactoring
144
+
145
+ ## Contributing
146
+
147
+ 1. Fork it ( https://github.com/[my-github-username]/transbank-oneclick/fork )
148
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
149
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
150
+ 4. Push to the branch (`git push origin my-new-feature`)
151
+ 5. Create a new Pull Request
152
+
153
+ ## License
154
+
155
+ transbank-oneclick is released under the [MIT License](http://www.opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,11 @@
1
+ module TransbankOneclick
2
+ module Generators
3
+ class InstallGenerator < Rails::Generators::Base
4
+ source_root File.expand_path('../templates', __FILE__)
5
+
6
+ def generate_config_file
7
+ copy_file "transbank_oneclick.rb", "config/initializers/transbank_oneclick.rb"
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,17 @@
1
+ Transbank::Oneclick.configure do |config|
2
+
3
+ # config.url = "ONECLICK_SOAP_URL"
4
+ # config.cert_path = "RELATIVE_PATH_TO_CRT_FILE"
5
+ # config.key_path = "RELATIVE_PATH_TO_KEY_FILE"
6
+
7
+ # These are the default options for Net::HTTP
8
+ # it is also possible to pass them on every request
9
+ # reverse with read_timeout 60 seconds: Transbank::Oneclick.reverse(24575755, http_options: {read_timeout: 60})
10
+ # Default is {}
11
+ # config.http_options = { read_timeout: 80 }
12
+
13
+ # ignores any exception passed as argument
14
+ # not capture any exception: config.rescue_exceptions []
15
+ # Default is [Net::ReadTimeout, Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError]
16
+ # config.rescue_exceptions = [Net::ReadTimeout, Timeout::Error]
17
+ end
@@ -0,0 +1,59 @@
1
+ module Transbank
2
+ module Oneclick
3
+ class Api
4
+ ATTRIBUTES = {
5
+ # init_inscription
6
+ email: :email,
7
+ response_url: :responseURL,
8
+ username: :username,
9
+
10
+ # finish_inscription
11
+ token: :token,
12
+
13
+ # authorize
14
+ amount: :amount,
15
+ tbk_user: :tbkUser,
16
+ username: :username,
17
+ buy_order: :buyOrder,
18
+
19
+ # code_reverse_one_click
20
+ # buyorder: :buyorder,
21
+
22
+ # remove_user
23
+ # tbk_user: :tbkUser,
24
+ # username: :username
25
+ }
26
+
27
+ def init_inscription(params = {}, opt = {})
28
+ call :initInscription, params, opt
29
+ end
30
+
31
+ def finish_inscription(token, opt = {})
32
+ call :finishInscription, {token: token}, opt
33
+ end
34
+
35
+ def authorize(params = {}, opt = {})
36
+ call :authorize, params, opt
37
+ end
38
+
39
+ def reverse(buy_order, opt = {})
40
+ call :codeReverseOneClick, {buyorder: buy_order}, opt
41
+ end
42
+
43
+ def remove_user(params = {}, opt = {})
44
+ call :removeUser, params, opt
45
+ end
46
+
47
+ private
48
+ def call(action, params = {}, opt = {})
49
+ params = build_params(params)
50
+ request = Request.new action, params, opt
51
+ request.response
52
+ end
53
+
54
+ def build_params(hash)
55
+ hash.map {|k, v| [ATTRIBUTES.fetch(k.to_sym, k), v]}.to_h
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,23 @@
1
+ module Transbank
2
+ module Oneclick
3
+ class Client
4
+ attr_accessor :uri, :http
5
+ HEADER = { 'Content-Type' => 'application/soap+xml; charset=utf-8' }
6
+
7
+ def initialize(opt = {})
8
+ opt = Transbank::Oneclick.configuration.http_options.merge(opt)
9
+ self.uri = URI.parse Transbank::Oneclick.configuration.url
10
+ self.http = Net::HTTP.new uri.host, uri.port
11
+
12
+ # load options
13
+ opt.each {|attr, value| http.__send__("#{attr}=", value)}
14
+ http.use_ssl = true
15
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
16
+ end
17
+
18
+ def post(xml_canonicalize)
19
+ http.post(uri.path, xml_canonicalize, HEADER)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,17 @@
1
+ module Transbank
2
+ module Oneclick
3
+ class Configuration
4
+ attr_accessor :url
5
+ attr_accessor :cert_path
6
+ attr_accessor :key_path
7
+ attr_accessor :rescue_exceptions
8
+ attr_accessor :http_options
9
+
10
+ def initialize
11
+ self.rescue_exceptions = [Net::ReadTimeout, Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError,
12
+ Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError]
13
+ self.http_options = {}
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,110 @@
1
+ module Transbank
2
+ module Oneclick
3
+ class Document
4
+ attr_accessor :action, :params, :doc, :cert, :private_key, :template
5
+ SOAP_ENV = 'http://schemas.xmlsoap.org/soap/envelope/'
6
+ NS1 = 'http://webservices.webpayserver.transbank.com/'
7
+ WSSE = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd'
8
+ WSU = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd'
9
+
10
+ def initialize(action, params = {})
11
+ self.cert = OpenSSL::X509::Certificate.new File.read(Transbank::Oneclick.configuration.cert_path)
12
+ self.private_key = OpenSSL::PKey::RSA.new File.read(Transbank::Oneclick.configuration.key_path)
13
+ self.action = action
14
+ self.params = params
15
+ self.doc = template.clone.doc
16
+ sign!
17
+ end
18
+
19
+ def body_id
20
+ OpenSSL::Digest::MD5.hexdigest(action.to_s + params.to_s + DateTime::now.to_s)
21
+ end
22
+
23
+ def body_node
24
+ doc.at_xpath('//SOAP-ENV:Body')
25
+ end
26
+
27
+ def signed_node
28
+ doc.at_xpath '//ds:SignedInfo', {'ds' => 'http://www.w3.org/2000/09/xmldsig#'}
29
+ end
30
+
31
+ def digest_value_node
32
+ doc.at_xpath '//ds:DigestValue', {'ds' => 'http://www.w3.org/2000/09/xmldsig#'}
33
+ end
34
+
35
+ def signature_value_node
36
+ doc.at_xpath '//ds:SignatureValue', {'ds' => 'http://www.w3.org/2000/09/xmldsig#'}
37
+ end
38
+
39
+ def body_canonicalize
40
+ body_node.canonicalize(Nokogiri::XML::XML_C14N_EXCLUSIVE_1_0, nil, nil)
41
+ end
42
+
43
+ def signed_node_canonicalize
44
+ signed_node.canonicalize(Nokogiri::XML::XML_C14N_EXCLUSIVE_1_0, nil, nil)
45
+ end
46
+
47
+ def canonicalize
48
+ doc.canonicalize(Nokogiri::XML::XML_C14N_EXCLUSIVE_1_0, nil, nil)
49
+ end
50
+
51
+ def digest_value
52
+ Base64.encode64(OpenSSL::Digest::SHA1.digest(body_canonicalize)).gsub("\n", '')
53
+ end
54
+
55
+ def signature_value
56
+ Base64.encode64(private_key.sign(OpenSSL::Digest::SHA1.new, signed_node_canonicalize)).gsub("\n", '')
57
+ end
58
+
59
+ def sign!
60
+ digest_value_node.content = digest_value
61
+ signature_value_node.content = signature_value
62
+ end
63
+
64
+ def template
65
+ @template ||= Nokogiri::XML::Builder.new do |xml|
66
+ xml['SOAP-ENV'].Envelope 'xmlns:SOAP-ENV' => SOAP_ENV, 'xmlns:ns1' => NS1 do
67
+ xml.Header do
68
+ xml['wsse'].Security 'xmlns:wsse' => WSSE, 'SOAP-ENV:mustUnderstand' => '1' do
69
+ xml['ds'].Signature 'xmlns:ds' => 'http://www.w3.org/2000/09/xmldsig#' do
70
+ xml.SignedInfo do
71
+ xml.CanonicalizationMethod Algorithm: 'http://www.w3.org/2001/10/xml-exc-c14n#'
72
+ xml.SignatureMethod Algorithm: 'http://www.w3.org/2000/09/xmldsig#rsa-sha1'
73
+ xml.Reference URI: "##{body_id}" do
74
+ xml.Transforms do
75
+ xml.Transform Algorithm: 'http://www.w3.org/2001/10/xml-exc-c14n#'
76
+ end
77
+ xml.DigestMethod Algorithm: 'http://www.w3.org/2000/09/xmldsig#sha1'
78
+ xml.DigestValue ''
79
+ end
80
+ end
81
+ xml.SignatureValue ''
82
+ xml.KeyInfo do
83
+ xml['wsse'].SecurityTokenReference do
84
+ xml['ds'].X509Data do
85
+ xml.X509IssuerSerial do
86
+ xml.X509IssuerName cert.subject.to_s[1..-1].gsub('/', ',')
87
+ xml.X509SerialNumber cert.serial.to_s
88
+ end
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
94
+ end
95
+ xml.Body 'xmlns:wsu' => WSU, 'wsu:Id' => body_id do
96
+ xml['ns1'].send action do
97
+ xml.arg0 do
98
+ params.each do |key, value|
99
+ xml.parent.namespace = xml.parent.namespace_definitions.first
100
+ xml.send key, value
101
+ end
102
+ end
103
+ end
104
+ end
105
+ end
106
+ end
107
+ end
108
+ end
109
+ end
110
+ end
@@ -0,0 +1,32 @@
1
+ module Transbank
2
+ module Oneclick
3
+ class ExceptionResponse
4
+ attr_accessor :exception, :action
5
+
6
+ def initialize(exception, action)
7
+ self.exception = exception
8
+ self.action = action
9
+ end
10
+
11
+ def valid?
12
+ false
13
+ end
14
+
15
+ def errors
16
+ [exception.message]
17
+ end
18
+
19
+ def exception?
20
+ true
21
+ end
22
+
23
+ def errors_display
24
+ "#{exception.class}, #{exception.message}"
25
+ end
26
+
27
+ def inspect
28
+ "#<#{self.class}:, valid: false, error: '#{errors_display}' >"
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,38 @@
1
+ module Transbank
2
+ module Oneclick
3
+ class Request
4
+ attr_accessor :xml, :client, :action, :rescue_exceptions
5
+
6
+ def initialize(action, params = {}, opt = {})
7
+ opt = {
8
+ rescue_exceptions: Transbank::Oneclick.configuration.rescue_exceptions,
9
+ http_options: {}
10
+ }.merge(opt)
11
+
12
+ self.action = action
13
+ self.rescue_exceptions = opt[:rescue_exceptions]
14
+ self.xml = Document.new(action, params)
15
+ self.client = Client.new opt.delete(:http_options)
16
+ end
17
+
18
+ def response
19
+ @Response ||= begin
20
+ Response.new client.post(xml.canonicalize), action
21
+ rescue match_class(rescue_exceptions) => error
22
+ ExceptionResponse.new error, action
23
+ end
24
+ end
25
+
26
+ private
27
+ def match_class(exceptions)
28
+ m = Module.new
29
+ (class << m; self; end).instance_eval do
30
+ define_method(:===) do |error|
31
+ (exceptions || []).include? error.class
32
+ end
33
+ end
34
+ m
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,108 @@
1
+ module Transbank
2
+ module Oneclick
3
+ class Response
4
+ attr_accessor :content, :action, :attributes, :errors, :exception
5
+
6
+ RESPONSE_CODE = {
7
+ '0' => 'aprobado',
8
+ '-1' => 'rechazo',
9
+ '-2' => 'rechazo',
10
+ '-3' => 'rechazo',
11
+ '-4' => 'rechazo',
12
+ '-5' => 'rechazo',
13
+ '-6' => 'rechazo',
14
+ '-7' => 'rechazo',
15
+ '-8' => 'rechazo',
16
+ '-97' => 'limites Oneclick, máximo monto diario de pago excedido',
17
+ '-98' => 'limites Oneclick, máximo monto de pago excedido',
18
+ '-99' => 'limites Oneclick, máxima cantidad de pagos diarios excedido'
19
+ }
20
+
21
+ def initialize(content, action)
22
+ self.content = content
23
+ self.action = action
24
+ self.attributes = xml_result.map{|e| [e.name.underscore.to_sym, e.text]}.to_h
25
+ self.errors = []
26
+ validate!
27
+ end
28
+
29
+ def body
30
+ content.body
31
+ end
32
+
33
+ def http_code
34
+ content.code
35
+ end
36
+
37
+ def doc
38
+ @doc ||= Nokogiri::XML body
39
+ end
40
+
41
+ def xml_result
42
+ doc.at_xpath("//return") && doc.at_xpath("//return").children || []
43
+ end
44
+
45
+ def xml_error
46
+ doc.xpath("//faultstring")
47
+ end
48
+
49
+ def errors_display
50
+ errors.join ', '
51
+ end
52
+
53
+ def valid?
54
+ errors.empty?
55
+ end
56
+
57
+ def response_code_display
58
+ RESPONSE_CODE.fetch(response_code, response_code)
59
+ end
60
+
61
+ def inspect
62
+ result = ["valid: #{valid?}"]
63
+ result << attributes_display if attributes.any?
64
+ result << "error: \"#{errors_display}\"" if errors.any?
65
+ "#<#{self.class} #{result.join(', ')} >"
66
+ end
67
+
68
+ def exception?
69
+ false
70
+ end
71
+
72
+ def exception
73
+ nil
74
+ end
75
+
76
+ def method_missing(method_name, *args, &block)
77
+ attributes[method_name.to_sym] || super
78
+ end
79
+
80
+ def respond_to_missing?(method_name, include_private = false)
81
+ attributes.keys.include?(method_name.to_sym) || super
82
+ end
83
+
84
+ private
85
+ def attributes_display
86
+ attributes.map{|name, value| "#{name}: \"#{value}\""}.join ', '
87
+ end
88
+
89
+ def validate!
90
+ if action =~ /finishInscription|Authorize/ and respond_to?(:response_code) and response_code != '0'
91
+ self.errors << response_code_display
92
+ end
93
+
94
+ if action =~ /removeUser/ and respond_to?(:text) and text != 'true'
95
+ self.errors << 'imposible eliminar la inscripción'
96
+ end
97
+
98
+ if action =~ /codeReverseOneClick/ and respond_to?(:reversed) and reversed != 'true'
99
+ self.errors << 'imposible revertir la compra'
100
+ end
101
+
102
+ if content.class != Net::HTTPOK
103
+ self.errors += xml_error.map(&:text)
104
+ end
105
+ end
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,5 @@
1
+ module Transbank
2
+ module Oneclick
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,33 @@
1
+ require "net/https"
2
+ require "uri"
3
+ require "nokogiri"
4
+
5
+ require "transbank/oneclick/version"
6
+ require "transbank/oneclick/api"
7
+ require "transbank/oneclick/client"
8
+ require "transbank/oneclick/document"
9
+ require "transbank/oneclick/request"
10
+ require "transbank/oneclick/response"
11
+ require "transbank/oneclick/exception_response"
12
+ require "transbank/oneclick/configuration"
13
+
14
+ module Transbank
15
+ module Oneclick
16
+ class << self
17
+ attr_accessor :configuration
18
+
19
+ # Delegate api
20
+ Api.instance_methods.each {|m|define_method(m){|*args| api.send(m, *args)}}
21
+ end
22
+
23
+ def self.configure
24
+ self.configuration ||= Configuration.new
25
+ yield(configuration)
26
+ end
27
+
28
+ def self.api
29
+ @api ||= Api.new
30
+ end
31
+ end
32
+ end
33
+
@@ -0,0 +1 @@
1
+ require "transbank/oneclick"
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'transbank/oneclick/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "transbank-oneclick"
8
+ spec.version = Transbank::Oneclick::VERSION
9
+ spec.authors = ["Ramón Soto"]
10
+ spec.email = ["ramon.soto@clouw.com"]
11
+ spec.summary = %q{transbank oneclick.}
12
+ spec.homepage = ""
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.7"
21
+ spec.add_development_dependency "rake", "~> 10.0"
22
+
23
+ spec.add_dependency "nokogiri", ">= 1.4.0"
24
+ end
metadata ADDED
@@ -0,0 +1,104 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: transbank-oneclick
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Ramón Soto
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-12-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: nokogiri
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 1.4.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 1.4.0
55
+ description:
56
+ email:
57
+ - ramon.soto@clouw.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
67
+ - lib/generators/transbank_oneclick/install/install_generator.rb
68
+ - lib/generators/transbank_oneclick/install/templates/transbank_oneclick.rb
69
+ - lib/transbank-oneclick.rb
70
+ - lib/transbank/oneclick.rb
71
+ - lib/transbank/oneclick/api.rb
72
+ - lib/transbank/oneclick/client.rb
73
+ - lib/transbank/oneclick/configuration.rb
74
+ - lib/transbank/oneclick/document.rb
75
+ - lib/transbank/oneclick/exception_response.rb
76
+ - lib/transbank/oneclick/request.rb
77
+ - lib/transbank/oneclick/response.rb
78
+ - lib/transbank/oneclick/version.rb
79
+ - transbank-oneclick.gemspec
80
+ homepage: ''
81
+ licenses:
82
+ - MIT
83
+ metadata: {}
84
+ post_install_message:
85
+ rdoc_options: []
86
+ require_paths:
87
+ - lib
88
+ required_ruby_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ requirements: []
99
+ rubyforge_project:
100
+ rubygems_version: 2.4.3
101
+ signing_key:
102
+ specification_version: 4
103
+ summary: transbank oneclick.
104
+ test_files: []