proxypay 0.2.1 → 0.2.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.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/proxypay/version.rb +1 -1
- data/lib/proxypay.rb +41 -85
- data/proxypay-0.2.1.gem +0 -0
- metadata +4 -4
- data/proxypay-0.2.0.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24b46cc765e5d6400ad538fbc114ccc9c9eb93cb
|
4
|
+
data.tar.gz: 002c820f1ac4d26a81a30f088af008cec97262ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa063b0c31bb1980c35d2de5647f735041790ebd884f9cd5d6a3e39be36a45159bf6916c1d0ca2d2f0521d7baab7e17bb88df238ca61a85256477bbbdc3902ce
|
7
|
+
data.tar.gz: c09bc6cd2a142725db4817df1979deacb1658a616e0d09306cd9599e7aeb91fe6148363ddb1f4ed122d63a90a8c5e1bf44a1ed5311a24e16b1a7764f60c16942
|
data/README.md
CHANGED
@@ -101,7 +101,7 @@ Proxypay.new_payments(ids)
|
|
101
101
|
|
102
102
|
## Help and Docs
|
103
103
|
- [ProxyPay API](https://developer.proxypay.co.ao)
|
104
|
-
- [RDOC](http://www.rubydoc.info/gems/proxypay/0.2.
|
104
|
+
- [RDOC](http://www.rubydoc.info/gems/proxypay/0.2.2)
|
105
105
|
|
106
106
|
## Development
|
107
107
|
- You can fork the project
|
data/lib/proxypay/version.rb
CHANGED
data/lib/proxypay.rb
CHANGED
@@ -7,117 +7,73 @@ module Proxypay
|
|
7
7
|
base_uri "https://api.proxypay.co.ao"
|
8
8
|
|
9
9
|
# Fetch all available references
|
10
|
-
def self.get_references(options={})
|
10
|
+
def self.get_references(options = {})
|
11
|
+
# Proxypay.get_references(query: {limit: 20}, is_test: true, api_key: '0djwano5yth94ihrtw34ot9cehn9emo')
|
12
|
+
set_base_url(options.delete(:is_test))
|
11
13
|
# request body and header
|
12
14
|
content = {}
|
13
|
-
|
14
|
-
|
15
|
-
content.
|
16
|
-
content.
|
17
|
-
# request query options
|
18
|
-
options = {limit: 20, offset: 0, status: nil, q: nil}.merge!(options)
|
19
|
-
# query options
|
20
|
-
case options != nil
|
21
|
-
# get refs with provided status w/o specific custom query
|
22
|
-
when options.fetch(:status) != nil && options.fetch(:q) == nil
|
23
|
-
get("/references?limit=#{options[:limit]}&offset=#{options[:offset]}&status=#{options[:status]}", content).parsed_response
|
24
|
-
# get refs with provided custom query with specifc status
|
25
|
-
when options.fetch(:status) != nil && options.fetch(:q) != nil
|
26
|
-
get("/references?q=#{options[:q]}&limit=#{options[:limit]}&offset=#{options[:offset]}&status=#{options[:status]}", content).parsed_response
|
27
|
-
# get refs with provided custom query w/o providing specific status
|
28
|
-
when options.fetch(:status) == nil && options.fetch(:q) != nil
|
29
|
-
get("/references?q=#{options[:q]}&limit=#{options[:limit]}&offset=#{options[:offset]}", content).parsed_response
|
30
|
-
else
|
31
|
-
# just get all the reference as per the api defaults (when there is no args provided)
|
32
|
-
get("/references", content).parsed_response
|
33
|
-
end
|
15
|
+
content[:basic_auth] = authenticate(options.delete(:api_key))
|
16
|
+
content[:headers] = {'Content-Type' => 'application/json'}
|
17
|
+
content[:query] = options.delete(:query) || {}
|
18
|
+
get("/references", content).parsed_response
|
34
19
|
end
|
35
20
|
|
36
21
|
# Fetch a specific reference by his ID string
|
37
|
-
def self.get_reference(id)
|
38
|
-
options
|
22
|
+
def self.get_reference(id, options = {})
|
23
|
+
set_base_url(options.delete(:is_test))
|
24
|
+
options = {:basic_auth => authenticate(options.delete(:api_key))}
|
39
25
|
get("/references/#{id}", options).parsed_response
|
40
26
|
end
|
41
27
|
|
42
28
|
# Submit a request to create a new reference
|
43
|
-
def self.new_reference(amount, expiry_date,
|
44
|
-
#
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
end
|
52
|
-
|
53
|
-
# Submit a request to create a new reference on behalf of other API_KEY
|
54
|
-
def self.other_new_reference(amount, expiry_date, other_data={}, api_key)
|
55
|
-
auth = {
|
56
|
-
username:"api",
|
57
|
-
password:"#{api_key}"
|
58
|
-
}
|
59
|
-
post("/references",
|
60
|
-
:body =>{ :reference => {:amount => amount, :expiry_date => expiry_date, :custom_fields => other_data } }.to_json,
|
61
|
-
:basic_auth => auth,
|
62
|
-
:headers => { 'Content-Type' => 'application/json'}).parsed_response
|
63
|
-
end
|
64
|
-
|
65
|
-
# Fetch all the payments that have not been acknoledged (by submiting the api key)
|
66
|
-
def self.other_get_payments(api_key)
|
67
|
-
auth = {
|
68
|
-
username:"api",
|
69
|
-
password:"#{api_key}"
|
70
|
-
}
|
71
|
-
options = {:basic_auth => auth}
|
72
|
-
get("/events/payments", options).parsed_response
|
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: 'ctsrxte56v8bgfyv7fuf676t7o89099y85ce6f', is_test: true)
|
31
|
+
set_base_url(options.delete(:is_test))
|
32
|
+
content = {}
|
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
|
35
|
+
content[:headers] = {'Content-Type' => 'application/json'}
|
36
|
+
post("/references", content).parsed_response
|
73
37
|
end
|
74
38
|
|
75
39
|
# Fetch all availables payments that have not been acknowledged.
|
76
40
|
def self.get_payments(options={})
|
41
|
+
# Proxypay.get_payments(query: {limit: 20}, is_test: true, api_key: '0djwano5yth94ihrtw34ot9cehn9emo')
|
42
|
+
set_base_url(options.delete(:is_test))
|
77
43
|
# request body and header
|
78
44
|
content = {}
|
79
|
-
|
80
|
-
|
81
|
-
content.
|
82
|
-
content.
|
83
|
-
|
84
|
-
# request query options
|
85
|
-
options = {n: nil}.merge!(options)
|
86
|
-
if options.fetch(:n) == nil
|
87
|
-
# get payments without providing any number(quantity)
|
88
|
-
get("/events/payments", content).parsed_response
|
89
|
-
else
|
90
|
-
# get payments with based on the number(quantity) provided
|
91
|
-
get("/events/payments?n=#{options[:n]}", content).parsed_response
|
92
|
-
end
|
45
|
+
content[:basic_auth] = authenticate(options.delete(:api_key))
|
46
|
+
content[:headers] = {'Content-Type' => 'application/json'}
|
47
|
+
content[:query] = options.delete(:query) || {}
|
48
|
+
get("/events/payments", content).parsed_response
|
93
49
|
end
|
94
50
|
|
95
51
|
# Acknowledge a payment by submitting his ID
|
96
|
-
def self.new_payment(id)
|
97
|
-
options
|
98
|
-
|
52
|
+
def self.new_payment(id, options = {})
|
53
|
+
set_base_url(options.delete(:is_test))
|
54
|
+
content = {:basic_auth => authenticate(options.delete(:api_key))}
|
55
|
+
delete("/events/payments/#{id}", content).parsed_response
|
99
56
|
end
|
100
57
|
|
101
|
-
# Acknowledge
|
102
|
-
def self.
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
delete("/events/payments
|
58
|
+
# Acknowledge multiple payments by submitting an array of ids
|
59
|
+
def self.new_payments(ids, options = {})
|
60
|
+
set_base_url(options.delete(:is_test))
|
61
|
+
content = {}
|
62
|
+
content[:body] = { :ids => ids }.to_json
|
63
|
+
content[:basic_auth] = authenticate(options.delete(:api_key))
|
64
|
+
content[:headers] = {'Content-Type' => 'application/json'}
|
65
|
+
delete("/events/payments", content).parsed_response
|
109
66
|
end
|
110
67
|
|
111
|
-
|
112
|
-
|
113
|
-
delete("/events/payments", :body => { :ids => ids }.to_json, :basic_auth => authenticate, :headers => { 'Content-Type' => 'application/json'} ).parsed_response
|
68
|
+
def self.set_base_url(is_test = false)
|
69
|
+
self.base_uri is_test == true ? "https://api.proxypay.co.ao/tests" : "https://api.proxypay.co.ao"
|
114
70
|
end
|
115
71
|
|
116
72
|
private
|
117
|
-
def self.authenticate
|
73
|
+
def self.authenticate(api_key = nil)
|
118
74
|
auth = {
|
119
|
-
username:ENV["PROXYPAY_USER"],
|
120
|
-
password:ENV["PROXYPAY_API_KEY"]
|
75
|
+
username: api_key.nil? ? ENV["PROXYPAY_USER"] : 'api',
|
76
|
+
password: api_key.nil? ? ENV["PROXYPAY_API_KEY"] : api_key
|
121
77
|
}
|
122
78
|
return auth
|
123
79
|
end
|
data/proxypay-0.2.1.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.2
|
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-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -71,7 +71,7 @@ files:
|
|
71
71
|
- bin/setup
|
72
72
|
- lib/proxypay.rb
|
73
73
|
- lib/proxypay/version.rb
|
74
|
-
- proxypay-0.2.
|
74
|
+
- proxypay-0.2.1.gem
|
75
75
|
- proxypay.gemspec
|
76
76
|
homepage: https://github.com/smaziano/proxypay
|
77
77
|
licenses:
|
@@ -93,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
93
|
version: '0'
|
94
94
|
requirements: []
|
95
95
|
rubyforge_project:
|
96
|
-
rubygems_version: 2.6.
|
96
|
+
rubygems_version: 2.6.6
|
97
97
|
signing_key:
|
98
98
|
specification_version: 4
|
99
99
|
summary: A Ruby gem for ProxyPay API(https://proxypay.co.ao) made by SmartTechys(http://smarttechys.co.ao)
|
data/proxypay-0.2.0.gem
DELETED
Binary file
|