proxypay 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b0cd0307e3e7edbf491c308363f969c964b9bc66
4
- data.tar.gz: 96b8c33acbf6227c4ed748af166542c6f5026cfb
3
+ metadata.gz: bc946694f10a39fd9c0ad3abc069a1cbd2dfe86e
4
+ data.tar.gz: 7cdc43d75e8cf8f4de861d96e9ac4132cf4cbe91
5
5
  SHA512:
6
- metadata.gz: c5789b739a511d2f4bec97f01404a150a0106108885684dc03296c5a5142d86cdda9d486a6abce299a0804f11010078da1e4d066438ebccd2bba8e355ed18934
7
- data.tar.gz: 4c4bc56b8dba936ac01bbf5f708af2d6f4253a0823bad2508ef88716eab3bc37faeee609bb251aa9d07aa9b42e68738f6f1bd7fcad4894d5ad5efbc3bd999aec
6
+ metadata.gz: f2f78b2ec08c2f79ade238e7e4ee0cd28c26bd0be5f17be2f1edede609e16945615ebc6d6d5852b4be31dd3e9e6835458cd37de28e98520a90829c19dddd9685
7
+ data.tar.gz: ed13d322202e59943814c5cd3486298f6b72b1f7294e5e04114f606f52a041b581394070da6ce75a1cbb086746e4fc88ffedc4c81e8b88537d666b9cb48b9a9f
data/README.md CHANGED
@@ -28,51 +28,80 @@ PROXYPAY_API_KEY=your_api_key_obtained_from_proxypay_folks
28
28
 
29
29
  ## Usage
30
30
 
31
- ```ruby
32
- ## Use the class methods to get it going
31
+ ### Use the class methods to get it going
33
32
 
34
- # References
35
- ## Fetch all available references
33
+ ## References
34
+ ### Fetch all available references
35
+ ```ruby
36
36
  Proxypay.get_references
37
+ ```
38
+ ### Fetch references by using query's
39
+ or you can pass one or several query's parameters and even use the custom_fields defined at proxypay.
40
+ ```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.get_reference(options)
43
+ ```
37
44
 
38
- ## Request a new reference - amount and expiration_date for the reference are mandatory
45
+ ### Request a new reference - amount and expiration_date for the reference are mandatory
46
+ ```ruby
39
47
  Proxypay.new_reference("2000.00", "2015-10-10")
48
+ ```
40
49
 
41
- ## Request a reference and add custom fields to your reference for your identification.
50
+ ### Request a reference and add custom fields to your reference for your identification.
51
+ ```ruby
42
52
  other_data = {invoice:"001-2015", description:"Client #{client_number} - monthly payment"}
43
53
  Proxypay.new_reference("2000.00", "2015-10-10", other_data)
54
+ ```
44
55
 
45
- ## Request a reference and add custom fields to your reference for your identification on using a specific API_KEY
56
+ ### Request a reference and add custom fields to your reference for your identification on using a specific API_KEY
57
+ ```ruby
46
58
  other_data = {invoice:"001-2015", description:"Client #{client_number} - monthly payment"}
47
59
  api_key = "OcSLBANU4tjRi9gfW5VUcMqkvzLOcSLBANU4tjRi9gfW5VUcMqkvzL"
48
60
  Proxypay.other_new_reference("2000.00", "2015-10-10", other_data, api_key)
61
+ ```
49
62
 
50
- # Payments
51
- ## Fetch all payments that haven't been acknowledged
63
+ ## Payments
64
+ ### Fetch all payments that haven't been acknowledged
65
+ ```ruby
52
66
  Proxypay.get_payments
67
+ ```
68
+ ### Fetch all the payments with limitation by the specified number(quantity)
69
+ ```ruby
70
+ options = {n:48}
71
+ Proxypay.get_payments(options)
72
+ ```
53
73
 
54
- ## Fetch all payments that haven't been acknowledged for an specific API KEY
74
+ ### Fetch all payments that haven't been acknowledged for an specific API KEY
75
+ ```ruby
55
76
  api_key = "OcSLBANU4tjRi9gfW5VUcMqkvzLOcSLBANU4tjRi9gfW5VUcMqkvzL"
