proxypay 0.2.2 → 0.2.3
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 +4 -4
- data/.DS_Store +0 -0
- data/README.md +37 -30
- data/lib/proxypay.rb +30 -2
- data/lib/proxypay/version.rb +1 -1
- data/proxypay-0.2.2.gem +0 -0
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c7fd53ce24aa0d2a5cf5e1df3f48ce94a0372f5a
|
|
4
|
+
data.tar.gz: 3aa1e581ff629ae4eaeddf38be9fb146e6de8bc8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 479ee1a986f2faf22accf2547e6f55f262071b6166904e0bc68a93cf9ec271cbc08c4c154582fea4620aeaf64c6aca45731f1023e5a55f105eb0070c63be7351
|
|
7
|
+
data.tar.gz: c95a6ecb4ba19a6c0eb6d092a3f2b19dbfe7a380ac53c5e64ef19b520a2820a604e5027dbe1e4697dc6d3ff535d9c3fbd69413a7f581767830eba79b9fc35df9
|
data/.DS_Store
ADDED
|
Binary file
|
data/README.md
CHANGED
|
@@ -26,6 +26,21 @@ PROXYPAY_USER=api
|
|
|
26
26
|
PROXYPAY_API_KEY=your_api_key_obtained_from_proxypay_folks
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
+
to make requests with another api_key use this on every method call.
|
|
30
|
+
|
|
31
|
+
```ruby
|
|
32
|
+
options = {api_key: your_api_key_obtained_from_proxypay_folks}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
to make the request proxypay's test server use
|
|
38
|
+
|
|
39
|
+
```ruby
|
|
40
|
+
options = {is_test: true}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
|
|
29
44
|
## Usage
|
|
30
45
|
|
|
31
46
|
### Use the class methods to get it going
|
|
@@ -33,31 +48,33 @@ PROXYPAY_API_KEY=your_api_key_obtained_from_proxypay_folks
|
|
|
33
48
|
## References
|
|
34
49
|
### Fetch all available references
|
|
35
50
|
```ruby
|
|
36
|
-
Proxypay.get_references
|
|
51
|
+
Proxypay.get_references # Fetch all references
|
|
52
|
+
Proxypay.get_references(api_key: some_api_key) # fetch using this key
|
|
53
|
+
Proxypay.get_references(is_test: true) # fetch from the test server
|
|
54
|
+
|
|
37
55
|
```
|
|
38
56
|
### Fetch references by using query's
|
|
39
57
|
or you can pass one or several query's parameters and even use the custom_fields defined at proxypay.
|
|
40
58
|
```ruby
|
|
41
|
-
options = {status:"paid", offset:15, limit:13, q:{custom_fields:{your_fild:"some_data", some_other_filed:{that_takes:"an_hash"}}}}
|
|
42
|
-
Proxypay.
|
|
59
|
+
options = {query: {status:"paid", offset:15, limit:13, q:{custom_fields:{your_fild:"some_data", some_other_filed:{that_takes:"an_hash"}}}}}
|
|
60
|
+
Proxypay.get_references(options)
|
|
43
61
|
```
|
|
44
62
|
|
|
45
|
-
###
|
|
63
|
+
### Fetch a reference by using id
|
|
46
64
|
```ruby
|
|
47
|
-
|
|
65
|
+
options = {}
|
|
66
|
+
Proxypay.get_reference(id, options)
|
|
48
67
|
```
|
|
49
68
|
|
|
50
|
-
### Request a reference
|
|
69
|
+
### Request a new reference - amount and expiration_date for the reference are mandatory
|
|
51
70
|
```ruby
|
|
52
|
-
|
|
53
|
-
Proxypay.new_reference("2000.00", "2015-10-10", other_data)
|
|
71
|
+
Proxypay.new_reference("2000.00", "2015-10-10")
|
|
54
72
|
```
|
|
55
73
|
|
|
56
|
-
### Request a reference and add custom fields to your reference for your identification
|
|
74
|
+
### Request a reference and add custom fields to your reference for your identification.
|
|
57
75
|
```ruby
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
Proxypay.other_new_reference("2000.00", "2015-10-10", other_data, api_key)
|
|
76
|
+
options = {custom_fields: {invoice:"001-2015", description:"Client #{client_number} - monthly payment"}}
|
|
77
|
+
Proxypay.new_reference("2000.00", "2015-10-10", options)
|
|
61
78
|
```
|
|
62
79
|
|
|
63
80
|
## Payments
|
|
@@ -67,41 +84,32 @@ Proxypay.get_payments
|
|
|
67
84
|
```
|
|
68
85
|
### Fetch all the payments with limitation by the specified number(quantity)
|
|
69
86
|
```ruby
|
|
70
|
-
options = {n:48}
|
|
87
|
+
options = {query: {n:48}}
|
|
71
88
|
Proxypay.get_payments(options)
|
|
72
89
|
```
|
|
73
90
|
|
|
74
|
-
### Fetch all payments that haven't been acknowledged for an specific API KEY
|
|
75
|
-
```ruby
|
|
76
|
-
api_key = "OcSLBANU4tjRi9gfW5VUcMqkvzLOcSLBANU4tjRi9gfW5VUcMqkvzL"
|
|
77
|
-
Proxypay.other_get_payments(api_key)
|
|
78
|
-
```
|
|
79
|
-
|
|
80
91
|
### Fetch a specific payment by passing his ID
|
|
81
92
|
```ruby
|
|
82
|
-
|
|
93
|
+
options = {}
|
|
94
|
+
Proxypay.get_payment("OcSLBANU4tjRi9gfW5VUcMqkvzL", options)
|
|
83
95
|
```
|
|
84
96
|
|
|
85
97
|
### Acknowledge a payment by passing his ID
|
|
86
98
|
```ruby
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
### Acknowledge a payment by passing his ID for an specific API KEY
|
|
91
|
-
```ruby
|
|
92
|
-
api_key = "OcSLBANU4tjRi9gfW5VUcMqkvzLOcSLBANU4tjRi9gfW5VUcMqkvzL"
|
|
93
|
-
Proxypay.other_new_payment("OcSLBANU4tjRi9gfW5VUcMqkvzL", api_key)
|
|
99
|
+
options = {}
|
|
100
|
+
Proxypay.new_payment("OcSLBANU4tjRi9gfW5VUcMqkvzL", options)
|
|
94
101
|
```
|
|
95
102
|
|
|
96
103
|
### Acknowledge multiple payments by passing and array of ID's
|
|
97
104
|
```ruby
|
|
98
105
|
ids = ["OcSLBANU4tjRi9gfW5VUcMqkvzL", "EcJLBANU4trUi8gfM6MOcMqkvzH","VxELBANU4tjRi9gfW5VUcMqkvzZ"]
|
|
99
|
-
|
|
106
|
+
options = {}
|
|
107
|
+
Proxypay.new_payments(ids, options)
|
|
100
108
|
```
|
|
101
109
|
|
|
102
110
|
## Help and Docs
|
|
103
111
|
- [ProxyPay API](https://developer.proxypay.co.ao)
|
|
104
|
-
- [RDOC](http://www.rubydoc.info/gems/proxypay/0.2.
|
|
112
|
+
- [RDOC](http://www.rubydoc.info/gems/proxypay/0.2.3)
|
|
105
113
|
|
|
106
114
|
## Development
|
|
107
115
|
- You can fork the project
|
|
@@ -119,4 +127,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/smazia
|
|
|
119
127
|
## License
|
|
120
128
|
|
|
121
129
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
|
122
|
-
|
data/lib/proxypay.rb
CHANGED
|
@@ -27,11 +27,11 @@ module Proxypay
|
|
|
27
27
|
|
|
28
28
|
# Submit a request to create a new reference
|
|
29
29
|
def self.new_reference(amount, expiry_date, options={})
|
|
30
|
-
# new_reference(78654.90, '12-12-2012', custom_fields: {foo: 'F0000-45', bar: 'MMM'}, api_key: '
|
|
30
|
+
# new_reference(78654.90, '12-12-2012', custom_fields: {foo: 'F0000-45', bar: 'MMM'}, api_key: 'ctsrxte56v8my_keyv7fuf676t7o89099y85ce6f', is_test: true)
|
|
31
31
|
set_base_url(options.delete(:is_test))
|
|
32
32
|
content = {}
|
|
33
33
|
content[:basic_auth] = authenticate(options.delete(:api_key))
|
|
34
|
-
content[:body] = {:reference => {:amount => amount, :expiry_date => expiry_date, custom_fields: (options.delete(:custom_fields) || {})}}.to_json
|
|
34
|
+
content[:body] = {:reference => {:amount => amount.to_s, :expiry_date => expiry_date.to_s, custom_fields: (options.delete(:custom_fields) || {})}}.to_json
|
|
35
35
|
content[:headers] = {'Content-Type' => 'application/json'}
|
|
36
36
|
post("/references", content).parsed_response
|
|
37
37
|
end
|
|
@@ -65,6 +65,34 @@ module Proxypay
|
|
|
65
65
|
delete("/events/payments", content).parsed_response
|
|
66
66
|
end
|
|
67
67
|
|
|
68
|
+
# Get a list of customers
|
|
69
|
+
def self.get_customers(options = {})
|
|
70
|
+
set_base_url(options.delete(:is_test))
|
|
71
|
+
# request body and header
|
|
72
|
+
content = {}
|
|
73
|
+
content[:basic_auth] = authenticate(options.delete(:api_key))
|
|
74
|
+
content[:headers] = {'Content-Type' => 'application/json'}
|
|
75
|
+
content[:query] = options.delete(:query) || {}
|
|
76
|
+
get("/customers", content).parsed_response
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# get a customer by id
|
|
80
|
+
def self.get_customer(id, options = {})
|
|
81
|
+
set_base_url(options.delete(:is_test))
|
|
82
|
+
options = {:basic_auth => authenticate(options.delete(:api_key))}
|
|
83
|
+
get("/customers/#{id}", options).parsed_response
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Store a new customer or update one
|
|
87
|
+
def self.new_customer(id, nome, telemovel, email, options = {})
|
|
88
|
+
set_base_url(options.delete(:is_test))
|
|
89
|
+
content = {}
|
|
90
|
+
content[:basic_auth] = authenticate(options.delete(:api_key))
|
|
91
|
+
content[:body] = {:customer => {:name => nome.to_s, :mobile => telemovel.to_s, :email => email.to_s}}.to_json
|
|
92
|
+
content[:headers] = {'Content-Type' => 'application/json'}
|
|
93
|
+
put("/customers/#{id}", content).parsed_response
|
|
94
|
+
end
|
|
95
|
+
|
|
68
96
|
def self.set_base_url(is_test = false)
|
|
69
97
|
self.base_uri is_test == true ? "https://api.proxypay.co.ao/tests" : "https://api.proxypay.co.ao"
|
|
70
98
|
end
|
data/lib/proxypay/version.rb
CHANGED
data/proxypay-0.2.2.gem
ADDED
|
Binary file
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: proxypay
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sergio Maziano
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-
|
|
11
|
+
date: 2017-09-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -61,6 +61,7 @@ executables: []
|
|
|
61
61
|
extensions: []
|
|
62
62
|
extra_rdoc_files: []
|
|
63
63
|
files:
|
|
64
|
+
- ".DS_Store"
|
|
64
65
|
- ".gitignore"
|
|
65
66
|
- CODE_OF_CONDUCT.md
|
|
66
67
|
- Gemfile
|
|
@@ -72,6 +73,7 @@ files:
|
|
|
72
73
|
- lib/proxypay.rb
|
|
73
74
|
- lib/proxypay/version.rb
|
|
74
75
|
- proxypay-0.2.1.gem
|
|
76
|
+
- proxypay-0.2.2.gem
|
|
75
77
|
- proxypay.gemspec
|
|
76
78
|
homepage: https://github.com/smaziano/proxypay
|
|
77
79
|
licenses:
|