proxypay 0.1.9 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/proxypay.rb +41 -6
- data/lib/proxypay/version.rb +1 -1
- data/proxypay.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0cd0307e3e7edbf491c308363f969c964b9bc66
|
4
|
+
data.tar.gz: 96b8c33acbf6227c4ed748af166542c6f5026cfb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5789b739a511d2f4bec97f01404a150a0106108885684dc03296c5a5142d86cdda9d486a6abce299a0804f11010078da1e4d066438ebccd2bba8e355ed18934
|
7
|
+
data.tar.gz: 4c4bc56b8dba936ac01bbf5f708af2d6f4253a0823bad2508ef88716eab3bc37faeee609bb251aa9d07aa9b42e68738f6f1bd7fcad4894d5ad5efbc3bd999aec
|
data/lib/proxypay.rb
CHANGED
@@ -4,12 +4,33 @@ require "httparty"
|
|
4
4
|
|
5
5
|
module Proxypay
|
6
6
|
include HTTParty
|
7
|
-
base_uri "api.proxypay.co.ao"
|
7
|
+
base_uri "https://api.proxypay.co.ao"
|
8
8
|
|
9
9
|
# Fetch all available references
|
10
10
|
def self.get_references(options={})
|
11
|
-
|
12
|
-
|
11
|
+
# request body and header
|
12
|
+
content = {}
|
13
|
+
auth = {:basic_auth => authenticate}
|
14
|
+
body = {:headers => {'Content-Type' => 'application/json'}}
|
15
|
+
content.merge!(auth)
|
16
|
+
content.merge!(body)
|
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
|
13
34
|
end
|
14
35
|
|
15
36
|
# Fetch a specific reference by his ID string
|
@@ -49,9 +70,23 @@ module Proxypay
|
|
49
70
|
end
|
50
71
|
|
51
72
|
# Fetch all availables payments that have not been acknowledged.
|
52
|
-
def self.get_payments
|
53
|
-
|
54
|
-
|
73
|
+
def self.get_payments(options={})
|
74
|
+
# request body and header
|
75
|
+
content = {}
|
76
|
+
auth = {:basic_auth => authenticate}
|
77
|
+
body = {:headers => {'Content-Type' => 'application/json'}}
|
78
|
+
content.merge!(auth)
|
79
|
+
content.merge!(body)
|
80
|
+
|
81
|
+
# request query options
|
82
|
+
options = {n: nil}.merge!(options)
|
83
|
+
if options.fetch(:n) == nil
|
84
|
+
# get payments without providing any number(quantity)
|
85
|
+
get("/events/payments", content).parsed_response
|
86
|
+
else
|
87
|
+
# get payments with based on the number(quantity) provided
|
88
|
+
get("/events/payments?n=#{options[:n]}", content).parsed_response
|
89
|
+
end
|
55
90
|
end
|
56
91
|
|
57
92
|
# Acknowledge a payment by submitting his ID
|
data/lib/proxypay/version.rb
CHANGED
data/proxypay.gemspec
CHANGED
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.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergio Maziano
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
92
|
version: '0'
|
93
93
|
requirements: []
|
94
94
|
rubyforge_project:
|
95
|
-
rubygems_version: 2.
|
95
|
+
rubygems_version: 2.6.8
|
96
96
|
signing_key:
|
97
97
|
specification_version: 4
|
98
98
|
summary: A Ruby gem for ProxyPay API(https://proxypay.co.ao) made by SmartTechys(http://smarttechys.co.ao)
|