56
77
  Proxypay.other_get_payments(api_key)
78
+ ```
57
79
 
58
- ## Fetch a specific payment by passing his ID
80
+ ### Fetch a specific payment by passing his ID
81
+ ```ruby
59
82
  Proxypay.get_payment("OcSLBANU4tjRi9gfW5VUcMqkvzL")
83
+ ```
60
84
 
61
- ## Acknowledge a payment by passing his ID
85
+ ### Acknowledge a payment by passing his ID
86
+ ```ruby
62
87
  Proxypay.new_payment("OcSLBANU4tjRi9gfW5VUcMqkvzL")
88
+ ```
63
89
 
64
- ## Acknowledge a payment by passing his ID for an specific API KEY
90
+ ### Acknowledge a payment by passing his ID for an specific API KEY
91
+ ```ruby
65
92
  api_key = "OcSLBANU4tjRi9gfW5VUcMqkvzLOcSLBANU4tjRi9gfW5VUcMqkvzL"
66
93
  Proxypay.other_new_payment("OcSLBANU4tjRi9gfW5VUcMqkvzL", api_key)
94
+ ```
67
95
 
68
- ## Acknowledge multiple payments by passing and array of ID's
96
+ ### Acknowledge multiple payments by passing and array of ID's
97
+ ```ruby
69
98
  ids = ["OcSLBANU4tjRi9gfW5VUcMqkvzL", "EcJLBANU4trUi8gfM6MOcMqkvzH","VxELBANU4tjRi9gfW5VUcMqkvzZ"]
70
99
  Proxypay.new_payments(ids)
71
100
  ```
72
101
 
73
102
  ## Help and Docs
74
103
  - [ProxyPay API](https://developer.proxypay.co.ao)
75
- - [RDOC](http://www.rubydoc.info/gems/proxypay/0.1.9)
104
+ - [RDOC](http://www.rubydoc.info/gems/proxypay/0.2.1)
76
105
 
77
106
  ## Development
78
107
  - You can fork the project
data/lib/proxypay.rb CHANGED
@@ -18,19 +18,19 @@ module Proxypay
18
18
  options = {limit: 20, offset: 0, status: nil, q: nil}.merge!(options)
19
19
  # query options
20
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
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
34
34
  end
35
35
 
36
36
  # Fetch a specific reference by his ID string
@@ -41,8 +41,11 @@ module Proxypay
41
41
 
42
42
  # Submit a request to create a new reference
43
43
  def self.new_reference(amount, expiry_date, other_data={})
44
- post("/references",
45
- :body =>{ :reference => {:amount => amount, :expiry_date => expiry_date, :custom_fields => other_data } }.to_json,
44
+ # request body and header
45
+ auth = {:basic_auth => authenticate}
46
+
47
+ post("/references",
48
+ :body =>{ :reference => {:amount => amount, :expiry_date => expiry_date, :custom_fields => other_data } }.to_json,
46
49
  :basic_auth => authenticate,
47
50
  :headers => { 'Content-Type' => 'application/json'}).parsed_response
48
51
  end
@@ -1,3 +1,3 @@
1
1
  module Proxypay
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
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.0
4
+ version: 0.2.1
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-01-03 00:00:00.000000000 Z
11
+ date: 2017-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -71,6 +71,7 @@ files:
71
71
  - bin/setup
72
72
  - lib/proxypay.rb
73
73
  - lib/proxypay/version.rb
74
+ - proxypay-0.2.0.gem
74
75
  - proxypay.gemspec
75
76
  homepage: https://github.com/smaziano/proxypay
76
77
  licenses:
@@ -92,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
93
  version: '0'
93
94
  requirements: []
94
95
  rubyforge_project:
95
- rubygems_version: 2.6.8
96
+ rubygems_version: 2.6.10
96
97
  signing_key:
97
98
  specification_version: 4
98
99
  summary: A Ruby gem for ProxyPay API(https://proxypay.co.ao) made by SmartTechys(http://smarttechys.co.ao)