forte-payments 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 87cab94e19e7c23976fbe87eae0f18d4c7804bc9
4
+ data.tar.gz: 2fcb00c911320e2178b22f2e27421cc2491a4e4e
5
+ SHA512:
6
+ metadata.gz: b12f47e7efe4587697d8bc4ae305dda2d4913ec77b3b71957de0f568f7ea7a07db96285b5fcd826c900f33dd441ecfad595d97153c2f41d9f6b09bab3a80104c
7
+ data.tar.gz: 8d351dbd0127bcb6852b372f1de7020a1e177ab78aafdabc14d59343de7253545604e88e5e29efaede83b5469719e49c4353f639b07c19048ab9c97e56cf0a1d
@@ -0,0 +1,2 @@
1
+ forte-*.gem
2
+ .env
File without changes
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,40 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ forte-payments (0.0.1)
5
+ faraday
6
+ faraday_middleware
7
+ hashie
8
+ json
9
+
10
+ GEM
11
+ remote: https://rubygems.org/
12
+ specs:
13
+ addressable (2.3.8)
14
+ crack (0.4.2)
15
+ safe_yaml (~> 1.0.0)
16
+ faraday (0.9.1)
17
+ multipart-post (>= 1.2, < 3)
18
+ faraday_middleware (0.9.1)
19
+ faraday (>= 0.7.4, < 0.10)
20
+ hashie (3.4.2)
21
+ json (1.8.3)
22
+ minitest (5.7.0)
23
+ multipart-post (2.0.0)
24
+ rake (10.4.2)
25
+ safe_yaml (1.0.4)
26
+ vcr (2.9.3)
27
+ webmock (1.21.0)
28
+ addressable (>= 2.3.6)
29
+ crack (>= 0.3.2)
30
+
31
+ PLATFORMS
32
+ ruby
33
+
34
+ DEPENDENCIES
35
+ bundler
36
+ forte-payments!
37
+ minitest
38
+ rake
39
+ vcr
40
+ webmock
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Taylor Brooks
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.
@@ -0,0 +1,40 @@
1
+ ### A Ruby wrapper for the Forte Payments API
2
+
3
+ Learn about the Forte Payments REST API at https://www.forte.net/devdocs/api_resources/forte_api
4
+
5
+ ### Installation
6
+ Add this line to your application's Gemfile:
7
+ ````ruby
8
+ # in your Gemfile
9
+ gem 'forte'
10
+
11
+ # then...
12
+ bundle install
13
+ ````
14
+
15
+ ### Usage
16
+ ````ruby
17
+ client = FortePayments::Client.new(
18
+ api_key: api_key,
19
+ secure_key: secure_key,
20
+ account_id: account_id,
21
+ location_id: location_id
22
+ )
23
+ ````
24
+
25
+ ### History
26
+
27
+ View the [changelog](https://github.com/taylorbrooks/forte-payments-ruby/blob/master/CHANGELOG.md)
28
+ This gem follows [Semantic Versioning](http://semver.org/)
29
+
30
+ ### Contributing
31
+
32
+ Everyone is encouraged to help improve this project. Here are a few ways you can help:
33
+
34
+ - [Report bugs](https://github.com/taylorbrooks/forte-payments-ruby/issues)
35
+ - Fix bugs and [submit pull requests](https://github.com/taylorbrooks/forte-payments-ruby/pulls)
36
+ - Write, clarify, or fix documentation
37
+ - Suggest or add new features
38
+
39
+ ### Copyright
40
+ Copyright (c) 2015 Taylor Brooks. See LICENSE for details.
@@ -0,0 +1,11 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ require 'rdoc/task'
4
+ Rake::RDocTask.new do |rdoc|
5
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
6
+
7
+ rdoc.rdoc_dir = 'rdoc'
8
+ rdoc.title = "forte-payments #{version}"
9
+ rdoc.rdoc_files.include('README*')
10
+ rdoc.rdoc_files.include('lib/**/*.rb')
11
+ end
@@ -0,0 +1,32 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "forte_payments/version"
4
+ require "base64"
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "forte-payments"
8
+ s.version = FortePayments::VERSION
9
+ s.authors = ["Taylor Brooks"]
10
+ s.email = ["dGJyb29rc0BnbWFpbC5jb20="].map{ |e| Base64.decode64(e) }
11
+ s.homepage = "https://github.com/taylorbrooks/forte-payments-ruby"
12
+ s.summary = %q{A Ruby wrapper for the Forte Payment REST API}
13
+ s.description = %q{A Ruby wrapper for the Forte Payment REST API}
14
+ s.license = "MIT"
15
+
16
+ s.files = `git ls-files`.split($/)
17
+ s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
+ s.test_files = s.files.grep(%r{^(test)/})
19
+
20
+ s.require_paths = ["lib"]
21
+
22
+ s.add_runtime_dependency 'faraday'
23
+ s.add_runtime_dependency 'faraday_middleware'
24
+ s.add_runtime_dependency 'json'
25
+ s.add_runtime_dependency 'hashie'
26
+
27
+ s.add_development_dependency 'bundler'
28
+ s.add_development_dependency 'rake'
29
+ s.add_development_dependency 'minitest'
30
+ s.add_development_dependency 'vcr'
31
+ s.add_development_dependency 'webmock'
32
+ end
@@ -0,0 +1,4 @@
1
+ require_relative 'forte_payments/client'
2
+
3
+ module FortePayments
4
+ end
@@ -0,0 +1,63 @@
1
+ require 'faraday'
2
+ require 'faraday_middleware'
3
+
4
+ Dir[File.expand_path('../resources/*.rb', __FILE__)].each{|f| require f}
5
+
6
+ module FortePayments
7
+ class Client
8
+ include FortePayments::Client::Addresses
9
+ include FortePayments::Client::Customers
10
+ include FortePayments::Client::Paymethods
11
+ include FortePayments::Client::Settlements
12
+ include FortePayments::Client::Transactions
13
+
14
+ attr_reader :api_key, :secure_key, :account_id, :location_id
15
+
16
+ def initialize(api_key: api_key, secure_key: secure_key, account_id: account_id, location_id: location_id)
17
+ @api_key = api_key
18
+ @secure_key = secure_key
19
+ @account_id = account_id
20
+ @location_id = location_id
21
+ end
22
+
23
+ def get(path, options={})
24
+ connection.get(path, options).body
25
+ end
26
+
27
+ def post(path, req_body)
28
+ connection.post do |req|
29
+ req.url(path)
30
+ req.body = req_body
31
+ end.body
32
+ end
33
+
34
+ def put(path, options={})
35
+ connection.put(path, options).body
36
+ end
37
+
38
+ def delete(path, options = {})
39
+ connection.delete(path, options).body
40
+ end
41
+
42
+ private
43
+
44
+ def base_url
45
+ "https://sandbox.forte.net/api/v2"
46
+ end
47
+
48
+ def base_path
49
+ "/accounts/#{account_id}/locations/#{location_id}"
50
+ end
51
+
52
+ def connection
53
+ Faraday.new(url: base_url, headers: { accept: 'application/json' }) do |connection|
54
+ connection.basic_auth api_key, secure_key
55
+ connection.request :json
56
+ connection.response :logger
57
+ connection.use FaradayMiddleware::Mashify
58
+ connection.response :json
59
+ connection.adapter Faraday.default_adapter
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,27 @@
1
+ module FortePayments
2
+ class Client
3
+ module Address
4
+
5
+ def create_address(customer_id, options = {})
6
+ post("/customers/#{customer_id}/addresses", options)
7
+ end
8
+
9
+ def list_addresses(customer_id, options = {})
10
+ get("/customers/#{customer_id}/addresses", options)
11
+ end
12
+
13
+ def find_address(customer_id, options = {})
14
+ get("/customers/#{customer_id}/addresses", options)
15
+ end
16
+
17
+ def update_address(customer_id, options = {})
18
+ put("/customers/#{customer_id}/addresses/#{address_id}", options)
19
+ end
20
+
21
+ def delete_address(customer_id, address_id)
22
+ delete("/customers/#{customer_id}/addresses/#{address_id}")
23
+ end
24
+
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ module FortePayments
2
+ class Client
3
+ module Customer
4
+
5
+ def create_customer(options = {})
6
+ post("/customers", options)
7
+ end
8
+
9
+ def list_customers(options = {})
10
+ get("/customers", options)
11
+ end
12
+
13
+ def find_customer(customer_id)
14
+ get("/customers/#{customer_id}", options)
15
+ end
16
+
17
+ def update_customer(customer_id, options = {})
18
+ put("/customers/#{customer_id}", options)
19
+ end
20
+
21
+ def delete_customer(customer_id)
22
+ delete("/customers/#{customer_id}")
23
+ end
24
+
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ module FortePayments
2
+ class Client
3
+ module Paymethod
4
+
5
+ def create_address(customer_id, options = {})
6
+ post("/customers/#{customer_id}/addresses", options)
7
+ end
8
+
9
+ def list_addresses(customer_id, options = {})
10
+ get("/customers/#{customer_id}/addresses", options)
11
+ end
12
+
13
+ def find_address(customer_id, options = {})
14
+ get("/customers/#{customer_id}/addresses", options)
15
+ end
16
+
17
+ def update_address(customer_id, options = {})
18
+ put("/customers/#{customer_id}/addresses/#{address_id}", options)
19
+ end
20
+
21
+ def delete_address(customer_id, address_id)
22
+ delete("/customers/#{customer_id}/addresses/#{address_id}")
23
+ end
24
+
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,15 @@
1
+ module FortePayments
2
+ class Client
3
+ module Settlement
4
+
5
+ def list_settlements(options = {})
6
+ get("/settlements/", options)
7
+ end
8
+
9
+ def find_settlement_by_transaction_id(transaction_id)
10
+ get("/transactions/#{transaction_id}/settlements")
11
+ end
12
+
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,23 @@
1
+ module FortePayments
2
+ class Client
3
+ module Transaction
4
+
5
+ def create_transaction(customer_id, options = {})
6
+ post("/transactions/#{customer_id}/addresses", options)
7
+ end
8
+
9
+ def list_transaction(customer_id, options = {})
10
+ get("/transactions/#{customer_id}/addresses", options)
11
+ end
12
+
13
+ def find_transaction(transaction_id, options = {})
14
+ get("/transactions/#{transaction_id}", options)
15
+ end
16
+
17
+ def update_transaction(transaction_id, options = {})
18
+ put("/transactions/#{transaction_id}", options)
19
+ end
20
+
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,3 @@
1
+ module FortePayments
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,186 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: forte-payments
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Taylor Brooks
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-06-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
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: faraday_middleware
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: json
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: hashie
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
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: bundler
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: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: minitest
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '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'
111
+ - !ruby/object:Gem::Dependency
112
+ name: vcr
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
+ - !ruby/object:Gem::Dependency
126
+ name: webmock
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ description: A Ruby wrapper for the Forte Payment REST API
140
+ email:
141
+ - tbrooks@gmail.com
142
+ executables: []
143
+ extensions: []
144
+ extra_rdoc_files: []
145
+ files:
146
+ - .gitignore
147
+ - CHANGELOG.md
148
+ - Gemfile
149
+ - Gemfile.lock
150
+ - LICENSE
151
+ - README.md
152
+ - Rakefile
153
+ - forte_payments.gemspec
154
+ - lib/forte_payments.rb
155
+ - lib/forte_payments/client.rb
156
+ - lib/forte_payments/resources/address.rb
157
+ - lib/forte_payments/resources/customer.rb
158
+ - lib/forte_payments/resources/paymethod.rb
159
+ - lib/forte_payments/resources/settlement.rb
160
+ - lib/forte_payments/resources/transaction.rb
161
+ - lib/forte_payments/version.rb
162
+ homepage: https://github.com/taylorbrooks/forte-payments-ruby
163
+ licenses:
164
+ - MIT
165
+ metadata: {}
166
+ post_install_message:
167
+ rdoc_options: []
168
+ require_paths:
169
+ - lib
170
+ required_ruby_version: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - '>='
173
+ - !ruby/object:Gem::Version
174
+ version: '0'
175
+ required_rubygems_version: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - '>='
178
+ - !ruby/object:Gem::Version
179
+ version: '0'
180
+ requirements: []
181
+ rubyforge_project:
182
+ rubygems_version: 2.0.14
183
+ signing_key:
184
+ specification_version: 4
185
+ summary: A Ruby wrapper for the Forte Payment REST API
186
+ test_files: []