compropago 0.0.1 → 0.0.2
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.
- data/README.md +11 -11
- data/lib/compropago/client.rb +3 -3
- data/lib/compropago/version.rb +1 -1
- metadata +4 -4
data/README.md
CHANGED
@@ -6,7 +6,7 @@ This gem helps you integrate ComproPago's API to your ruby app.
|
|
6
6
|
|
7
7
|
Add this line to your application's Gemfile:
|
8
8
|
|
9
|
-
gem 'compropago'
|
9
|
+
gem 'compropago', '~> 0.0.1'
|
10
10
|
|
11
11
|
And then execute:
|
12
12
|
|
@@ -20,11 +20,11 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
### Authentication
|
22
22
|
|
23
|
-
We encourage you to set your API keys in an environment variable
|
23
|
+
We encourage you to set your API keys in an environment variable rather than hardcoding your API keys.
|
24
24
|
|
25
25
|
compropago = Compropago::Client.new(ENV['COMPROPAGO_API_KEY'])
|
26
26
|
|
27
|
-
Once you have created an instance, you can call the methods described in the <a href="http://compropago.com/documentacion/api">api reference</a> on it.
|
27
|
+
Once you have created an instance of compropago, you can call the methods described in the <a href="http://compropago.com/documentacion/api">api reference</a> on it.
|
28
28
|
|
29
29
|
|
30
30
|
## Examples
|
@@ -33,31 +33,31 @@ Once you have created an instance, you can call the methods described in the <a
|
|
33
33
|
|
34
34
|
Creating a charge using only the required params <code>product_price</code>, <code>product_name</code>, <code>customer_name</code>, <code>customer_email</code>, <code>payment_type</code>.
|
35
35
|
|
36
|
-
# create_charge
|
36
|
+
# create_charge(product_price, product_name, customer_name, customer_email, payment_type)
|
37
37
|
|
38
|
-
compropago.create_charge
|
38
|
+
compropago.create_charge(3150.0, 'iphone5s', 'Irma Sanz', 'no-replay@compropago.com', 'OXXO')
|
39
39
|
|
40
40
|
Adding the optional params <code>product_id</code> and <code>image_url</code> to the request:
|
41
41
|
|
42
|
-
# create_charge
|
42
|
+
# create_charge(product_price, product_name, customer_name, customer_email, payment_type, product_id, image_url)
|
43
43
|
|
44
|
-
compropago.create_charge
|
44
|
+
compropago.create_charge(3150.0, 'iphone5s', 'Irma Sanz', 'no-replay@email.com', 'OXXO', '5ku8g', 'image.jpg')
|
45
45
|
|
46
46
|
### Verify a charge
|
47
47
|
|
48
48
|
Verify a charge previously made.
|
49
49
|
|
50
|
-
# verify_charge
|
50
|
+
# verify_charge(payment_id)
|
51
51
|
|
52
|
-
compropago.verify_charge
|
52
|
+
compropago.verify_charge('b75076ac-a94b-478a-945c-c2caf85be668')
|
53
53
|
|
54
54
|
### SMS payment instructions
|
55
55
|
|
56
56
|
Send payment instructions over SMS.
|
57
57
|
|
58
|
-
# send_payment_instructions
|
58
|
+
# send_payment_instructions(payment_id, customer_phone, customer_company_phone)
|
59
59
|
|
60
|
-
compropago.
|
60
|
+
compropago.send_payment_instructions('b75076ac-a94b-478a-945c-c2caf85be668', '2221515805', 'TELCEL')
|
61
61
|
|
62
62
|
## Contributing
|
63
63
|
|
data/lib/compropago/client.rb
CHANGED
@@ -14,7 +14,7 @@ module Compropago
|
|
14
14
|
@base_uri = options[:base_uri]
|
15
15
|
end
|
16
16
|
|
17
|
-
def create_charge
|
17
|
+
def create_charge(product_price, product_name, customer_name, customer_email, payment_type, product_id=nil, image_url=nil)
|
18
18
|
uri = URI.parse(BASE_URI+'/charges')
|
19
19
|
http = Net::HTTP.new(uri.host, uri.port)
|
20
20
|
http.use_ssl = true
|
@@ -35,7 +35,7 @@ module Compropago
|
|
35
35
|
response = http.request(request)
|
36
36
|
end
|
37
37
|
|
38
|
-
def verify_charge
|
38
|
+
def verify_charge(payment_id)
|
39
39
|
uri = URI.parse(BASE_URI+'/charges/'+payment_id)
|
40
40
|
http = Net::HTTP.new(uri.host, uri.port)
|
41
41
|
http.use_ssl = true
|
@@ -45,7 +45,7 @@ module Compropago
|
|
45
45
|
response = http.request(request)
|
46
46
|
end
|
47
47
|
|
48
|
-
def send_payment_instructions
|
48
|
+
def send_payment_instructions(payment_id, customer_phone, customer_company_phone)
|
49
49
|
uri = URI.parse(BASE_URI+'/charges/'+payment_id.to_s+'/sms')
|
50
50
|
http = Net::HTTP.new(uri.host, uri.port)
|
51
51
|
http.use_ssl = true
|
data/lib/compropago/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: compropago
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-07-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -74,7 +74,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
74
74
|
version: '0'
|
75
75
|
segments:
|
76
76
|
- 0
|
77
|
-
hash: -
|
77
|
+
hash: -2503675149839758176
|
78
78
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
79
|
none: false
|
80
80
|
requirements:
|
@@ -83,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
83
|
version: '0'
|
84
84
|
segments:
|
85
85
|
- 0
|
86
|
-
hash: -
|
86
|
+
hash: -2503675149839758176
|
87
87
|
requirements: []
|
88
88
|
rubyforge_project:
|
89
89
|
rubygems_version: 1.8.25
|