proxypay 0.1.1 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5099ebdf08c640857f9d41684d9d61380a13bd55
4
- data.tar.gz: 761117dad5d9778bad3ef938ab465bc930c0acdb
3
+ metadata.gz: 83b2dac7bae8d7ee1ae82c086762f08fef916e61
4
+ data.tar.gz: faecc885993aaef5a094ca3107ec46e00e3f27ec
5
5
  SHA512:
6
- metadata.gz: ce78da5889896d97cfbe9a6b3f48cea04b8836608f50536a96cee725ee028b42f728eb293a8009805fc3d45b574a3a1698bf723de3ceddb1cfc6ba56569f6a5b
7
- data.tar.gz: f279a35bc77df7df9d96748536337d9dea7e7245069823781e655d09d8467e46ecedcec21ed8e2a140ca79e7e22011776253637ca10293027ffd6ee775d31e09
6
+ metadata.gz: 942a918b34b2a1f64784d73046181c3afa8dedf74da3986c25c9d54f6b293ef65428a9dd5cf494b435a679db41371836e72d7ddba8b84de2fe0289c61bbffb79
7
+ data.tar.gz: d9b8c4b3f0fe0ae4c70bae7d9f38f7899fcd1b9e200c909e7ed0e7ed9b6858529edb30fc8bc4ce0ef808fe73d006f38974576571c970a28fbb87962a199432fd
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # Proxypay
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/proxypay`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ A ruby gem to connect your application with [ProxyPay](http://www.proxypay.co.ao) API that allows your application to interact with the Angolan ATM system knows as Multicaixa for online payments by reference.
6
4
 
7
5
  ## Installation
8
6
 
@@ -20,19 +18,45 @@ Or install it yourself as:
20
18
 
21
19
  $ gem install proxypay
22
20
 
21
+ ## Setup
22
+ Make sure you setup the environment variables PROXYPAY_USER and PROXYPAY_API_KEY:
23
+
24
+ ```ruby
25
+ PROXYPAY_USER=api
26
+ PROXYPAY_API_KEY=your_api_key_obtained_from_proxypay_folks
27
+ ```
28
+
23
29
  ## Usage
24
30
 
25
- TODO: Write usage instructions here
31
+ ```ruby
32
+ ## Use the class methods to get it going
33
+ # Get References
34
+ Proxypay.get_references
26
35
 
27
- ## Development
36
+ # Request a new reference - amount and expiration_date for the reference are mandatory
37
+ Proxypay.new_reference("2000.00", "2015-10-10")
28
38
 
29
- After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
39
+ # You can pass a hash of other custom columns to help you track the references.
40
+ other_data = {invoice:"001-2015", description:"Client #{client_number} - monthly payment"}
41
+ Proxypay.new_reference("2000.00", "2015-10-10", other_data)
42
+ ```
43
+ work in progress...
30
44
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
45
+ ## Help and Docs for Proxypay API and proxypay gem
46
+ - [ProxyPay API](https://developer.proxypay.co.ao)
47
+ - [proxypay gem RDOC](http://www.rubydoc.info/gems/proxypay/0.1.1)
48
+
49
+ ## Development
50
+ - You can fork the project
51
+ - bundle
52
+ - bundle rake exec
53
+ - Make your feature addition or fix a bug
54
+ - Do not mess with rakefile, version or history (do not submit version bump PLEASE or put it in a different commit so we can ignore it when pull)
55
+ - Send us the pull request
32
56
 
33
57
  ## Contributing
34
58
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/proxypay. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
59
+ Bug reports and pull requests are welcome on GitHub at https://github.com/smaziano/proxypay. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
36
60
 
37
61
 
38
62
  ## License
@@ -1,3 +1,3 @@
1
1
  module Proxypay
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
data/lib/proxypay.rb CHANGED
@@ -7,30 +7,30 @@ module Proxypay
7
7
 
8
8
  # Fetch all available references
9
9
  def self.get_references(options={})
10
- auth = {
11
- username:ENV["PROXY_PAY_USER"],
12
- password:ENV["PROXY_PAY_PASSWORD"]
13
- }
14
- options = {basic_auth:auth}
10
+ options = {:basic_auth => authenticate}
15
11
  get('/references', options).parsed_response
16
12
  end
17
13
 
18
14
  # Submit a request to create a new reference
19
- def self.new_reference(amount, expiry_date)
20
- post('/references', :body =>{:reference => {:amount => amount,
21
- :expiry_date => expiry_date}}.to_json,
22
- :basic_auth => {:username => ENV["PROXY_PAY_USER"], :password => ENV["PROXY_PAY_PASSWORD"]},
23
- :headers => { 'Content-Type' => 'application/json'}).parsed_response
15
+ def self.new_reference(amount, expiry_date, other_data={})
16
+ post('/references',
17
+ :body =>{ :reference => {:amount => amount, :expiry_date => expiry_date, :custom_fields => other_data } }.to_json,
18
+ :basic_auth => authenticate,
19
+ :headers => { 'Content-Type' => 'application/json'}).parsed_response
24
20
  end
25
21
 
26
22
  # Fetch all availables payments
27
23
  def self.get_payments(options={})
24
+ options = {:basic_auth => authenticate}
25
+ get('/events/payments', options).parsed_response
26
+ end
27
+
28
+ private
29
+ def self.authenticate
28
30
  auth = {
29
- username:ENV["PROXY_PAY_USER"],
30
- password:ENV["PROXY_PAY_PASSWORD"]
31
+ username:ENV["PROXYPAY_USER"],
32
+ password:ENV["PROXYPAY_API_KEY"]
31
33
  }
32
- options = {basic_auth:auth}
33
- get('/events/payments', options).parsed_response
34
34
  end
35
35
  end
36
36
 
data/proxypay.gemspec CHANGED
@@ -10,7 +10,8 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["sergio.maziano@gmail.com"]
11
11
 
12
12
  spec.summary = %q{A Ruby gem for ProxyPay API(https://proxypay.co.ao) made by SmartTechys(http://smarttechys.co.ao) }
13
- spec.description = %q{A ruby library to connect your application connect with the ProxyPay API that allows yours applications interact with tha Angolan ATM system also knows as Multicaixa}
13
+ spec.description = %q{A ruby gem to connect your application with ProxyPay(https://www.proxypay.co.ao) API that allows your application to interact with the Angolan ATM system knows as Multicaixa for online payments by reference.}
14
+
14
15
  spec.homepage = "https://github.com/smaziano/proxypay"
15
16
  spec.license = "MIT"
16
17
 
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.1.1
4
+ version: 0.1.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: 2015-10-29 00:00:00.000000000 Z
11
+ date: 2015-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,9 +52,9 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.13.7
55
- description: A ruby library to connect your application connect with the ProxyPay
56
- API that allows yours applications interact with tha Angolan ATM system also knows
57
- as Multicaixa
55
+ description: A ruby gem to connect your application with ProxyPay(https://www.proxypay.co.ao)
56
+ API that allows your application to interact with the Angolan ATM system knows as
57
+ Multicaixa for online payments by reference.
58
58
  email:
59
59
  - sergio.maziano@gmail.com
60
60
  executables: []