moolah-ruby 0.0.1
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 +7 -0
- data/.gitignore +21 -0
- data/.travis.yml +9 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +35 -0
- data/LICENSE.txt +22 -0
- data/README.md +71 -0
- data/Rakefile +2 -0
- data/lib/moolah.rb +7 -0
- data/lib/moolah/client.rb +72 -0
- data/lib/moolah/configuration.rb +27 -0
- data/lib/moolah/version.rb +3 -0
- data/moolah-ruby.gemspec +26 -0
- data/spec/client_spec.rb +157 -0
- data/spec/configuration_spec.rb +29 -0
- data/travistest +0 -0
- metadata +117 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1142bc0d9812c9f34112ac4f4829e08714b9d792
|
4
|
+
data.tar.gz: 6acd37ef8adec903a729796629bf0c65d9faa21d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 73e3cbcf89ccb42c6b320e772621382ae5fa44b3ec39d61fab05ffbbcd31336909c0ec710683193b2bdb408186ad20433d037bddd01779339bed3399db6745d0
|
7
|
+
data.tar.gz: 7eb7f7cb61f107e0a0b36f1e622ef0d169f726ff400fbb61ac46c5aa2e9ceb236b42d1c69b6762f1af8b1a943e85885395c3202aef15d8acc5491a5d63a19b2f
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
moolah-ruby (0.0.1)
|
5
|
+
faraday (~> 0.9.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
diff-lcs (1.2.5)
|
11
|
+
faraday (0.9.0)
|
12
|
+
multipart-post (>= 1.2, < 3)
|
13
|
+
multipart-post (2.0.0)
|
14
|
+
rake (10.1.1)
|
15
|
+
rspec (3.0.0)
|
16
|
+
rspec-core (~> 3.0.0)
|
17
|
+
rspec-expectations (~> 3.0.0)
|
18
|
+
rspec-mocks (~> 3.0.0)
|
19
|
+
rspec-core (3.0.3)
|
20
|
+
rspec-support (~> 3.0.0)
|
21
|
+
rspec-expectations (3.0.3)
|
22
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
23
|
+
rspec-support (~> 3.0.0)
|
24
|
+
rspec-mocks (3.0.3)
|
25
|
+
rspec-support (~> 3.0.0)
|
26
|
+
rspec-support (3.0.3)
|
27
|
+
|
28
|
+
PLATFORMS
|
29
|
+
ruby
|
30
|
+
|
31
|
+
DEPENDENCIES
|
32
|
+
bundler (~> 1.6)
|
33
|
+
moolah-ruby!
|
34
|
+
rake
|
35
|
+
rspec (~> 3.0.0)
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 TM Lee
|
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,71 @@
|
|
1
|
+
[](https://travis-ci.org/coingecko/moolah-ruby)
|
2
|
+
|
3
|
+
# Moolah::Ruby
|
4
|
+
|
5
|
+
Wrapper API for Moolah's Transaction API (v2)
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```bash
|
12
|
+
gem 'moolah-ruby'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
```bash
|
18
|
+
$ bundle
|
19
|
+
```
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
```bash
|
24
|
+
$ gem install moolah-ruby
|
25
|
+
```
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
Configuration:
|
30
|
+
```ruby
|
31
|
+
require 'moolah'
|
32
|
+
|
33
|
+
Moolah.configure do |config|
|
34
|
+
config.api_key = ENV['API_KEY']
|
35
|
+
config.api_secret = ENV['API_SECRET'] # necessary for IPN response
|
36
|
+
# config.endpoint = "https://api.moolah.io/v2"
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
40
|
+
Create a transaction:
|
41
|
+
```ruby
|
42
|
+
moolah_client = Moolah::Client.new
|
43
|
+
|
44
|
+
# No IPN Response
|
45
|
+
response = moolah_client.create_transaction(coin: "bitcoin", currency: "USD", amount: "20", product: "Coingecko Pro")
|
46
|
+
|
47
|
+
# IPN Response
|
48
|
+
response = moolah_client.create_transaction(coin: "bitcoin", currency: "USD", amount: "20", product: "Coingecko Pro", ipn: "www.example.com/processed_payment", ipn_extra: "{ user_id: 1 }")
|
49
|
+
|
50
|
+
response[:status] # "success"
|
51
|
+
response[:guid] # "1234-1234-1234-1234"
|
52
|
+
response[:address] # "abcdefghijklmnopqrstuvwxyz"
|
53
|
+
# etc.
|
54
|
+
```
|
55
|
+
|
56
|
+
Query a transaction:
|
57
|
+
```ruby
|
58
|
+
query_result = moolah_client.query_transaction(guid:"1234-1234-1234-1234")
|
59
|
+
|
60
|
+
query_result[:status] # "success"
|
61
|
+
query_result[:transaction][:tx][:coin] # "bitcoin"
|
62
|
+
# etc.
|
63
|
+
```
|
64
|
+
|
65
|
+
## Contributing
|
66
|
+
|
67
|
+
1. Fork it ( https://github.com/coingecko/moolah-ruby/fork )
|
68
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
69
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
70
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
71
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/lib/moolah.rb
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'moolah/version'
|
2
|
+
require 'faraday'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module Moolah
|
6
|
+
class Client
|
7
|
+
CREATE_TRANSACTION_ACTION = "/v2/private/merchant/create"
|
8
|
+
QUERY_TRANSACTION_ACTION = "/v2/private/merchant/status"
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
# Check for API key
|
12
|
+
raise ArgumentError, "API Key is not set!" unless Moolah.api_key
|
13
|
+
end
|
14
|
+
|
15
|
+
def create_transaction(transaction_params = {})
|
16
|
+
coin = transaction_params[:coin] || transaction_params["coin"]
|
17
|
+
currency = transaction_params[:currency] || transaction_params["currency"]
|
18
|
+
amount = transaction_params[:amount] || transaction_params["amount"]
|
19
|
+
product = transaction_params[:product] || transaction_params["product"]
|
20
|
+
|
21
|
+
# Check all parameters present
|
22
|
+
raise ArgumentError, "Missing transaction parameter(s)" unless coin && currency && amount && product
|
23
|
+
|
24
|
+
request_body = { coin: coin, currency: currency, amount: amount, product: product, apiKey: Moolah.api_key }
|
25
|
+
|
26
|
+
ipn = transaction_params[:ipn] || transaction_params["ipn"]
|
27
|
+
if ipn
|
28
|
+
ipn_extra = transaction_params[:ipn_extra] || transaction_params["ipn_extra"]
|
29
|
+
request_body[:ipn] = ipn
|
30
|
+
request_body[:ipn_extra] = ipn_extra
|
31
|
+
request_body[:apiSecret] = Moolah.api_secret
|
32
|
+
end
|
33
|
+
|
34
|
+
faraday_response = connection.post do |request|
|
35
|
+
request.url CREATE_TRANSACTION_ACTION
|
36
|
+
request.body = request_body
|
37
|
+
end
|
38
|
+
|
39
|
+
json_response = JSON.parse(faraday_response.body)
|
40
|
+
symbolize_keys(json_response)
|
41
|
+
end
|
42
|
+
|
43
|
+
def query_transaction(params = {})
|
44
|
+
guid = params[:guid] || params["guid"]
|
45
|
+
|
46
|
+
request_body = { guid: guid, apiKey: Moolah.api_key }
|
47
|
+
|
48
|
+
faraday_response = connection.post do |request|
|
49
|
+
request.url QUERY_TRANSACTION_ACTION
|
50
|
+
request.body = request_body
|
51
|
+
end
|
52
|
+
|
53
|
+
json_response = JSON.parse(faraday_response.body)
|
54
|
+
symbolize_keys(json_response)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Connection method for ease of stubbing
|
58
|
+
def connection
|
59
|
+
@connection ||= Faraday.new(url: Moolah.endpoint)
|
60
|
+
end
|
61
|
+
|
62
|
+
def symbolize_keys(hash)
|
63
|
+
return hash unless hash.is_a?(Hash)
|
64
|
+
|
65
|
+
symbolized_hash = hash.inject({}) do |memo, (k,v)|
|
66
|
+
memo[k.to_sym] = symbolize_keys(v)
|
67
|
+
memo
|
68
|
+
end
|
69
|
+
symbolized_hash
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'moolah/version'
|
2
|
+
|
3
|
+
module Moolah
|
4
|
+
module Configuration
|
5
|
+
DEFAULT_ENDPOINT = "https://api.moolah.io"
|
6
|
+
DEFAULT_API_KEY = nil
|
7
|
+
DEFAULT_API_SECRET = nil
|
8
|
+
|
9
|
+
attr_accessor :api_key, :api_secret, :ipn, :endpoint
|
10
|
+
|
11
|
+
# When extended, call reset to set variable values to defaults
|
12
|
+
def self.extended(mod)
|
13
|
+
mod.reset
|
14
|
+
end
|
15
|
+
|
16
|
+
def reset
|
17
|
+
self.api_key = DEFAULT_API_KEY
|
18
|
+
self.api_secret = DEFAULT_API_SECRET
|
19
|
+
self.endpoint = DEFAULT_ENDPOINT
|
20
|
+
end
|
21
|
+
|
22
|
+
def configure
|
23
|
+
yield self
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
data/moolah-ruby.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'moolah/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "moolah-ruby"
|
8
|
+
spec.version = Moolah::VERSION
|
9
|
+
spec.authors = ["TM Lee"]
|
10
|
+
spec.email = ["tm89lee@gmail.com"]
|
11
|
+
spec.summary = %q{Ruby wrapper for the Moolah.io Transaction API}
|
12
|
+
spec.description = %q{Ruby wrapper for the Moolah.io Transaction API}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
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 = ["lib"]
|
20
|
+
|
21
|
+
spec.add_runtime_dependency "faraday", "~> 0.9.0"
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
spec.add_development_dependency "rspec", "~> 3.0.0"
|
26
|
+
end
|
data/spec/client_spec.rb
ADDED
@@ -0,0 +1,157 @@
|
|
1
|
+
require 'moolah'
|
2
|
+
|
3
|
+
describe Moolah::Client do
|
4
|
+
let(:request_stubs) { Faraday::Adapter::Test::Stubs.new }
|
5
|
+
let (:test_connection) do
|
6
|
+
Faraday.new do |builder|
|
7
|
+
builder.adapter :test, request_stubs
|
8
|
+
end
|
9
|
+
end
|
10
|
+
let(:client) { Moolah::Client.new }
|
11
|
+
|
12
|
+
describe ".initialize" do
|
13
|
+
it "complains when API key is not configured" do
|
14
|
+
expect { Moolah::Client.new }.to raise_error(ArgumentError)
|
15
|
+
end
|
16
|
+
|
17
|
+
context "with API key" do
|
18
|
+
before do
|
19
|
+
allow(Moolah).to receive(:api_key).and_return("1234567890")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should not complain if API key is given" do
|
23
|
+
expect(Moolah::api_key).to eq("1234567890")
|
24
|
+
expect { Moolah::Client.new }.not_to raise_error
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "#create_transaction" do
|
30
|
+
let(:action_path) { "/v2/private/merchant/create" }
|
31
|
+
let(:transaction_params) { { coin: "dogecoin", amount: "20", currency: "USD", product: "Coingecko Pro" } }
|
32
|
+
|
33
|
+
# Provide API Key first
|
34
|
+
before do
|
35
|
+
allow(Moolah).to receive(:api_key).and_return("1234567890")
|
36
|
+
allow(Moolah).to receive(:api_secret).and_return("secret")
|
37
|
+
end
|
38
|
+
|
39
|
+
shared_examples :success_transaction do
|
40
|
+
it { expect(result[:status]).to eq("success") }
|
41
|
+
it { expect(result[:guid]).to eq("a4dc89fcc-8ad-3f4c1bf529-6396c1acc4-") }
|
42
|
+
it { expect(result[:address]).to eq("DS6frMZR5jFVEf9V6pBi9qtcVJa2JX5ewR") }
|
43
|
+
it { expect(result[:url]).to eq("https://pay.moolah.io/a4dc89fcc-8ad-3f4c1bf529-6396c1acc4-") }
|
44
|
+
it { expect(result[:coin]).to eq("dogecoin") }
|
45
|
+
it { expect(result[:amount]).to eq("121526.39285714") }
|
46
|
+
it { expect(result[:timestamp]).to eq(1407579569) }
|
47
|
+
end
|
48
|
+
|
49
|
+
shared_examples :failure_transaction do
|
50
|
+
it { expect(result[:status]).to eq("failure") }
|
51
|
+
it { expect(result[:guid]).to eq(nil) }
|
52
|
+
it { expect(result[:address]).to eq(nil) }
|
53
|
+
it { expect(result[:url]).to eq(nil) }
|
54
|
+
it { expect(result[:coin]).to eq(nil) }
|
55
|
+
it { expect(result[:amount]).to eq(nil) }
|
56
|
+
it { expect(result[:timestamp]).to eq(nil) }
|
57
|
+
end
|
58
|
+
|
59
|
+
context "incomplete transaction parameters" do
|
60
|
+
let(:client) { Moolah::Client.new }
|
61
|
+
let(:incomplete_transaction_params) { { coin: "dogecoin", amount: "20", currency: "USD" } }
|
62
|
+
|
63
|
+
it "throws ArgumentError" do
|
64
|
+
expect { client.create_transaction(incomplete_transaction_params) }.to raise_error(ArgumentError)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
context "successful transaction" do
|
69
|
+
context "without optional ipn & ipn_extra parameter" do
|
70
|
+
before do
|
71
|
+
allow(client).to receive(:connection).and_return(test_connection)
|
72
|
+
request_stubs.post(action_path) { |env| [ 200, {}, json_response ] }
|
73
|
+
end
|
74
|
+
let(:json_response) { '{"status":"success","guid":"a4dc89fcc-8ad-3f4c1bf529-6396c1acc4-","url":"https:\/\/pay.moolah.io\/a4dc89fcc-8ad-3f4c1bf529-6396c1acc4-","coin":"dogecoin","amount":"121526.39285714","address":"DS6frMZR5jFVEf9V6pBi9qtcVJa2JX5ewR","timestamp":1407579569}' }
|
75
|
+
|
76
|
+
context "allows transaction params to be given as argument" do
|
77
|
+
let(:result) { client.create_transaction transaction_params }
|
78
|
+
it_behaves_like :success_transaction
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
context "with optional ipn & ipn_extra parameter" do
|
83
|
+
before do
|
84
|
+
allow(client).to receive(:connection).and_return(test_connection)
|
85
|
+
request_stubs.post(action_path) { |env| [ 200, {}, json_response ] }
|
86
|
+
end
|
87
|
+
let(:json_response) { '{"status":"success","guid":"a4dc89fcc-8ad-3f4c1bf529-6396c1acc4-","url":"https:\/\/pay.moolah.io\/a4dc89fcc-8ad-3f4c1bf529-6396c1acc4-","coin":"dogecoin","amount":"121526.39285714","address":"DS6frMZR5jFVEf9V6pBi9qtcVJa2JX5ewR","timestamp":1407579569}' }
|
88
|
+
let(:transaction_params_with_ipn) { { coin: "dogecoin", amount: "20", currency: "USD", product: "Coingecko Pro", ipn: "www.example.com/processed_payment", ipn_extra: "extrastuff" } }
|
89
|
+
|
90
|
+
let(:result) { client.create_transaction transaction_params_with_ipn }
|
91
|
+
it_behaves_like :success_transaction
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
context "failure transaction" do
|
96
|
+
before do
|
97
|
+
allow(client).to receive(:connection).and_return(test_connection)
|
98
|
+
request_stubs.post(action_path) { |env| [ 200, {}, json_response ] }
|
99
|
+
end
|
100
|
+
let(:json_response) { '{"status":"failure"}' }
|
101
|
+
|
102
|
+
let(:result) { client.create_transaction transaction_params }
|
103
|
+
it_behaves_like :failure_transaction
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
describe "#query_transaction" do
|
108
|
+
let(:action_path) { "/v2/private/merchant/status" }
|
109
|
+
before do
|
110
|
+
allow(Moolah).to receive(:api_key).and_return("1234567890")
|
111
|
+
end
|
112
|
+
|
113
|
+
context "transaction does not exist" do
|
114
|
+
before do
|
115
|
+
allow(client).to receive(:connection).and_return(test_connection)
|
116
|
+
request_stubs.post(action_path) { |env| [ 200, {}, json_response ] }
|
117
|
+
end
|
118
|
+
let(:json_response) { '{ "status": "failure", "reason": "No such transaction." }' }
|
119
|
+
|
120
|
+
it "returns a symbolized has of the json response" do
|
121
|
+
result = client.query_transaction(guid:"1234-1234-1234")
|
122
|
+
expect(result[:status]).to eq("failure")
|
123
|
+
expect(result[:reason]).to eq("No such transaction.")
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
context "transaction exists" do
|
128
|
+
before do
|
129
|
+
allow(client).to receive(:connection).and_return(test_connection)
|
130
|
+
request_stubs.post(action_path) { |env| [ 200, {}, json_response ] }
|
131
|
+
end
|
132
|
+
let(:json_response) { '{
|
133
|
+
"status": "success",
|
134
|
+
"transaction": {
|
135
|
+
"tx": {
|
136
|
+
"amount": "26651.62068965",
|
137
|
+
"coin": "dogecoin",
|
138
|
+
"guid": "692-6c-e5fa17a37-4baa72bf7c5-78d88d6",
|
139
|
+
"status": "cancelled",
|
140
|
+
"tx": "-1"
|
141
|
+
}
|
142
|
+
}
|
143
|
+
}' }
|
144
|
+
|
145
|
+
it "returns a symbolized has of the json response" do
|
146
|
+
result = client.query_transaction({api_key: "1234567890", guid:"1234-1234-1234"})
|
147
|
+
expect(result[:status]).to eq("success")
|
148
|
+
expect(result[:transaction][:tx][:amount]).to eq("26651.62068965")
|
149
|
+
expect(result[:transaction][:tx][:coin]).to eq("dogecoin")
|
150
|
+
expect(result[:transaction][:tx][:guid]).to eq("692-6c-e5fa17a37-4baa72bf7c5-78d88d6")
|
151
|
+
expect(result[:transaction][:tx][:status]).to eq("cancelled")
|
152
|
+
expect(result[:transaction][:tx][:tx]).to eq("-1")
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'moolah'
|
2
|
+
|
3
|
+
describe Moolah do
|
4
|
+
describe ".api_key" do
|
5
|
+
it "has default values" do
|
6
|
+
expect(Moolah.send(:api_key)).to eq(nil)
|
7
|
+
expect(Moolah.send(:api_secret)).to eq(nil)
|
8
|
+
expect(Moolah.send(:endpoint)).to eq("https://api.moolah.io")
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe ".configure" do
|
13
|
+
it "allows configuration via block" do
|
14
|
+
sample_api_key = "1234567890"
|
15
|
+
sample_api_secret = "secret"
|
16
|
+
sample_endpoint = "http://example.com"
|
17
|
+
|
18
|
+
Moolah.configure do |config|
|
19
|
+
config.api_key = sample_api_key
|
20
|
+
config.api_secret = sample_api_secret
|
21
|
+
config.endpoint = sample_endpoint
|
22
|
+
end
|
23
|
+
|
24
|
+
expect(Moolah.api_key).to eq(sample_api_key)
|
25
|
+
expect(Moolah.api_secret).to eq(sample_api_secret)
|
26
|
+
expect(Moolah.endpoint).to eq(sample_endpoint)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/travistest
ADDED
File without changes
|
metadata
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: moolah-ruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- TM Lee
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-08-11 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.9.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.9.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.6'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.6'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
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: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 3.0.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 3.0.0
|
69
|
+
description: Ruby wrapper for the Moolah.io Transaction API
|
70
|
+
email:
|
71
|
+
- tm89lee@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".travis.yml"
|
78
|
+
- Gemfile
|
79
|
+
- Gemfile.lock
|
80
|
+
- LICENSE.txt
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- lib/moolah.rb
|
84
|
+
- lib/moolah/client.rb
|
85
|
+
- lib/moolah/configuration.rb
|
86
|
+
- lib/moolah/version.rb
|
87
|
+
- moolah-ruby.gemspec
|
88
|
+
- spec/client_spec.rb
|
89
|
+
- spec/configuration_spec.rb
|
90
|
+
- travistest
|
91
|
+
homepage: ''
|
92
|
+
licenses:
|
93
|
+
- MIT
|
94
|
+
metadata: {}
|
95
|
+
post_install_message:
|
96
|
+
rdoc_options: []
|
97
|
+
require_paths:
|
98
|
+
- lib
|
99
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
requirements: []
|
110
|
+
rubyforge_project:
|
111
|
+
rubygems_version: 2.2.2
|
112
|
+
signing_key:
|
113
|
+
specification_version: 4
|
114
|
+
summary: Ruby wrapper for the Moolah.io Transaction API
|
115
|
+
test_files:
|
116
|
+
- spec/client_spec.rb
|
117
|
+
- spec/configuration_spec.rb
|