culqi-ruby 0.0.8 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bd9ccaf9d7ec3cac25c9420edff01fbb16baaebb
4
- data.tar.gz: 00db87838f215d136064a1bc0711a283e864ac47
3
+ metadata.gz: 7e9996f8a286d6c4e8e20316a678c37c39e3110a
4
+ data.tar.gz: 744c51bae0e8984214239e9ff8bfb3164436f558
5
5
  SHA512:
6
- metadata.gz: 2d9aa863476e925180caec3c07b14128c1da82815241f1ce1c2d62bab8ac4705aac6fb34b5268d92fa1ad262a284e0ff7084fcd56b2c405485b3752eff87cd11
7
- data.tar.gz: bac4124bbb1bd81bec4217e1c95bb28953b082eb9384835091fb69d6718e5fe1b2c76667b4002293dff218b1b1bb4de68e2e4897d8e5cf1de85931e4f73c2b92
6
+ metadata.gz: be814860f571c1e6c5c74d153a49acfd9eb555959dbc4e473dab7dda028e184660e519a94c5d3940e0926650ea6fab6e5cd99176c20cf9611f55c91ee565f68c
7
+ data.tar.gz: 1d4e4f1501bce8883a760c4f2a7080df7aaa4f3523836bcb848c9de9ce7342c4a7edd6afdf998b305ab00c370862430628ddc8087451e5df40f936b09b672186
@@ -1,29 +1,30 @@
1
- require 'operation/list'
2
- require 'operation/get'
3
- require 'operation/post'
4
- require 'operation/delete'
5
- require 'operation/update'
6
-
7
- require 'culqi/version'
8
- require 'culqi/iins'
9
- require 'culqi/card'
10
- require 'culqi/event'
11
- require 'culqi/customer'
12
- require 'culqi/token'
13
- require 'culqi/charge'
14
- require 'culqi/plan'
15
- require 'culqi/subscription'
16
- require 'culqi/refund'
17
- require 'culqi/transfer'
18
-
19
- module Culqi
20
-
21
- API_BASE = 'https://api.culqi.com/v2'
22
- READ_TIMEOUT = 120
23
- LIST_TIMEOUT = 360
24
-
25
- class << self
26
- attr_accessor :public_key, :secret_key
27
- end
28
-
29
- end
1
+ require 'operation/list'
2
+ require 'operation/get'
3
+ require 'operation/post'
4
+ require 'operation/delete'
5
+ require 'operation/update'
6
+
7
+ require 'culqi/version'
8
+ require 'culqi/iins'
9
+ require 'culqi/card'
10
+ require 'culqi/event'
11
+ require 'culqi/customer'
12
+ require 'culqi/token'
13
+ require 'culqi/charge'
14
+ require 'culqi/plan'
15
+ require 'culqi/subscription'
16
+ require 'culqi/refund'
17
+ require 'culqi/transfer'
18
+
19
+ module Culqi
20
+
21
+ API_BASE = 'https://api.culqi.com/v2'
22
+ API_BASE_SECURE = 'https://secure.culqi.com/v2'
23
+ READ_TIMEOUT = 120
24
+ LIST_TIMEOUT = 360
25
+
26
+ class << self
27
+ attr_accessor :public_key, :secret_key
28
+ end
29
+
30
+ end
@@ -1,16 +1,16 @@
1
- module Culqi
2
-
3
- class Card
4
-
5
- extend List
6
- extend Post
7
- extend Delete
8
- extend Get
9
-
10
- URL = '/cards/'
11
-
12
- @url = URL
13
-
14
- end
15
-
16
- end
1
+ module Culqi
2
+
3
+ class Card
4
+
5
+ extend List
6
+ extend Post
7
+ extend Delete
8
+ extend Get
9
+
10
+ URL = '/cards/'
11
+
12
+ @url = URL
13
+
14
+ end
15
+
16
+ end
@@ -1,20 +1,20 @@
1
- module Culqi
2
-
3
- class Charge
4
-
5
- extend List
6
- extend Post
7
- extend Get
8
-
9
- URL = '/charges/'
10
-
11
- @url = URL
12
-
13
- def self.capture(id)
14
- response = Culqi.connect("#{@url}#{id}/capture/", Culqi.secret_key, nil, "post", Culqi::READ_TIMEOUT)
15
- return response.read_body
16
- end
17
-
18
- end
19
-
20
- end
1
+ module Culqi
2
+
3
+ class Charge
4
+
5
+ extend List
6
+ extend Post
7
+ extend Get
8
+
9
+ URL = '/charges/'
10
+
11
+ @url = URL
12
+
13
+ def self.capture(id)
14
+ response = Culqi.connect("#{@url}#{id}/capture/", Culqi.secret_key, nil, "post", Culqi::READ_TIMEOUT)
15
+ return response.read_body
16
+ end
17
+
18
+ end
19
+
20
+ end
@@ -1,17 +1,17 @@
1
- module Culqi
2
-
3
- class Customer
4
-
5
- extend List
6
- extend Post
7
- extend Delete
8
- extend Get
9
- extend Update
10
-
11
- URL = '/customers/'
12
-
13
- @url = URL
14
-
15
- end
16
-
17
- end
1
+ module Culqi
2
+
3
+ class Customer
4
+
5
+ extend List
6
+ extend Post
7
+ extend Delete
8
+ extend Get
9
+ extend Update
10
+
11
+ URL = '/customers/'
12
+
13
+ @url = URL
14
+
15
+ end
16
+
17
+ end
@@ -1,14 +1,14 @@
1
- module Culqi
2
-
3
- class Event
4
-
5
- extend List
6
- extend Get
7
-
8
- URL = '/events/'
9
-
10
- @url = URL
11
-
12
- end
13
-
14
- end
1
+ module Culqi
2
+
3
+ class Event
4
+
5
+ extend List
6
+ extend Get
7
+
8
+ URL = '/events/'
9
+
10
+ @url = URL
11
+
12
+ end
13
+
14
+ end
@@ -1,14 +1,14 @@
1
- module Culqi
2
-
3
- class Iins
4
-
5
- extend List
6
- extend Get
7
-
8
- URL = '/iins/'
9
-
10
- @url = URL
11
-
12
- end
13
-
14
- end
1
+ module Culqi
2
+
3
+ class Iins
4
+
5
+ extend List
6
+ extend Get
7
+
8
+ URL = '/iins/'
9
+
10
+ @url = URL
11
+
12
+ end
13
+
14
+ end
@@ -1,16 +1,16 @@
1
- module Culqi
2
-
3
- class Plan
4
-
5
- extend List
6
- extend Post
7
- extend Get
8
- extend Delete
9
-
10
- URL = '/plans/'
11
-
12
- @url = URL
13
-
14
- end
15
-
16
- end
1
+ module Culqi
2
+
3
+ class Plan
4
+
5
+ extend List
6
+ extend Post
7
+ extend Get
8
+ extend Delete
9
+
10
+ URL = '/plans/'
11
+
12
+ @url = URL
13
+
14
+ end
15
+
16
+ end
@@ -1,15 +1,15 @@
1
- module Culqi
2
-
3
- class Refund
4
-
5
- extend List
6
- extend Post
7
- extend Get
8
-
9
- URL = '/refunds/'
10
-
11
- @url = URL
12
-
13
- end
14
-
15
- end
1
+ module Culqi
2
+
3
+ class Refund
4
+
5
+ extend List
6
+ extend Post
7
+ extend Get
8
+
9
+ URL = '/refunds/'
10
+
11
+ @url = URL
12
+
13
+ end
14
+
15
+ end
@@ -1,16 +1,16 @@
1
- module Culqi
2
-
3
- class Subscription
4
-
5
- extend List
6
- extend Post
7
- extend Delete
8
- extend Get
9
-
10
- URL = '/subscriptions/'
11
-
12
- @url = URL
13
-
14
- end
15
-
16
- end
1
+ module Culqi
2
+
3
+ class Subscription
4
+
5
+ extend List
6
+ extend Post
7
+ extend Delete
8
+ extend Get
9
+
10
+ URL = '/subscriptions/'
11
+
12
+ @url = URL
13
+
14
+ end
15
+
16
+ end
@@ -1,15 +1,15 @@
1
- module Culqi
2
-
3
- class Token
4
-
5
- extend List
6
- extend Post
7
- extend Get
8
-
9
- URL = '/tokens/'
10
-
11
- @url = URL
12
-
13
- end
14
-
15
- end
1
+ module Culqi
2
+
3
+ class Token
4
+
5
+ extend List
6
+ extend Post
7
+ extend Get
8
+
9
+ URL = '/tokens/'
10
+
11
+ @url = URL
12
+
13
+ end
14
+
15
+ end
@@ -1,14 +1,14 @@
1
- module Culqi
2
-
3
- class Transfer
4
-
5
- extend List
6
- extend Get
7
-
8
- URL = '/transfers/'
9
-
10
- @url = URL
11
-
12
- end
13
-
14
- end
1
+ module Culqi
2
+
3
+ class Transfer
4
+
5
+ extend List
6
+ extend Get
7
+
8
+ URL = '/transfers/'
9
+
10
+ @url = URL
11
+
12
+ end
13
+
14
+ end
@@ -1,3 +1,3 @@
1
- module Culqi
2
- VERSION = "0.0.8"
3
- end
1
+ module Culqi
2
+ VERSION = "0.1.0"
3
+ end
@@ -1,14 +1,14 @@
1
- require 'util/connect'
2
-
3
- module Culqi::Delete
4
-
5
- def initialize
6
- @url = ''
7
- end
8
-
9
- def delete(id)
10
- response = Culqi.connect("#{@url}#{id}/", Culqi.secret_key, nil, 'delete', Culqi::READ_TIMEOUT)
11
- return response.read_body
12
- end
13
-
14
- end
1
+ require 'util/connect'
2
+
3
+ module Culqi::Delete
4
+
5
+ def initialize
6
+ @url = ''
7
+ end
8
+
9
+ def delete(id)
10
+ response = Culqi.connect("#{@url}#{id}/", Culqi.secret_key, nil, 'delete', Culqi::READ_TIMEOUT)
11
+ return response.read_body
12
+ end
13
+
14
+ end
@@ -1,14 +1,14 @@
1
- require 'util/connect'
2
-
3
- module Culqi::Get
4
-
5
- def initialize
6
- @url = ''
7
- end
8
-
9
- def get(id)
10
- response = Culqi.connect("#{@url}#{id}/", Culqi.secret_key, nil, 'get', Culqi::READ_TIMEOUT)
11
- return response.read_body
12
- end
13
-
14
- end
1
+ require 'util/connect'
2
+
3
+ module Culqi::Get
4
+
5
+ def initialize
6
+ @url = ''
7
+ end
8
+
9
+ def get(id)
10
+ response = Culqi.connect("#{@url}#{id}/", Culqi.secret_key, nil, 'get', Culqi::READ_TIMEOUT)
11
+ return response.read_body
12
+ end
13
+
14
+ end
@@ -1,14 +1,14 @@
1
- require 'util/connect'
2
-
3
- module Culqi::List
4
-
5
- def initialize
6
- @url = ''
7
- end
8
-
9
- def list(params={})
10
- response = Culqi.connect(@url, Culqi.secret_key, params, 'get', Culqi::LIST_TIMEOUT)
11
- return response.read_body
12
- end
13
-
14
- end
1
+ require 'util/connect'
2
+
3
+ module Culqi::List
4
+
5
+ def initialize
6
+ @url = ''
7
+ end
8
+
9
+ def list(params={})
10
+ response = Culqi.connect(@url, Culqi.secret_key, params, 'get', Culqi::LIST_TIMEOUT)
11
+ return response.read_body
12
+ end
13
+
14
+ end
@@ -1,20 +1,23 @@
1
- require 'util/connect'
2
-
3
- module Culqi::Post
4
-
5
- def initialize
6
- @url = ''
7
- end
8
-
9
- def create(params={})
10
- key = ''
11
- if @url.include? 'token'
12
- key = Culqi.public_key
13
- else
14
- key = Culqi.secret_key
15
- end
16
- response = Culqi.connect(@url, key, params, 'post', Culqi::READ_TIMEOUT)
17
- return response.read_body
18
- end
19
-
20
- end
1
+ require 'util/connect'
2
+
3
+ module Culqi::Post
4
+
5
+ def initialize
6
+ @url = ''
7
+ end
8
+
9
+ def create(params={})
10
+ key = ''
11
+ if @url.include? 'token'
12
+ key = Culqi.public_key
13
+ response = Culqi.connect(@url, key, params, 'post', Culqi::READ_TIMEOUT, true)
14
+ return response.read_body
15
+ else
16
+ key = Culqi.secret_key
17
+ response = Culqi.connect(@url, key, params, 'post', Culqi::READ_TIMEOUT)
18
+ return response.read_body
19
+ end
20
+
21
+ end
22
+
23
+ end
@@ -1,14 +1,14 @@
1
- require 'util/connect'
2
-
3
- module Culqi::Update
4
-
5
- def initialize
6
- @url = ''
7
- end
8
-
9
- def update(id, params={})
10
- response = Culqi.connect("#{@url}#{id}/", Culqi.secret_key, params, 'patch', Culqi::READ_TIMEOUT)
11
- return response.read_body
12
- end
13
-
14
- end
1
+ require 'util/connect'
2
+
3
+ module Culqi::Update
4
+
5
+ def initialize
6
+ @url = ''
7
+ end
8
+
9
+ def update(id, params={})
10
+ response = Culqi.connect("#{@url}#{id}/", Culqi.secret_key, params, 'patch', Culqi::READ_TIMEOUT)
11
+ return response.read_body
12
+ end
13
+
14
+ end
@@ -1,52 +1,56 @@
1
- require 'uri'
2
- require 'net/http'
3
- require 'openssl'
4
- require 'json'
5
- require 'culqi-ruby'
6
-
7
- module Culqi
8
-
9
- def self.connect(url, api_key, data, type, time_out)
10
-
11
- url = URI("#{Culqi::API_BASE}#{url}")
12
-
13
- http = Net::HTTP.new(url.host, url.port)
14
- http.read_timeout = time_out
15
- http.use_ssl = true
16
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
17
-
18
- request = ''
19
- if type.upcase == 'POST'
20
- request = Net::HTTP::Post.new(url)
21
- if !data.nil?
22
- request.body = data.to_json
23
- end
24
- end
25
-
26
- if type.upcase == 'GET'
27
- if !data.nil?
28
- url.query = URI.encode_www_form(data)
29
- request = Net::HTTP::Get.new(url)
30
- else
31
- request = Net::HTTP::Get.new(url)
32
- end
33
- end
34
-
35
- if type.upcase == 'DELETE'
36
- request = Net::HTTP::Delete.new(url)
37
- end
38
-
39
- if type.upcase == 'PATCH'
40
- request = Net::HTTP::Patch.new(url)
41
- request.body = data.to_json
42
- end
43
-
44
- request["Authorization"] = "Bearer #{api_key}"
45
- request["Content-Type"] = 'application/json'
46
- request["cache-control"] = 'no-cache'
47
-
48
- return http.request(request)
49
-
50
- end
51
-
52
- end
1
+ require 'uri'
2
+ require 'net/http'
3
+ require 'openssl'
4
+ require 'json'
5
+ require 'culqi-ruby'
6
+
7
+ module Culqi
8
+
9
+ def self.connect(url, api_key, data, type, time_out, secure_url = false)
10
+
11
+ if secure_url == true
12
+ url = URI("#{Culqi::API_BASE_SECURE}#{url}")
13
+ else
14
+ url = URI("#{Culqi::API_BASE}#{url}")
15
+ end
16
+
17
+ http = Net::HTTP.new(url.host, url.port)
18
+ http.read_timeout = time_out
19
+ http.use_ssl = true
20
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
21
+
22
+ request = ''
23
+ if type.upcase == 'POST'
24
+ request = Net::HTTP::Post.new(url)
25
+ if !data.nil?
26
+ request.body = data.to_json
27
+ end
28
+ end
29
+
30
+ if type.upcase == 'GET'
31
+ if !data.nil?
32
+ url.query = URI.encode_www_form(data)
33
+ request = Net::HTTP::Get.new(url)
34
+ else
35
+ request = Net::HTTP::Get.new(url)
36
+ end
37
+ end
38
+
39
+ if type.upcase == 'DELETE'
40
+ request = Net::HTTP::Delete.new(url)
41
+ end
42
+
43
+ if type.upcase == 'PATCH'
44
+ request = Net::HTTP::Patch.new(url)
45
+ request.body = data.to_json
46
+ end
47
+
48
+ request["Authorization"] = "Bearer #{api_key}"
49
+ request["Content-Type"] = 'application/json'
50
+ request["cache-control"] = 'no-cache'
51
+
52
+ return http.request(request)
53
+
54
+ end
55
+
56
+ end
metadata CHANGED
@@ -1,19 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: culqi-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Willy Aguirre
8
+ - Brayan Cruces
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2017-09-04 00:00:00.000000000 Z
12
+ date: 2019-04-30 00:00:00.000000000 Z
12
13
  dependencies: []
13
14
  description: Biblioteca de Culqi en Ruby API v2
14
15
  email:
15
16
  - marti1125@gmail.com
16
- - willy.aguirre@culqi.com
17
+ - brayan.cruces@culqi.com
17
18
  executables: []
18
19
  extensions: []
19
20
  extra_rdoc_files: []
@@ -56,7 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
57
  version: '0'
57
58
  requirements: []
58
59
  rubyforge_project:
59
- rubygems_version: 2.6.8
60
+ rubygems_version: 2.5.1
60
61
  signing_key:
61
62
  specification_version: 4
62
63
  summary: Culqi Ruby