pin-ruby 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/Guardfile +9 -0
- data/LICENSE.txt +22 -0
- data/README.md +58 -0
- data/Rakefile +1 -0
- data/lib/generators/pin.rb +11 -0
- data/lib/generators/pin/install_generator.rb +25 -0
- data/lib/generators/pin/templates/initializer.rb +9 -0
- data/lib/generators/pin/templates/pin.yml +14 -0
- data/lib/pin.rb +15 -0
- data/lib/pin/api.rb +4 -0
- data/lib/pin/api/charges.rb +44 -0
- data/lib/pin/api/client.rb +136 -0
- data/lib/pin/api/customers.rb +38 -0
- data/lib/pin/api/refunds.rb +21 -0
- data/lib/pin/api/tokens.rb +39 -0
- data/lib/pin/configuration.rb +10 -0
- data/lib/pin/error.rb +28 -0
- data/lib/pin/models/card.rb +7 -0
- data/lib/pin/models/charge.rb +7 -0
- data/lib/pin/models/customer.rb +7 -0
- data/lib/pin/models/refund.rb +7 -0
- data/lib/pin/version.rb +3 -0
- data/pin-ruby.gemspec +31 -0
- data/spec/configuration_spec.rb +11 -0
- data/spec/spec_helper.rb +15 -0
- metadata +186 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 10451e99848a72485de75f1a067cfec66258cf2b
|
4
|
+
data.tar.gz: c6fc3a9faf980cf884a63370221584b6839cdb0f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6613afaf1c0acafcc46be6215616ebaf32424097cb8911370d8d6a394ce959a41663c71edd5548a8a70fb0a70f20114149fa0b2c3048e8ba05883c102a6c5f84
|
7
|
+
data.tar.gz: 7ae82e3e032a9114f7b4fcec891e73ef60576a8da68ec24c4eb647f2d8ac71f3ea180f0c4bb507a55ffe2e24cd2406852e97cee77da95a09053e0fd216e6ac43
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
guard 'rspec', :version => 2 do
|
2
|
+
watch(%r{^spec/.+_spec\.rb$})
|
3
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
4
|
+
watch('spec/spec_helper.rb') { "spec" }
|
5
|
+
|
6
|
+
watch(%r{^lib/clever/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
7
|
+
watch(%r{^lib/clever/endpoints/(.+)\.rb$}) { |m| "spec/endpoints/#{m[1]}_spec.rb" }
|
8
|
+
watch(%r{^lib/clever/models/(.+)\.rb$}) { |m| "spec/models/#{m[1]}_spec.rb" }
|
9
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Michael Shimmins
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# Pin::Ruby
|
2
|
+
|
3
|
+
A Ruby library for interacting with v1 of the [Pin Payments API](https://pin.net.au/docs/api).
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'pin-ruby'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install pin-ruby
|
18
|
+
|
19
|
+
# Configuration
|
20
|
+
|
21
|
+
## Rails application
|
22
|
+
|
23
|
+
The Pin library includes a generator to create a config file and initializer for you:
|
24
|
+
|
25
|
+
$ rails g pin:install --publishable-key your_key_here --secret-key your_secret_here
|
26
|
+
|
27
|
+
The generator adds two files for your rails project:
|
28
|
+
|
29
|
+
* config/pin.yml
|
30
|
+
* config/initializers/pin.rb
|
31
|
+
|
32
|
+
Customise the config/pin.yml config file if you wish to use different publishable keys per environment (by default it
|
33
|
+
uses the same token in development, test and production).
|
34
|
+
|
35
|
+
The Pin library is configured during rails initialization using the generated files, and no further configuration
|
36
|
+
is necessary before use.
|
37
|
+
|
38
|
+
## Non-rails application
|
39
|
+
|
40
|
+
When using the Pin library in a non-rails application, you must configure it to use your Pin publishable key manually:
|
41
|
+
|
42
|
+
Pin.configure do |config|
|
43
|
+
config.publishable_key = 'YOUR_PUBLISHABLE_KEY'
|
44
|
+
config.secret_key = 'YOUR_SECRET_KEY'
|
45
|
+
config.endpoint = 'api.pin.net.au'
|
46
|
+
end
|
47
|
+
|
48
|
+
## Usage
|
49
|
+
|
50
|
+
TODO: Write usage instructions here
|
51
|
+
|
52
|
+
## Contributing
|
53
|
+
|
54
|
+
1. Fork it
|
55
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
56
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
57
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
58
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'rails/generators/named_base'
|
2
|
+
|
3
|
+
module Pin
|
4
|
+
module Generators
|
5
|
+
class Base < ::Rails::Generators::NamedBase
|
6
|
+
def self.source_root
|
7
|
+
@_rspec_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'pin', generator_name, 'templates'))
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Pin
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < ::Rails::Generators::Base
|
4
|
+
class_option :publishable_key, :type => :string, :banner => 'Your Pin Publishable key', :required => true
|
5
|
+
class_option :secret_key, :type => :string, :banner => 'Your Pin Secret Key', :required => true
|
6
|
+
|
7
|
+
def create_config_file
|
8
|
+
template 'pin.yml', File.join('config', 'pin.yml')
|
9
|
+
end
|
10
|
+
|
11
|
+
def create_initializer
|
12
|
+
template 'initializer.rb', File.join('config', 'initializers', 'pin.rb')
|
13
|
+
end
|
14
|
+
|
15
|
+
desc <<DESC
|
16
|
+
Description:
|
17
|
+
Copies Pin configuration file to your application's initializer directory.
|
18
|
+
DESC
|
19
|
+
|
20
|
+
def self.source_root
|
21
|
+
@source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
development:
|
2
|
+
publishable_key: '<%= options[:publishable_key] %>'
|
3
|
+
secret_key: '<%= options[:secret_key] %>'
|
4
|
+
endpoint: 'test-api.pin.net.au'
|
5
|
+
|
6
|
+
test:
|
7
|
+
publishable_key: '<%= options[:publishable_key] %>'
|
8
|
+
secret_key: '<%= options[:secret_key] %>'
|
9
|
+
endpoint: 'test-api.pin.net.au'
|
10
|
+
|
11
|
+
production:
|
12
|
+
publishable_key: '<%= options[:publishable_key] %>'
|
13
|
+
secret_key: '<%= options[:secret_key] %>'
|
14
|
+
endpoint: 'api.pin.net.au'
|
data/lib/pin.rb
ADDED
data/lib/pin/api.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
module Pin::API::Charges
|
2
|
+
|
3
|
+
def charges(page=1)
|
4
|
+
raw_response = api_call(:get, 'customers', {page: page})
|
5
|
+
pin_response(raw_response, raw_response['response'].map { |e| Pin::Models::Charge.new(e) })
|
6
|
+
end
|
7
|
+
|
8
|
+
def charge(token, params={})
|
9
|
+
raw_response = api_call(:get, "charges/#{token}", params)
|
10
|
+
|
11
|
+
pin_response(raw_response, Pin::Models::Charge.new(raw_response['response']))
|
12
|
+
end
|
13
|
+
|
14
|
+
def charge_search(params={})
|
15
|
+
raw_response = api_call(:get, 'charges/search', params)
|
16
|
+
|
17
|
+
pin_response(raw_response, raw_response['response'].map { |e| Pin::Models::Charge.new(e) })
|
18
|
+
end
|
19
|
+
|
20
|
+
def create_charge(email, description, amount, currency, ip_address, token_or_card)
|
21
|
+
require_field email, :email
|
22
|
+
require_field description, :description
|
23
|
+
require_field amount, :amount
|
24
|
+
require_field currency, :currency
|
25
|
+
require_field ip_address, :ip_address
|
26
|
+
|
27
|
+
params = {
|
28
|
+
:email => email,
|
29
|
+
:description => description,
|
30
|
+
:amount => amount,
|
31
|
+
:currency => currency,
|
32
|
+
:ip_address => ip_address
|
33
|
+
}
|
34
|
+
|
35
|
+
if token_or_card.is_a?(Hash) then
|
36
|
+
params[:card] = token_or_card
|
37
|
+
else
|
38
|
+
params[token_or_card =~ /^cus_/ ? :customer_token : :card_token] = token_or_card
|
39
|
+
end
|
40
|
+
|
41
|
+
raw_response = api_call(:post, 'charges', params)
|
42
|
+
pin_response(raw_response, Pin::Models::Charge.new(raw_response['response']))
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,136 @@
|
|
1
|
+
require 'active_support/inflector'
|
2
|
+
|
3
|
+
require 'pin/error'
|
4
|
+
require 'pin/models/card'
|
5
|
+
require 'pin/models/charge'
|
6
|
+
require 'pin/models/customer'
|
7
|
+
require 'pin/models/refund'
|
8
|
+
|
9
|
+
require 'pin/api/customers'
|
10
|
+
require 'pin/api/charges'
|
11
|
+
require 'pin/api/refunds'
|
12
|
+
require 'pin/api/tokens'
|
13
|
+
|
14
|
+
class Pin::API::Client
|
15
|
+
attr_accessor :http
|
16
|
+
|
17
|
+
BASE_URL = "https://#{Pin.config.endpoint}/1"
|
18
|
+
|
19
|
+
include Pin::API::Customers
|
20
|
+
include Pin::API::Charges
|
21
|
+
include Pin::API::Refunds
|
22
|
+
include Pin::API::Tokens
|
23
|
+
|
24
|
+
def initialize
|
25
|
+
@url = URI.parse(BASE_URL)
|
26
|
+
@http = Net::HTTP.new(@url.host, @url.port)
|
27
|
+
@http.use_ssl = true
|
28
|
+
@http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def get(klass, params={})
|
34
|
+
raw_response = api_call(:get, klass.name.demodulize.downcase.pluralize, params)
|
35
|
+
pin_response(raw_response, raw_response['response'].map { |e| klass.new(e) })
|
36
|
+
end
|
37
|
+
|
38
|
+
def api_call(method, endpoint, params={}, format=:json)
|
39
|
+
|
40
|
+
# dispatch to the right method, with the full path (/api/v2 + endpoint)
|
41
|
+
request = self.send("format_#{method}", "#{@url.path}/#{endpoint}", params)
|
42
|
+
response = @http.request(request)
|
43
|
+
|
44
|
+
unless response.code =~ /^2\d\d$/
|
45
|
+
raise Pin::Error.new response.code, response.body
|
46
|
+
end
|
47
|
+
|
48
|
+
if format == :json
|
49
|
+
return JSON.parse(response.body)
|
50
|
+
end
|
51
|
+
|
52
|
+
response.body
|
53
|
+
end
|
54
|
+
|
55
|
+
def format_get(path, params)
|
56
|
+
unless params.nil?
|
57
|
+
query = params.map { |k, v| "#{k}=#{URI::escape(v.to_s)}" }.join("&")
|
58
|
+
end
|
59
|
+
|
60
|
+
request = Net::HTTP::Get.new("#{path}?#{query}")
|
61
|
+
request.basic_auth(Pin.config.secret_key, '')
|
62
|
+
|
63
|
+
request
|
64
|
+
end
|
65
|
+
|
66
|
+
def format_post(path, params)
|
67
|
+
request = Net::HTTP::Post.new(path)
|
68
|
+
|
69
|
+
request.set_form_data(to_form_data(params))
|
70
|
+
request.basic_auth(Pin.config.secret_key, '')
|
71
|
+
|
72
|
+
request
|
73
|
+
end
|
74
|
+
|
75
|
+
def format_put(path, params)
|
76
|
+
request = Net::HTTP::Put.new(path)
|
77
|
+
|
78
|
+
request.set_form_data(to_form_data(params))
|
79
|
+
request.basic_auth(Pin.config.secret_key, '')
|
80
|
+
|
81
|
+
request
|
82
|
+
end
|
83
|
+
|
84
|
+
# This is by no means a generic method of flattening a hash into form params
|
85
|
+
# and will work for 1 level depth - specifically for providing a 'card' hash
|
86
|
+
# for a number of POSTS specific to Pin.
|
87
|
+
def to_form_data(params)
|
88
|
+
form_data = {}
|
89
|
+
|
90
|
+
params.each do |key, value|
|
91
|
+
if value.is_a? Hash
|
92
|
+
prefix = key.to_s
|
93
|
+
|
94
|
+
value.each do |key, value|
|
95
|
+
form_data["#{prefix}[#{key.to_s}]"] = value
|
96
|
+
end
|
97
|
+
else
|
98
|
+
form_data[key.to_s] = value
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
form_data
|
103
|
+
end
|
104
|
+
|
105
|
+
def pin_response(raw_body, objects)
|
106
|
+
if raw_body['pagination'].nil?
|
107
|
+
if objects.is_a? Array
|
108
|
+
{:response => objects}
|
109
|
+
else
|
110
|
+
objects
|
111
|
+
end
|
112
|
+
else
|
113
|
+
{
|
114
|
+
:pagination => {
|
115
|
+
:current => raw_body['pagination']['current'],
|
116
|
+
:previous => raw_body['pagination']['previous'],
|
117
|
+
:next => raw_body['pagination']['next'],
|
118
|
+
:per_page => raw_body['pagination']['per_page'],
|
119
|
+
:pages => raw_body['pagination']['pages'],
|
120
|
+
:count => raw_body['pagination']['count']
|
121
|
+
},
|
122
|
+
:response => objects
|
123
|
+
}
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
def require_field(field, message=nil)
|
128
|
+
return unless field.blank?
|
129
|
+
|
130
|
+
if message.blank?
|
131
|
+
raise 'Required field is missing'
|
132
|
+
else
|
133
|
+
raise message.is_a?(Symbol) ? "Required field #{message.to_s} is missing" : message
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Pin::API::Customers
|
2
|
+
|
3
|
+
def customers(page=1)
|
4
|
+
raw_response = api_call(:get, 'customers', {page: page})
|
5
|
+
pin_response(raw_response, raw_response['response'].map { |e| Pin::Models::Customer.new(e) })
|
6
|
+
end
|
7
|
+
|
8
|
+
def customer(token)
|
9
|
+
raw_response = api_call(:get, "customers/#{token}")
|
10
|
+
|
11
|
+
pin_response(raw_response, Pin::Models::Customer.new(raw_response['response']))
|
12
|
+
end
|
13
|
+
|
14
|
+
def customer_charges(token)
|
15
|
+
raw_response = api_call(:get, "customers/#{token}/charges")
|
16
|
+
|
17
|
+
pin_response(raw_response, raw_response['response'].map { |e| Pin::Models::Charge.new(e) })
|
18
|
+
end
|
19
|
+
|
20
|
+
def create_customer(email, card)
|
21
|
+
require_field email, :email
|
22
|
+
|
23
|
+
params = {
|
24
|
+
:email => email
|
25
|
+
}
|
26
|
+
|
27
|
+
params[card.is_a?(Hash) ? :card : :card_token] = card
|
28
|
+
|
29
|
+
raw_response = api_call(:post, 'customers', params)
|
30
|
+
|
31
|
+
pin_response(raw_response, Pin::Models::Customer.new(raw_response['response']))
|
32
|
+
end
|
33
|
+
|
34
|
+
def update_customer(token, params)
|
35
|
+
raw_response = api_call(:put, "customers/#{token}", params)
|
36
|
+
pin_response(raw_response, Pin::Models::Customer.new(raw_response['response']))
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Pin::API::Refunds
|
2
|
+
|
3
|
+
def refunds(charge_token, params={})
|
4
|
+
raw_response = api_call(:get, "charges/#{charge_token}/refunds", params)
|
5
|
+
|
6
|
+
pin_response(raw_response, raw_response['response'].map { |e| Pin::Models::Refund.new(e) })
|
7
|
+
end
|
8
|
+
|
9
|
+
def create_refund(charge_token, amount=nil)
|
10
|
+
params = {}
|
11
|
+
|
12
|
+
unless amount.nil?
|
13
|
+
params[:amount] = amount
|
14
|
+
end
|
15
|
+
|
16
|
+
raw_response = api_call(:post, "charges/#{charge_token}/refunds", params)
|
17
|
+
|
18
|
+
pin_response(raw_response, Pin::Models::Refund.new(raw_response['response']))
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Pin::API::Tokens
|
2
|
+
def create_token(number, expiry_month, expiry_year, cvc, name, address)
|
3
|
+
require_field number, :number
|
4
|
+
require_field expiry_month, :expiry_month
|
5
|
+
require_field expiry_year, :expiry_year
|
6
|
+
require_field cvc, :cvc
|
7
|
+
require_field name, :name
|
8
|
+
|
9
|
+
unless address.is_a? Hash
|
10
|
+
throw 'Address must be a hash containing each address field: line1, line2 (optional), city, postcode, state, country'
|
11
|
+
end
|
12
|
+
|
13
|
+
require_field address[:line1], :line1
|
14
|
+
require_field address[:city], :city
|
15
|
+
require_field address[:postcode], :postcode
|
16
|
+
require_field address[:state], :state
|
17
|
+
require_field address[:country], :country
|
18
|
+
|
19
|
+
params = {
|
20
|
+
:number => number,
|
21
|
+
:expiry_month => expiry_month,
|
22
|
+
:expiry_year => expiry_year,
|
23
|
+
:cvc => cvc,
|
24
|
+
:name => name,
|
25
|
+
:address_line1 => address[:line1],
|
26
|
+
:address_city => address[:city],
|
27
|
+
:address_postcode => address[:postcode],
|
28
|
+
:address_state => address[:state],
|
29
|
+
:address_country => address[:country],
|
30
|
+
}
|
31
|
+
|
32
|
+
if address.has_key? :line2 && !address[:line2].blank?
|
33
|
+
params[:address_line2] = address[:line2]
|
34
|
+
end
|
35
|
+
|
36
|
+
raw_response = api_call(:post, 'cards', params)
|
37
|
+
pin_response(raw_response, Pin::Models::Charge.new(raw_response['response']))
|
38
|
+
end
|
39
|
+
end
|
data/lib/pin/error.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
class Pin::Error < StandardError
|
2
|
+
|
3
|
+
# Possible Responses
|
4
|
+
#
|
5
|
+
# 200 - (OK) Successful request
|
6
|
+
# 422 - (invalid_resource) One or more parameters were missing or invalid
|
7
|
+
# 400 - (card_declined) The card was declined
|
8
|
+
# 400 - (insufficient_funds) Bad api_key or not authorized to access a resource.
|
9
|
+
# 400 - (suspected_fraud) The resource requested doesn't exist.
|
10
|
+
# 400 - (expired_card) Clever screwed up.
|
11
|
+
# 404 - (resource_not_found) No resource was found at this URL.
|
12
|
+
# 500 - Server errors
|
13
|
+
|
14
|
+
attr_accessor :code, :message
|
15
|
+
|
16
|
+
def initialize code, message
|
17
|
+
@code = code
|
18
|
+
@message = message
|
19
|
+
end
|
20
|
+
|
21
|
+
def message
|
22
|
+
"HTTP Error #{@code}: #{@message}"
|
23
|
+
end
|
24
|
+
|
25
|
+
def to_s
|
26
|
+
message
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
class Pin::Models::Card
|
2
|
+
attr_accessor :token, :display_number, :scheme, :address_line_1, :address_line_2, :address_city, :address_postcode, :address_state, :address_country
|
3
|
+
|
4
|
+
def initialize(params)
|
5
|
+
params.each { |k, v| instance_variable_set("@#{k}", v) unless v.nil? }
|
6
|
+
end
|
7
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
class Pin::Models::Charge
|
2
|
+
attr_accessor :token, :success, :amount, :currency, :description, :email, :ip_address, :created_at, :status_message, :error_message, :card, :total_fees, :merchant_entitlement
|
3
|
+
|
4
|
+
def initialize(params)
|
5
|
+
params.each { |k, v| instance_variable_set("@#{k}", v) unless v.nil? }
|
6
|
+
end
|
7
|
+
end
|
data/lib/pin/version.rb
ADDED
data/pin-ruby.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'pin/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'pin-ruby'
|
8
|
+
spec.version = Pin::VERSION
|
9
|
+
spec.authors = ["Michael Shimmins"]
|
10
|
+
spec.email = ["michael.shimmins@gmail.com"]
|
11
|
+
spec.description = %q{A Ruby library for interacting with v1 of the Pin Payments API}
|
12
|
+
spec.summary = spec.description
|
13
|
+
spec.homepage = 'https://bitbucket.org/redsquirrel/pin-ruby'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = %w(lib)
|
20
|
+
|
21
|
+
spec.add_dependency 'json'
|
22
|
+
spec.add_dependency 'activesupport'
|
23
|
+
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
25
|
+
spec.add_development_dependency 'rake'
|
26
|
+
|
27
|
+
spec.add_development_dependency 'rspec'
|
28
|
+
spec.add_development_dependency 'spork', '~> 0.9.0.rc'
|
29
|
+
spec.add_development_dependency 'guard-rspec', '~> 0.7.0'
|
30
|
+
spec.add_development_dependency 'terminal-notifier-guard'
|
31
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'spork'
|
3
|
+
|
4
|
+
Spork.prefork do
|
5
|
+
|
6
|
+
end
|
7
|
+
|
8
|
+
Spork.each_run do
|
9
|
+
|
10
|
+
end
|
11
|
+
|
12
|
+
lib_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
|
13
|
+
$LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
|
14
|
+
|
15
|
+
require 'pin'
|
metadata
ADDED
@@ -0,0 +1,186 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pin-ruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Michael Shimmins
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-07-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: json
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.3'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: spork
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.9.0.rc
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ~>
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.9.0.rc
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: guard-rspec
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ~>
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.7.0
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ~>
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.7.0
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: terminal-notifier-guard
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
description: A Ruby library for interacting with v1 of the Pin Payments API
|
126
|
+
email:
|
127
|
+
- michael.shimmins@gmail.com
|
128
|
+
executables: []
|
129
|
+
extensions: []
|
130
|
+
extra_rdoc_files: []
|
131
|
+
files:
|
132
|
+
- .gitignore
|
133
|
+
- .rspec
|
134
|
+
- Gemfile
|
135
|
+
- Guardfile
|
136
|
+
- LICENSE.txt
|
137
|
+
- README.md
|
138
|
+
- Rakefile
|
139
|
+
- lib/generators/pin.rb
|
140
|
+
- lib/generators/pin/install_generator.rb
|
141
|
+
- lib/generators/pin/templates/initializer.rb
|
142
|
+
- lib/generators/pin/templates/pin.yml
|
143
|
+
- lib/pin.rb
|
144
|
+
- lib/pin/api.rb
|
145
|
+
- lib/pin/api/charges.rb
|
146
|
+
- lib/pin/api/client.rb
|
147
|
+
- lib/pin/api/customers.rb
|
148
|
+
- lib/pin/api/refunds.rb
|
149
|
+
- lib/pin/api/tokens.rb
|
150
|
+
- lib/pin/configuration.rb
|
151
|
+
- lib/pin/error.rb
|
152
|
+
- lib/pin/models/card.rb
|
153
|
+
- lib/pin/models/charge.rb
|
154
|
+
- lib/pin/models/customer.rb
|
155
|
+
- lib/pin/models/refund.rb
|
156
|
+
- lib/pin/version.rb
|
157
|
+
- pin-ruby.gemspec
|
158
|
+
- spec/configuration_spec.rb
|
159
|
+
- spec/spec_helper.rb
|
160
|
+
homepage: https://bitbucket.org/redsquirrel/pin-ruby
|
161
|
+
licenses:
|
162
|
+
- MIT
|
163
|
+
metadata: {}
|
164
|
+
post_install_message:
|
165
|
+
rdoc_options: []
|
166
|
+
require_paths:
|
167
|
+
- lib
|
168
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
169
|
+
requirements:
|
170
|
+
- - '>='
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: '0'
|
173
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
174
|
+
requirements:
|
175
|
+
- - '>='
|
176
|
+
- !ruby/object:Gem::Version
|
177
|
+
version: '0'
|
178
|
+
requirements: []
|
179
|
+
rubyforge_project:
|
180
|
+
rubygems_version: 2.0.3
|
181
|
+
signing_key:
|
182
|
+
specification_version: 4
|
183
|
+
summary: A Ruby library for interacting with v1 of the Pin Payments API
|
184
|
+
test_files:
|
185
|
+
- spec/configuration_spec.rb
|
186
|
+
- spec/spec_helper.rb
|