culqi-ruby 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/culqi-ruby.rb +5 -1
- data/lib/culqi/card.rb +16 -0
- data/lib/culqi/charge.rb +5 -0
- data/lib/culqi/customer.rb +16 -0
- data/lib/culqi/{balance.rb → event.rb} +2 -2
- data/lib/culqi/iins.rb +1 -0
- data/lib/culqi/token.rb +1 -0
- data/lib/culqi/transfer.rb +14 -0
- data/lib/culqi/version.rb +1 -1
- data/lib/operation/delete.rb +2 -2
- data/lib/operation/get.rb +2 -2
- data/lib/operation/list.rb +2 -2
- data/lib/operation/post.rb +4 -4
- data/lib/operation/update.rb +14 -0
- data/lib/util/connect.rb +12 -5
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 424dbe635a7ee59b18d1c879799663b2b8d8f137
|
4
|
+
data.tar.gz: dca4997bd563e524ae42c3ad9e891c07ec198067
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 703144e0c47a9ac2d9cb2db43a866202d15a35657220888237675ef32611b7715ea3d4b21a79178f50162bb64cbcceef0446d22254045fa3677582f39b19842c
|
7
|
+
data.tar.gz: 6c5607eaa4f24658169cb679d1c765f86f12a92d3e378e3929b4f30232d97a81a8759204e90a4ced59652af7b0d288ef79429f4f6fa50a4eec6a19bb7b8deb50
|
data/lib/culqi-ruby.rb
CHANGED
@@ -2,15 +2,19 @@ require 'operation/list'
|
|
2
2
|
require 'operation/get'
|
3
3
|
require 'operation/post'
|
4
4
|
require 'operation/delete'
|
5
|
+
require 'operation/update'
|
5
6
|
|
6
7
|
require 'culqi/version'
|
7
8
|
require 'culqi/iins'
|
9
|
+
require 'culqi/card'
|
10
|
+
require 'culqi/event'
|
11
|
+
require 'culqi/customer'
|
8
12
|
require 'culqi/token'
|
9
13
|
require 'culqi/charge'
|
10
14
|
require 'culqi/plan'
|
11
15
|
require 'culqi/subscription'
|
12
16
|
require 'culqi/refund'
|
13
|
-
require 'culqi/
|
17
|
+
require 'culqi/transfer'
|
14
18
|
|
15
19
|
module Culqi
|
16
20
|
|
data/lib/culqi/card.rb
ADDED
data/lib/culqi/charge.rb
CHANGED
data/lib/culqi/iins.rb
CHANGED
data/lib/culqi/token.rb
CHANGED
data/lib/culqi/version.rb
CHANGED
data/lib/operation/delete.rb
CHANGED
@@ -3,11 +3,11 @@ require 'util/connect'
|
|
3
3
|
module Delete
|
4
4
|
|
5
5
|
def initialize
|
6
|
-
@url =
|
6
|
+
@url = ''
|
7
7
|
end
|
8
8
|
|
9
9
|
def delete(id)
|
10
|
-
response = Culqi.connect(@url+id+
|
10
|
+
response = Culqi.connect(@url+id+'/', Culqi.api_key, nil, 'delete')
|
11
11
|
return response.read_body
|
12
12
|
end
|
13
13
|
|
data/lib/operation/get.rb
CHANGED
@@ -3,11 +3,11 @@ require 'util/connect'
|
|
3
3
|
module Get
|
4
4
|
|
5
5
|
def initialize
|
6
|
-
@url =
|
6
|
+
@url = ''
|
7
7
|
end
|
8
8
|
|
9
9
|
def get(id)
|
10
|
-
response = Culqi.connect(@url+id+
|
10
|
+
response = Culqi.connect(@url+id+'/', Culqi.api_key, nil, 'get')
|
11
11
|
return response.read_body
|
12
12
|
end
|
13
13
|
|
data/lib/operation/list.rb
CHANGED
@@ -3,11 +3,11 @@ require 'util/connect'
|
|
3
3
|
module List
|
4
4
|
|
5
5
|
def initialize
|
6
|
-
@url =
|
6
|
+
@url = ''
|
7
7
|
end
|
8
8
|
|
9
9
|
def list(params={})
|
10
|
-
response = Culqi.connect(@url, Culqi.api_key, params,
|
10
|
+
response = Culqi.connect(@url, Culqi.api_key, params, 'get')
|
11
11
|
return response.read_body
|
12
12
|
end
|
13
13
|
|
data/lib/operation/post.rb
CHANGED
@@ -3,17 +3,17 @@ require 'util/connect'
|
|
3
3
|
module Post
|
4
4
|
|
5
5
|
def initialize
|
6
|
-
@url =
|
6
|
+
@url = ''
|
7
7
|
end
|
8
8
|
|
9
9
|
def create(params={})
|
10
|
-
key =
|
11
|
-
if @url.include?
|
10
|
+
key = ''
|
11
|
+
if @url.include? 'token'
|
12
12
|
key = Culqi.code_commerce
|
13
13
|
else
|
14
14
|
key = Culqi.api_key
|
15
15
|
end
|
16
|
-
response = Culqi.connect(@url, key, params,
|
16
|
+
response = Culqi.connect(@url, key, params, 'post')
|
17
17
|
return response.read_body
|
18
18
|
end
|
19
19
|
|
data/lib/util/connect.rb
CHANGED
@@ -15,13 +15,15 @@ module Culqi
|
|
15
15
|
http.use_ssl = true
|
16
16
|
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
17
17
|
|
18
|
-
request =
|
19
|
-
if type.upcase ==
|
18
|
+
request = ''
|
19
|
+
if type.upcase == 'POST'
|
20
20
|
request = Net::HTTP::Post.new(url)
|
21
|
-
|
21
|
+
if !data.nil?
|
22
|
+
request.body = data.to_json
|
23
|
+
end
|
22
24
|
end
|
23
25
|
|
24
|
-
if type.upcase ==
|
26
|
+
if type.upcase == 'GET'
|
25
27
|
if !data.nil?
|
26
28
|
url.query = URI.encode_www_form(data)
|
27
29
|
request = Net::HTTP::Get.new(url)
|
@@ -30,10 +32,15 @@ module Culqi
|
|
30
32
|
end
|
31
33
|
end
|
32
34
|
|
33
|
-
if type.upcase ==
|
35
|
+
if type.upcase == 'DELETE'
|
34
36
|
request = Net::HTTP::Delete.new(url)
|
35
37
|
end
|
36
38
|
|
39
|
+
if type.upcase == 'PATCH'
|
40
|
+
request = Net::HTTP::Patch.new(url)
|
41
|
+
request.body = data.to_json
|
42
|
+
end
|
43
|
+
|
37
44
|
request["Authorization"] = "Bearer #{api_key}"
|
38
45
|
request["Content-Type"] = 'application/json'
|
39
46
|
request["cache-control"] = 'no-cache'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: culqi-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Willy Aguirre
|
@@ -19,18 +19,22 @@ extensions: []
|
|
19
19
|
extra_rdoc_files: []
|
20
20
|
files:
|
21
21
|
- lib/culqi-ruby.rb
|
22
|
-
- lib/culqi/
|
22
|
+
- lib/culqi/card.rb
|
23
23
|
- lib/culqi/charge.rb
|
24
|
+
- lib/culqi/customer.rb
|
25
|
+
- lib/culqi/event.rb
|
24
26
|
- lib/culqi/iins.rb
|
25
27
|
- lib/culqi/plan.rb
|
26
28
|
- lib/culqi/refund.rb
|
27
29
|
- lib/culqi/subscription.rb
|
28
30
|
- lib/culqi/token.rb
|
31
|
+
- lib/culqi/transfer.rb
|
29
32
|
- lib/culqi/version.rb
|
30
33
|
- lib/operation/delete.rb
|
31
34
|
- lib/operation/get.rb
|
32
35
|
- lib/operation/list.rb
|
33
36
|
- lib/operation/post.rb
|
37
|
+
- lib/operation/update.rb
|
34
38
|
- lib/util/connect.rb
|
35
39
|
homepage: http://rubygems.org/gems/culqi-ruby
|
36
40
|
licenses:
|
@@ -52,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
52
56
|
version: '0'
|
53
57
|
requirements: []
|
54
58
|
rubyforge_project:
|
55
|
-
rubygems_version: 2.6.
|
59
|
+
rubygems_version: 2.6.9
|
56
60
|
signing_key:
|
57
61
|
specification_version: 4
|
58
62
|
summary: Culqi Ruby
|