culqi-ruby 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 29a8d51da2c2521fdf9ca81f7c55ee5faef0f5ae
4
- data.tar.gz: 504e28bc60afbb103829b8fa1f682768dd0df2fc
3
+ metadata.gz: 424dbe635a7ee59b18d1c879799663b2b8d8f137
4
+ data.tar.gz: dca4997bd563e524ae42c3ad9e891c07ec198067
5
5
  SHA512:
6
- metadata.gz: e3650e40c38f60b9d4d9f7bbd948d95a1d259e783c5c11a616fa0ae9e19877c389df8fe229e779f3005aa9c1089e06cb4f549c0efcae8aca0d1e7853fbad052a
7
- data.tar.gz: a450e1a96de8a53f8ff7508061879573d3d6b84912fa960e76312e522fc3f56034dc6698a296e8c667ac5cf8580ab638544bfa0a6491d394146ad74140baef5e
6
+ metadata.gz: 703144e0c47a9ac2d9cb2db43a866202d15a35657220888237675ef32611b7715ea3d4b21a79178f50162bb64cbcceef0446d22254045fa3677582f39b19842c
7
+ data.tar.gz: 6c5607eaa4f24658169cb679d1c765f86f12a92d3e378e3929b4f30232d97a81a8759204e90a4ced59652af7b0d288ef79429f4f6fa50a4eec6a19bb7b8deb50
@@ -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/balance'
17
+ require 'culqi/transfer'
14
18
 
15
19
  module Culqi
16
20
 
@@ -0,0 +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
@@ -10,6 +10,11 @@ module Culqi
10
10
 
11
11
  @url = URL
12
12
 
13
+ def capture(id)
14
+ response = Culqi.connect(URL+id+"/capture/", Culqi.api_key, nil, "post")
15
+ return response.read_body
16
+ end
17
+
13
18
  end
14
19
 
15
20
  end
@@ -0,0 +1,16 @@
1
+ module Culqi
2
+
3
+ class Customer
4
+
5
+ extend List
6
+ extend Post
7
+ extend Delete
8
+ extend Get
9
+
10
+ URL = '/customers/'
11
+
12
+ @url = URL
13
+
14
+ end
15
+
16
+ end
@@ -1,11 +1,11 @@
1
1
  module Culqi
2
2
 
3
- class Balance
3
+ class Event
4
4
 
5
5
  extend List
6
6
  extend Get
7
7
 
8
- URL = '/balances/'
8
+ URL = '/events/'
9
9
 
10
10
  @url = URL
11
11
 
@@ -2,6 +2,7 @@ module Culqi
2
2
 
3
3
  class Iins
4
4
 
5
+ extend List
5
6
  extend Get
6
7
 
7
8
  URL = '/iins/'
@@ -2,6 +2,7 @@ module Culqi
2
2
 
3
3
  class Token
4
4
 
5
+ extend List
5
6
  extend Post
6
7
  extend Get
7
8
 
@@ -0,0 +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,3 +1,3 @@
1
1
  module Culqi
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -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+"/", Culqi.api_key, "", "delete")
10
+ response = Culqi.connect(@url+id+'/', Culqi.api_key, nil, 'delete')
11
11
  return response.read_body
12
12
  end
13
13
 
@@ -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+"/", Culqi.api_key, nil, "get")
10
+ response = Culqi.connect(@url+id+'/', Culqi.api_key, nil, 'get')
11
11
  return response.read_body
12
12
  end
13
13
 
@@ -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, "get")
10
+ response = Culqi.connect(@url, Culqi.api_key, params, 'get')
11
11
  return response.read_body
12
12
  end
13
13
 
@@ -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? "token"
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, "post")
16
+ response = Culqi.connect(@url, key, params, 'post')
17
17
  return response.read_body
18
18
  end
19
19
 
@@ -0,0 +1,14 @@
1
+ require 'util/connect'
2
+
3
+ module Update
4
+
5
+ def initialize
6
+ @url = ''
7
+ end
8
+
9
+ def update(id, params={})
10
+ response = Culqi.connect(@url+id+'/', Culqi.api_key, params, 'patch')
11
+ return response.read_body
12
+ end
13
+
14
+ end
@@ -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 == "POST"
18
+ request = ''
19
+ if type.upcase == 'POST'
20
20
  request = Net::HTTP::Post.new(url)
21
- request.body = data.to_json
21
+ if !data.nil?
22
+ request.body = data.to_json
23
+ end
22
24
  end
23
25
 
24
- if type.upcase == "GET"
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 == "DELETE"
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.3
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/balance.rb
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.8
59
+ rubygems_version: 2.6.9
56
60
  signing_key:
57
61
  specification_version: 4
58
62
  summary: Culqi Ruby