dwolla-ruby 2.6.4 → 2.6.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.gitignore +8 -8
- data/.travis.yml +6 -6
- data/Gemfile +1 -1
- data/README.md +198 -192
- 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 -50
- data/examples/offsiteGateway.rb +31 -31
- data/examples/transactions.rb +72 -38
- data/examples/users.rb +30 -30
- data/gemfiles/json.gemfile +2 -2
- data/lib/dwolla.rb +326 -326
- 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 +83 -75
- data/lib/dwolla/offsite_gateway.rb +152 -152
- data/lib/dwolla/requests.rb +56 -56
- data/lib/dwolla/transactions.rb +111 -56
- 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_funding_sources.rb +64 -64
- data/test/test_masspay.rb +47 -47
- data/test/test_oauth.rb +36 -30
- data/test/test_offsite_gateway.rb +57 -57
- data/test/test_requests.rb +29 -29
- data/test/test_transactions.rb +117 -51
- data/test/test_users.rb +33 -33
- metadata +21 -21
data/test/test_transactions.rb
CHANGED
@@ -1,52 +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
|
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
|
+
|
52
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,103 +1,103 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dwolla-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.
|
4
|
+
version: 2.6.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Schonfeld
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.4'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.4'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: multi_json
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 1.0.4
|
34
|
-
- - <
|
34
|
+
- - "<"
|
35
35
|
- !ruby/object:Gem::Version
|
36
36
|
version: '2'
|
37
37
|
type: :runtime
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
|
-
- -
|
41
|
+
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: 1.0.4
|
44
|
-
- - <
|
44
|
+
- - "<"
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '2'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: addressable
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- -
|
51
|
+
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '2'
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
|
-
- -
|
58
|
+
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '2'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: mocha
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
|
-
- -
|
65
|
+
- - ">="
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: '0'
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
|
-
- -
|
72
|
+
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '0'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: test-unit
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
|
-
- -
|
79
|
+
- - ">="
|
80
80
|
- !ruby/object:Gem::Version
|
81
81
|
version: '0'
|
82
82
|
type: :development
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
|
-
- -
|
86
|
+
- - ">="
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '0'
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: rake
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
|
-
- -
|
93
|
+
- - ">="
|
94
94
|
- !ruby/object:Gem::Version
|
95
95
|
version: '0'
|
96
96
|
type: :development
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
|
-
- -
|
100
|
+
- - ">="
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: '0'
|
103
103
|
description: Official Ruby Wrapper for Dwolla's API. Completely re-written based on
|
@@ -108,8 +108,8 @@ executables: []
|
|
108
108
|
extensions: []
|
109
109
|
extra_rdoc_files: []
|
110
110
|
files:
|
111
|
-
- .gitignore
|
112
|
-
- .travis.yml
|
111
|
+
- ".gitignore"
|
112
|
+
- ".travis.yml"
|
113
113
|
- Gemfile
|
114
114
|
- README.md
|
115
115
|
- Rakefile
|
@@ -163,17 +163,17 @@ require_paths:
|
|
163
163
|
- lib
|
164
164
|
required_ruby_version: !ruby/object:Gem::Requirement
|
165
165
|
requirements:
|
166
|
-
- -
|
166
|
+
- - ">="
|
167
167
|
- !ruby/object:Gem::Version
|
168
168
|
version: '0'
|
169
169
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
|
-
- -
|
171
|
+
- - ">="
|
172
172
|
- !ruby/object:Gem::Version
|
173
173
|
version: '0'
|
174
174
|
requirements: []
|
175
175
|
rubyforge_project: dwolla-ruby
|
176
|
-
rubygems_version: 2.
|
176
|
+
rubygems_version: 2.2.2
|
177
177
|
signing_key:
|
178
178
|
specification_version: 4
|
179
179
|
summary: Official Ruby Wrapper for Dwolla's API
|