dwolla-ruby 2.9.0 → 3.0.0
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 +4 -4
- data/.gitignore +8 -8
- data/.travis.yml +11 -6
- data/Gemfile +1 -1
- data/README.md +225 -222
- data/Rakefile +8 -8
- data/dwolla-ruby.gemspec +27 -27
- data/examples/balance.rb +15 -15
- data/examples/contacts.rb +32 -32
- data/examples/fundingSources.rb +39 -39
- data/examples/oauth.rb +59 -59
- data/examples/offsiteGateway.rb +31 -31
- data/examples/transactions.rb +72 -72
- data/examples/users.rb +30 -30
- data/gemfiles/json.gemfile +2 -2
- data/lib/dwolla.rb +319 -327
- data/lib/dwolla/accounts.rb +27 -27
- data/lib/dwolla/balance.rb +15 -15
- data/lib/dwolla/contacts.rb +30 -30
- data/lib/dwolla/errors/api_connection_error.rb +3 -3
- data/lib/dwolla/errors/api_error.rb +3 -3
- data/lib/dwolla/errors/authentication_error.rb +3 -3
- data/lib/dwolla/errors/dwolla_error.rb +19 -19
- data/lib/dwolla/errors/invalid_request_error.rb +10 -10
- data/lib/dwolla/errors/missing_parameter_error.rb +3 -3
- data/lib/dwolla/exceptions.rb +4 -4
- data/lib/dwolla/funding_sources.rb +65 -65
- data/lib/dwolla/json.rb +20 -20
- data/lib/dwolla/masspay.rb +52 -52
- data/lib/dwolla/oauth.rb +84 -84
- data/lib/dwolla/offsite_gateway.rb +152 -152
- data/lib/dwolla/requests.rb +56 -56
- data/lib/dwolla/transactions.rb +108 -108
- data/lib/dwolla/users.rb +39 -39
- data/lib/dwolla/version.rb +3 -3
- data/test/test_accounts.rb +18 -18
- data/test/test_balance.rb +9 -9
- data/test/test_contacts.rb +19 -19
- data/test/test_dwolla.rb +62 -0
- data/test/test_funding_sources.rb +64 -64
- data/test/test_masspay.rb +47 -47
- data/test/test_oauth.rb +36 -36
- data/test/test_offsite_gateway.rb +57 -57
- data/test/test_requests.rb +29 -29
- data/test/test_transactions.rb +117 -117
- data/test/test_users.rb +33 -33
- metadata +5 -3
data/test/test_requests.rb
CHANGED
@@ -1,30 +1,30 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require 'mocha/test_unit'
|
3
|
-
require 'dwolla'
|
4
|
-
|
5
|
-
class RequestsTest < Test::Unit::TestCase
|
6
|
-
def test_get
|
7
|
-
Dwolla.stubs(:request).with(:get, '/requests/', {:limit => 10}, {}, 'abc')
|
8
|
-
Dwolla::Requests.get({:limit => 10}, {}, 'abc')
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_get_by_id
|
12
|
-
Dwolla.stubs(:request).with(:get, '/requests/123456', {}, {}, 'abc')
|
13
|
-
Dwolla::Requests.get('123456', {}, 'abc')
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_create
|
17
|
-
Dwolla.stubs(:request).with(:post, '/requests/', {:sourceId => '812-111-1234', :amount => 5.00}, {}, 'abc')
|
18
|
-
Dwolla::Requests.create({:sourceId => '812-111-1234', :amount => 5.00}, 'abc')
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_delete
|
22
|
-
Dwolla.stubs(:request).with(:post, '/requests/123456/cancel', {}, {}, 'abc')
|
23
|
-
Dwolla::Requests.delete('123456', 'abc')
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_fulfill
|
27
|
-
Dwolla.stubs(:request).with(:post, '/requests/123456/fulfill', {:pin => 1337}, {}, 'abc')
|
28
|
-
Dwolla::Requests.fulfill('123456', {:pin => 1337}, 'abc')
|
29
|
-
end
|
1
|
+
require 'test/unit'
|
2
|
+
require 'mocha/test_unit'
|
3
|
+
require 'dwolla'
|
4
|
+
|
5
|
+
class RequestsTest < Test::Unit::TestCase
|
6
|
+
def test_get
|
7
|
+
Dwolla.stubs(:request).with(:get, '/requests/', {:limit => 10}, {}, 'abc')
|
8
|
+
Dwolla::Requests.get({:limit => 10}, {}, 'abc')
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_get_by_id
|
12
|
+
Dwolla.stubs(:request).with(:get, '/requests/123456', {}, {}, 'abc')
|
13
|
+
Dwolla::Requests.get('123456', {}, 'abc')
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_create
|
17
|
+
Dwolla.stubs(:request).with(:post, '/requests/', {:sourceId => '812-111-1234', :amount => 5.00}, {}, 'abc')
|
18
|
+
Dwolla::Requests.create({:sourceId => '812-111-1234', :amount => 5.00}, 'abc')
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_delete
|
22
|
+
Dwolla.stubs(:request).with(:post, '/requests/123456/cancel', {}, {}, 'abc')
|
23
|
+
Dwolla::Requests.delete('123456', 'abc')
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_fulfill
|
27
|
+
Dwolla.stubs(:request).with(:post, '/requests/123456/fulfill', {:pin => 1337}, {}, 'abc')
|
28
|
+
Dwolla::Requests.fulfill('123456', {:pin => 1337}, 'abc')
|
29
|
+
end
|
30
30
|
end
|
data/test/test_transactions.rb
CHANGED
@@ -1,118 +1,118 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require 'mocha/test_unit'
|
3
|
-
require 'dwolla'
|
4
|
-
|
5
|
-
class TransactionsTest < Test::Unit::TestCase
|
6
|
-
def test_get
|
7
|
-
Dwolla.stubs(:request).with(:get, '/transactions/', {:limit => 10}, {}, 'abc')
|
8
|
-
Dwolla::Transactions.get({:limit => 10}, {}, 'abc')
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_get_by_id
|
12
|
-
Dwolla.stubs(:request).with(:get, '/transactions/123456', {}, {}, 'abc')
|
13
|
-
Dwolla::Transactions.get('123456', {}, 'abc')
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_stats
|
17
|
-
Dwolla.stubs(:request).with(:get, '/transactions/stats', {:types => 'TransactionsCount'}, {}, 'abc')
|
18
|
-
Dwolla::Transactions.stats({:types => 'TransactionsCount'}, 'abc')
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_send
|
22
|
-
Dwolla.stubs(:request).with(:post, '/transactions/send',
|
23
|
-
{
|
24
|
-
:pin => 1337,
|
25
|
-
:amount => 15.00,
|
26
|
-
:destinationId => '812-111-1111'
|
27
|
-
}, {}, 'abc')
|
28
|
-
|
29
|
-
# Send is also an alias but is not tested since it is redundant
|
30
|
-
Dwolla::Transactions.create({
|
31
|
-
:pin => 1337,
|
32
|
-
:amount => 15.00,
|
33
|
-
:destinationId => '812-111-1111'
|
34
|
-
}, 'abc')
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_refund
|
38
|
-
Dwolla.stubs(:request).with(:post, '/transactions/refund',
|
39
|
-
{
|
40
|
-
:pin => 1337,
|
41
|
-
:fundsSource => 'Balance',
|
42
|
-
:transactionId => '123456',
|
43
|
-
:amount => 15.00
|
44
|
-
}, {}, 'abc')
|
45
|
-
Dwolla::Transactions.refund({
|
46
|
-
:pin => 1337,
|
47
|
-
:fundsSource => 'Balance',
|
48
|
-
:transactionId => '123456',
|
49
|
-
:amount => 15.00
|
50
|
-
}, 'abc')
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_schedule
|
54
|
-
Dwolla.stubs(:request).with(:post, '/transactions/scheduled',
|
55
|
-
{
|
56
|
-
:pin => 1337,
|
57
|
-
:amount => 15.00,
|
58
|
-
:destinationId => '812-111-1111',
|
59
|
-
:fundsSource => 'abcdef',
|
60
|
-
:scheduleDate => '2015-10-19'
|
61
|
-
}, {}, 'abc')
|
62
|
-
|
63
|
-
Dwolla::Transactions.schedule({
|
64
|
-
:pin => 1337,
|
65
|
-
:amount => 15.00,
|
66
|
-
:destinationId => '812-111-1111',
|
67
|
-
:fundsSource => 'abcdef',
|
68
|
-
:scheduleDate => '2015-10-19'
|
69
|
-
}, 'abc')
|
70
|
-
end
|
71
|
-
|
72
|
-
def test_scheduled
|
73
|
-
Dwolla.stubs(:request).with(:get, '/transactions/scheduled',
|
74
|
-
{}, {}, 'abc')
|
75
|
-
|
76
|
-
Dwolla::Transactions.scheduled({}, 'abc')
|
77
|
-
end
|
78
|
-
|
79
|
-
def test_scheduled_by_id
|
80
|
-
Dwolla.stubs(:request).with(:get, '/transactions/scheduled/1234',
|
81
|
-
{}, {}, 'abc')
|
82
|
-
|
83
|
-
Dwolla::Transactions.scheduled_by_id('1234', 'abc')
|
84
|
-
end
|
85
|
-
|
86
|
-
def test_edit_scheduled
|
87
|
-
Dwolla.stubs(:request).with(:put, '/transactions/scheduled/12345',
|
88
|
-
{
|
89
|
-
:pin => 1337,
|
90
|
-
:amount => 15.00,
|
91
|
-
}, {}, 'abc')
|
92
|
-
|
93
|
-
Dwolla::Transactions.edit_scheduled('12345', {
|
94
|
-
:pin => 1337,
|
95
|
-
:amount => 15.00}, 'abc')
|
96
|
-
end
|
97
|
-
|
98
|
-
def test_delete_scheduled_by_id
|
99
|
-
Dwolla.stubs(:request).with(:delete, '/transactions/scheduled/12345',
|
100
|
-
{
|
101
|
-
:pin => 1337,
|
102
|
-
}, {}, 'abc')
|
103
|
-
|
104
|
-
Dwolla::Transactions.delete_scheduled_by_id('12345', {
|
105
|
-
:pin => 1337}, 'abc')
|
106
|
-
end
|
107
|
-
|
108
|
-
def test_delete_all_scheduled
|
109
|
-
Dwolla.stubs(:request).with(:delete, '/transactions/scheduled',
|
110
|
-
{
|
111
|
-
:pin => 1337,
|
112
|
-
}, {}, 'abc')
|
113
|
-
|
114
|
-
Dwolla::Transactions.delete_all_scheduled({
|
115
|
-
:pin => 1337}, 'abc')
|
116
|
-
end
|
117
|
-
|
1
|
+
require 'test/unit'
|
2
|
+
require 'mocha/test_unit'
|
3
|
+
require 'dwolla'
|
4
|
+
|
5
|
+
class TransactionsTest < Test::Unit::TestCase
|
6
|
+
def test_get
|
7
|
+
Dwolla.stubs(:request).with(:get, '/transactions/', {:limit => 10}, {}, 'abc')
|
8
|
+
Dwolla::Transactions.get({:limit => 10}, {}, 'abc')
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_get_by_id
|
12
|
+
Dwolla.stubs(:request).with(:get, '/transactions/123456', {}, {}, 'abc')
|
13
|
+
Dwolla::Transactions.get('123456', {}, 'abc')
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_stats
|
17
|
+
Dwolla.stubs(:request).with(:get, '/transactions/stats', {:types => 'TransactionsCount'}, {}, 'abc')
|
18
|
+
Dwolla::Transactions.stats({:types => 'TransactionsCount'}, 'abc')
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_send
|
22
|
+
Dwolla.stubs(:request).with(:post, '/transactions/send',
|
23
|
+
{
|
24
|
+
:pin => 1337,
|
25
|
+
:amount => 15.00,
|
26
|
+
:destinationId => '812-111-1111'
|
27
|
+
}, {}, 'abc')
|
28
|
+
|
29
|
+
# Send is also an alias but is not tested since it is redundant
|
30
|
+
Dwolla::Transactions.create({
|
31
|
+
:pin => 1337,
|
32
|
+
:amount => 15.00,
|
33
|
+
:destinationId => '812-111-1111'
|
34
|
+
}, 'abc')
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_refund
|
38
|
+
Dwolla.stubs(:request).with(:post, '/transactions/refund',
|
39
|
+
{
|
40
|
+
:pin => 1337,
|
41
|
+
:fundsSource => 'Balance',
|
42
|
+
:transactionId => '123456',
|
43
|
+
:amount => 15.00
|
44
|
+
}, {}, 'abc')
|
45
|
+
Dwolla::Transactions.refund({
|
46
|
+
:pin => 1337,
|
47
|
+
:fundsSource => 'Balance',
|
48
|
+
:transactionId => '123456',
|
49
|
+
:amount => 15.00
|
50
|
+
}, 'abc')
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_schedule
|
54
|
+
Dwolla.stubs(:request).with(:post, '/transactions/scheduled',
|
55
|
+
{
|
56
|
+
:pin => 1337,
|
57
|
+
:amount => 15.00,
|
58
|
+
:destinationId => '812-111-1111',
|
59
|
+
:fundsSource => 'abcdef',
|
60
|
+
:scheduleDate => '2015-10-19'
|
61
|
+
}, {}, 'abc')
|
62
|
+
|
63
|
+
Dwolla::Transactions.schedule({
|
64
|
+
:pin => 1337,
|
65
|
+
:amount => 15.00,
|
66
|
+
:destinationId => '812-111-1111',
|
67
|
+
:fundsSource => 'abcdef',
|
68
|
+
:scheduleDate => '2015-10-19'
|
69
|
+
}, 'abc')
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_scheduled
|
73
|
+
Dwolla.stubs(:request).with(:get, '/transactions/scheduled',
|
74
|
+
{}, {}, 'abc')
|
75
|
+
|
76
|
+
Dwolla::Transactions.scheduled({}, 'abc')
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_scheduled_by_id
|
80
|
+
Dwolla.stubs(:request).with(:get, '/transactions/scheduled/1234',
|
81
|
+
{}, {}, 'abc')
|
82
|
+
|
83
|
+
Dwolla::Transactions.scheduled_by_id('1234', 'abc')
|
84
|
+
end
|
85
|
+
|
86
|
+
def test_edit_scheduled
|
87
|
+
Dwolla.stubs(:request).with(:put, '/transactions/scheduled/12345',
|
88
|
+
{
|
89
|
+
:pin => 1337,
|
90
|
+
:amount => 15.00,
|
91
|
+
}, {}, 'abc')
|
92
|
+
|
93
|
+
Dwolla::Transactions.edit_scheduled('12345', {
|
94
|
+
:pin => 1337,
|
95
|
+
:amount => 15.00}, 'abc')
|
96
|
+
end
|
97
|
+
|
98
|
+
def test_delete_scheduled_by_id
|
99
|
+
Dwolla.stubs(:request).with(:delete, '/transactions/scheduled/12345',
|
100
|
+
{
|
101
|
+
:pin => 1337,
|
102
|
+
}, {}, 'abc')
|
103
|
+
|
104
|
+
Dwolla::Transactions.delete_scheduled_by_id('12345', {
|
105
|
+
:pin => 1337}, 'abc')
|
106
|
+
end
|
107
|
+
|
108
|
+
def test_delete_all_scheduled
|
109
|
+
Dwolla.stubs(:request).with(:delete, '/transactions/scheduled',
|
110
|
+
{
|
111
|
+
:pin => 1337,
|
112
|
+
}, {}, 'abc')
|
113
|
+
|
114
|
+
Dwolla::Transactions.delete_all_scheduled({
|
115
|
+
:pin => 1337}, 'abc')
|
116
|
+
end
|
117
|
+
|
118
118
|
end
|
data/test/test_users.rb
CHANGED
@@ -1,34 +1,34 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require 'mocha/test_unit'
|
3
|
-
require 'dwolla'
|
4
|
-
|
5
|
-
class UsersTest < Test::Unit::TestCase
|
6
|
-
def test_get_oauth
|
7
|
-
Dwolla.stubs(:request).with(:get, '/users/', {}, {}, 'abc')
|
8
|
-
Dwolla::Users.get(nil, 'abc')
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_get_id
|
12
|
-
Dwolla.stubs(:request).with(:get, '/users/812-111-1111', {}, {}, false)
|
13
|
-
Dwolla::Users.get('812-111-1111')
|
14
|
-
end
|
15
|
-
|
16
|
-
# This test is redundant, however it is a different function and therefore
|
17
|
-
# I'm going to test it anyway.
|
18
|
-
def test_me
|
19
|
-
Dwolla.stubs(:request).with(:get, '/users/', {}, {}, 'abc')
|
20
|
-
Dwolla::Users.me('abc')
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_nearby
|
24
|
-
Dwolla.stubs(:request).with(:get, '/users/nearby',
|
25
|
-
{
|
26
|
-
:latitude => 45,
|
27
|
-
:longitude => 50
|
28
|
-
}, {}, false)
|
29
|
-
Dwolla::Users.nearby({
|
30
|
-
:latitude => 45,
|
31
|
-
:longitude => 50
|
32
|
-
})
|
33
|
-
end
|
1
|
+
require 'test/unit'
|
2
|
+
require 'mocha/test_unit'
|
3
|
+
require 'dwolla'
|
4
|
+
|
5
|
+
class UsersTest < Test::Unit::TestCase
|
6
|
+
def test_get_oauth
|
7
|
+
Dwolla.stubs(:request).with(:get, '/users/', {}, {}, 'abc')
|
8
|
+
Dwolla::Users.get(nil, 'abc')
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_get_id
|
12
|
+
Dwolla.stubs(:request).with(:get, '/users/812-111-1111', {}, {}, false)
|
13
|
+
Dwolla::Users.get('812-111-1111')
|
14
|
+
end
|
15
|
+
|
16
|
+
# This test is redundant, however it is a different function and therefore
|
17
|
+
# I'm going to test it anyway.
|
18
|
+
def test_me
|
19
|
+
Dwolla.stubs(:request).with(:get, '/users/', {}, {}, 'abc')
|
20
|
+
Dwolla::Users.me('abc')
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_nearby
|
24
|
+
Dwolla.stubs(:request).with(:get, '/users/nearby',
|
25
|
+
{
|
26
|
+
:latitude => 45,
|
27
|
+
:longitude => 50
|
28
|
+
}, {}, false)
|
29
|
+
Dwolla::Users.nearby({
|
30
|
+
:latitude => 45,
|
31
|
+
:longitude => 50
|
32
|
+
})
|
33
|
+
end
|
34
34
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dwolla-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Schonfeld
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -152,6 +152,7 @@ files:
|
|
152
152
|
- test/test_accounts.rb
|
153
153
|
- test/test_balance.rb
|
154
154
|
- test/test_contacts.rb
|
155
|
+
- test/test_dwolla.rb
|
155
156
|
- test/test_funding_sources.rb
|
156
157
|
- test/test_masspay.rb
|
157
158
|
- test/test_oauth.rb
|
@@ -179,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
179
180
|
version: '0'
|
180
181
|
requirements: []
|
181
182
|
rubyforge_project: dwolla-ruby
|
182
|
-
rubygems_version: 2.
|
183
|
+
rubygems_version: 2.5.0
|
183
184
|
signing_key:
|
184
185
|
specification_version: 4
|
185
186
|
summary: Official Ruby Wrapper for Dwolla's API
|
@@ -187,6 +188,7 @@ test_files:
|
|
187
188
|
- test/test_accounts.rb
|
188
189
|
- test/test_balance.rb
|
189
190
|
- test/test_contacts.rb
|
191
|
+
- test/test_dwolla.rb
|
190
192
|
- test/test_funding_sources.rb
|
191
193
|
- test/test_masspay.rb
|
192
194
|
- test/test_oauth.rb
|