culqi-ruby 0.0.2

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: 120602ddbb2f4db846536e3ddec0d2e3ef1855dd
4
+ data.tar.gz: 4db8e6317a1187c65b3abf0a4ee06271a9c15b02
5
+ SHA512:
6
+ metadata.gz: 5e6fc9a9d44b8581171acebf29825fa2173f1684d269f3ba11e1f9f66797aa1c5112ae114d3f51a343072aee60b31dcbfe1dc65ec00e7a3ce12eb26b2952fe5e
7
+ data.tar.gz: 6a1e71da14426ea5d7ae07913cfaf3361b1a9e6e2c0bd2c7c0bc4b2a4741b116571c7029fa727669a85b7c44ab1abbc423b3a0132f1039ce446e7913887ccf16
data/lib/culqi-ruby.rb ADDED
@@ -0,0 +1,17 @@
1
+ require 'culqi/version'
2
+ require 'culqi/token'
3
+ require 'culqi/charge'
4
+ require 'culqi/plan'
5
+ require 'culqi/subscription'
6
+ require 'culqi/refund'
7
+
8
+ module Culqi
9
+
10
+ API_BASE = 'https://api.culqi.com/v2'
11
+ READ_TIMEOUT = 120
12
+
13
+ class << self
14
+ attr_accessor :code_commerce, :api_key
15
+ end
16
+
17
+ end
@@ -0,0 +1,17 @@
1
+ require 'culqi-ruby'
2
+ require 'util/connect'
3
+
4
+ module Culqi
5
+
6
+ class Charge
7
+
8
+ URL = '/charges/'
9
+
10
+ def self.create(params={})
11
+ response = Culqi.connect(URL, Culqi.api_key, params)
12
+ return response.read_body
13
+ end
14
+
15
+ end
16
+
17
+ end
data/lib/culqi/plan.rb ADDED
@@ -0,0 +1,17 @@
1
+ require 'culqi-ruby'
2
+ require 'util/connect'
3
+
4
+ module Culqi
5
+
6
+ class Plan
7
+
8
+ URL = '/plans/'
9
+
10
+ def self.create(params={})
11
+ response = Culqi.connect(URL, Culqi.api_key, params)
12
+ return response.read_body
13
+ end
14
+
15
+ end
16
+
17
+ end
@@ -0,0 +1,17 @@
1
+ require 'culqi-ruby'
2
+ require 'util/connect'
3
+
4
+ module Culqi
5
+
6
+ class Refund
7
+
8
+ URL = '/refunds/'
9
+
10
+ def self.create(params={})
11
+ response = Culqi.connect(URL, Culqi.api_key, params)
12
+ return response.read_body
13
+ end
14
+
15
+ end
16
+
17
+ end
@@ -0,0 +1,17 @@
1
+ require 'culqi-ruby'
2
+ require 'util/connect'
3
+
4
+ module Culqi
5
+
6
+ class Subscription
7
+
8
+ URL = '/subscriptions/'
9
+
10
+ def self.create(params={})
11
+ response = Culqi.connect(URL, Culqi.api_key, params)
12
+ return response.read_body
13
+ end
14
+
15
+ end
16
+
17
+ end
@@ -0,0 +1,17 @@
1
+ require 'culqi-ruby'
2
+ require 'util/connect'
3
+
4
+ module Culqi
5
+
6
+ class Token
7
+
8
+ URL = '/tokens/'
9
+
10
+ def self.create(params={})
11
+ response = Culqi.connect(URL, Culqi.code_commerce, params)
12
+ return response.read_body
13
+ end
14
+
15
+ end
16
+
17
+ end
@@ -0,0 +1,3 @@
1
+ module Culqi
2
+ VERSION = "0.0.2"
3
+ end
@@ -0,0 +1,29 @@
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, body)
10
+
11
+ url = URI(Culqi::API_BASE+"#{url}")
12
+
13
+ http = Net::HTTP.new(url.host, url.port)
14
+ http.read_timeout = Culqi::READ_TIMEOUT
15
+ http.use_ssl = true
16
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
17
+
18
+ request = Net::HTTP::Post.new(url)
19
+ request["Authorization"] = "Bearer #{api_key}"
20
+ request["Content-Type"] = 'application/json'
21
+ request["cache-control"] = 'no-cache'
22
+
23
+ request.body = body.to_json
24
+
25
+ return http.request(request)
26
+
27
+ end
28
+
29
+ end
metadata ADDED
@@ -0,0 +1,53 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: culqi-ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Willy Aguirre
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-01-19 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Biblioteca de Culqi en Ruby
14
+ email:
15
+ - marti1125@gmail.com
16
+ - willy.aguirre@culqi.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - lib/culqi-ruby.rb
22
+ - lib/culqi/charge.rb
23
+ - lib/culqi/plan.rb
24
+ - lib/culqi/refund.rb
25
+ - lib/culqi/subscription.rb
26
+ - lib/culqi/token.rb
27
+ - lib/culqi/version.rb
28
+ - lib/util/connect.rb
29
+ homepage: http://rubygems.org/gems/culqi-ruby
30
+ licenses:
31
+ - MIT
32
+ metadata: {}
33
+ post_install_message:
34
+ rdoc_options: []
35
+ require_paths:
36
+ - lib
37
+ required_ruby_version: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: 2.0.0
42
+ required_rubygems_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ requirements: []
48
+ rubyforge_project:
49
+ rubygems_version: 2.6.9
50
+ signing_key:
51
+ specification_version: 4
52
+ summary: Culqi Ruby
53
+ test_files: []