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/Rakefile
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
task :default => [:test]
|
2
|
-
|
3
|
-
task :test do
|
4
|
-
ret = true
|
5
|
-
Dir["test/**/*.rb"].each do |f|
|
6
|
-
ret = ret && ruby(f, '')
|
7
|
-
end
|
8
|
-
exit(ret)
|
1
|
+
task :default => [:test]
|
2
|
+
|
3
|
+
task :test do
|
4
|
+
ret = true
|
5
|
+
Dir["test/**/*.rb"].each do |f|
|
6
|
+
ret = ret && ruby(f, '')
|
7
|
+
end
|
8
|
+
exit(ret)
|
9
9
|
end
|
data/dwolla-ruby.gemspec
CHANGED
@@ -1,27 +1,27 @@
|
|
1
|
-
$:.unshift(File.join(File.dirname(__FILE__), 'lib'))
|
2
|
-
require "dwolla/version"
|
3
|
-
|
4
|
-
Gem::Specification.new do |s|
|
5
|
-
s.name = "dwolla-ruby"
|
6
|
-
s.version = Dwolla::VERSION
|
7
|
-
s.authors = ["Michael Schonfeld"]
|
8
|
-
s.email = ["michael@dwolla.com"]
|
9
|
-
s.homepage = "https://github.com/dwolla/dwolla-ruby"
|
10
|
-
s.summary = %q{Official Ruby Wrapper for Dwolla's API}
|
11
|
-
s.description = %q{This SDK is for an old version of Dwolla's API and is no longer actively maintained. Please use dwolla_v2.}
|
12
|
-
s.license = 'MIT'
|
13
|
-
|
14
|
-
s.rubyforge_project = "dwolla-ruby"
|
15
|
-
|
16
|
-
s.files = `git ls-files`.split("\n")
|
17
|
-
s.test_files = `git ls-files -- test/*`.split("\n")
|
18
|
-
s.require_paths = %w{lib}
|
19
|
-
|
20
|
-
s.add_dependency('rest-client', '~> 1.7', '>= 1.7.3')
|
21
|
-
s.add_dependency('multi_json', '>= 1.0.4', '< 2')
|
22
|
-
s.add_dependency('addressable', '>= 2')
|
23
|
-
|
24
|
-
s.add_development_dependency('mocha')
|
25
|
-
s.add_development_dependency('test-unit')
|
26
|
-
s.add_development_dependency('rake')
|
27
|
-
end
|
1
|
+
$:.unshift(File.join(File.dirname(__FILE__), 'lib'))
|
2
|
+
require "dwolla/version"
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "dwolla-ruby"
|
6
|
+
s.version = Dwolla::VERSION
|
7
|
+
s.authors = ["Michael Schonfeld"]
|
8
|
+
s.email = ["michael@dwolla.com"]
|
9
|
+
s.homepage = "https://github.com/dwolla/dwolla-ruby"
|
10
|
+
s.summary = %q{Official Ruby Wrapper for Dwolla's API}
|
11
|
+
s.description = %q{This SDK is for an old version of Dwolla's API and is no longer actively maintained. Please use dwolla_v2.}
|
12
|
+
s.license = 'MIT'
|
13
|
+
|
14
|
+
s.rubyforge_project = "dwolla-ruby"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- test/*`.split("\n")
|
18
|
+
s.require_paths = %w{lib}
|
19
|
+
|
20
|
+
s.add_dependency('rest-client', '~> 1.7', '>= 1.7.3')
|
21
|
+
s.add_dependency('multi_json', '>= 1.0.4', '< 2')
|
22
|
+
s.add_dependency('addressable', '>= 2')
|
23
|
+
|
24
|
+
s.add_development_dependency('mocha')
|
25
|
+
s.add_development_dependency('test-unit')
|
26
|
+
s.add_development_dependency('rake')
|
27
|
+
end
|
data/examples/balance.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
-
# Include the Dwolla gem
|
2
|
-
require 'rubygems'
|
3
|
-
require 'pp'
|
4
|
-
require 'dwolla'
|
5
|
-
|
6
|
-
# Include any required keys
|
7
|
-
require './_keys.rb'
|
8
|
-
|
9
|
-
# Instantiate a new Dwolla User client
|
10
|
-
# And, seed a previously generated access token
|
11
|
-
Dwolla::token = @token
|
12
|
-
|
13
|
-
|
14
|
-
# EXAMPLE 1:
|
15
|
-
# Get the balance of the authenticated user
|
1
|
+
# Include the Dwolla gem
|
2
|
+
require 'rubygems'
|
3
|
+
require 'pp'
|
4
|
+
require 'dwolla'
|
5
|
+
|
6
|
+
# Include any required keys
|
7
|
+
require './_keys.rb'
|
8
|
+
|
9
|
+
# Instantiate a new Dwolla User client
|
10
|
+
# And, seed a previously generated access token
|
11
|
+
Dwolla::token = @token
|
12
|
+
|
13
|
+
|
14
|
+
# EXAMPLE 1:
|
15
|
+
# Get the balance of the authenticated user
|
16
16
|
pp Dwolla::Balance.get
|
data/examples/contacts.rb
CHANGED
@@ -1,33 +1,33 @@
|
|
1
|
-
# Include the Dwolla gem
|
2
|
-
require 'rubygems'
|
3
|
-
require 'pp'
|
4
|
-
require 'dwolla'
|
5
|
-
|
6
|
-
# Include any required keys
|
7
|
-
require './_keys.rb'
|
8
|
-
|
9
|
-
# Instantiate a new Dwolla User client
|
10
|
-
# And, seed a previously generated access token
|
11
|
-
Dwolla::token = @token
|
12
|
-
Dwolla::api_key = @api_key
|
13
|
-
Dwolla::api_secret = @api_secret
|
14
|
-
|
15
|
-
|
16
|
-
# EXAMPLE 1:
|
17
|
-
# Fetch last 10 contacts from the
|
18
|
-
# account associated with the provided
|
19
|
-
# OAuth token
|
20
|
-
pp Dwolla::Contacts.get
|
21
|
-
|
22
|
-
|
23
|
-
# EXAMPLE 2:
|
24
|
-
# Search through the contacts of the
|
25
|
-
# account associated with the provided
|
26
|
-
# OAuth token
|
27
|
-
pp Dwolla::Contacts.get({:search => 'Ben'})
|
28
|
-
|
29
|
-
|
30
|
-
# EXAMPLE 3:
|
31
|
-
# Get a list of nearby Dwolla spots
|
32
|
-
# for a given set of coordinates
|
1
|
+
# Include the Dwolla gem
|
2
|
+
require 'rubygems'
|
3
|
+
require 'pp'
|
4
|
+
require 'dwolla'
|
5
|
+
|
6
|
+
# Include any required keys
|
7
|
+
require './_keys.rb'
|
8
|
+
|
9
|
+
# Instantiate a new Dwolla User client
|
10
|
+
# And, seed a previously generated access token
|
11
|
+
Dwolla::token = @token
|
12
|
+
Dwolla::api_key = @api_key
|
13
|
+
Dwolla::api_secret = @api_secret
|
14
|
+
|
15
|
+
|
16
|
+
# EXAMPLE 1:
|
17
|
+
# Fetch last 10 contacts from the
|
18
|
+
# account associated with the provided
|
19
|
+
# OAuth token
|
20
|
+
pp Dwolla::Contacts.get
|
21
|
+
|
22
|
+
|
23
|
+
# EXAMPLE 2:
|
24
|
+
# Search through the contacts of the
|
25
|
+
# account associated with the provided
|
26
|
+
# OAuth token
|
27
|
+
pp Dwolla::Contacts.get({:search => 'Ben'})
|
28
|
+
|
29
|
+
|
30
|
+
# EXAMPLE 3:
|
31
|
+
# Get a list of nearby Dwolla spots
|
32
|
+
# for a given set of coordinates
|
33
33
|
pp Dwolla::Contacts.nearby({:latitude => 1, :longitude => 2})
|
data/examples/fundingSources.rb
CHANGED
@@ -1,39 +1,39 @@
|
|
1
|
-
# Include the Dwolla gem
|
2
|
-
require 'rubygems'
|
3
|
-
require 'pp'
|
4
|
-
require 'dwolla'
|
5
|
-
|
6
|
-
# Include any required keys
|
7
|
-
require './_keys.rb'
|
8
|
-
|
9
|
-
# Instantiate a new Dwolla User client
|
10
|
-
# And, seed a previously generated access token
|
11
|
-
Dwolla::token = @token
|
12
|
-
|
13
|
-
|
14
|
-
# EXAMPLE 1:
|
15
|
-
# Fetch all funding sources for the
|
16
|
-
# account associated with the provided
|
17
|
-
# OAuth token
|
18
|
-
pp Dwolla::FundingSources.get
|
19
|
-
|
20
|
-
|
21
|
-
# EXAMPLE 2:
|
22
|
-
# Fetch detailed information for the
|
23
|
-
# funding source with a specific ID
|
24
|
-
pp Dwolla::FundingSources.get('funding_source_id')
|
25
|
-
|
26
|
-
# EXAMPLE 3:
|
27
|
-
# Deposit funds from a funding source (bank account)
|
28
|
-
# into the Dwolla account balance.
|
29
|
-
pp Dwolla::FundingSources.deposit('funding_source_id', {:amount => 12.95, :pin => @pin})
|
30
|
-
|
31
|
-
# EXAMPLE 4:
|
32
|
-
# Withdraw funds from a Dwolla account balance into
|
33
|
-
# a funding source (bank account)
|
34
|
-
pp Dwolla::FundingSources.withdraw('funding_source_id', {:amount => 12.95, :pin => @pin})
|
35
|
-
|
36
|
-
# EXAMPLE 5:
|
37
|
-
# Add a new funding source (bank account).
|
38
|
-
# Possible values for account_type: "Checking" and "Savings"
|
39
|
-
pp Dwolla::FundingSources.add({:routing_number => 99999999, :account_number => 99999999, :account_type => "Checking", :name => "Some Nickname"})
|
1
|
+
# Include the Dwolla gem
|
2
|
+
require 'rubygems'
|
3
|
+
require 'pp'
|
4
|
+
require 'dwolla'
|
5
|
+
|
6
|
+
# Include any required keys
|
7
|
+
require './_keys.rb'
|
8
|
+
|
9
|
+
# Instantiate a new Dwolla User client
|
10
|
+
# And, seed a previously generated access token
|
11
|
+
Dwolla::token = @token
|
12
|
+
|
13
|
+
|
14
|
+
# EXAMPLE 1:
|
15
|
+
# Fetch all funding sources for the
|
16
|
+
# account associated with the provided
|
17
|
+
# OAuth token
|
18
|
+
pp Dwolla::FundingSources.get
|
19
|
+
|
20
|
+
|
21
|
+
# EXAMPLE 2:
|
22
|
+
# Fetch detailed information for the
|
23
|
+
# funding source with a specific ID
|
24
|
+
pp Dwolla::FundingSources.get('funding_source_id')
|
25
|
+
|
26
|
+
# EXAMPLE 3:
|
27
|
+
# Deposit funds from a funding source (bank account)
|
28
|
+
# into the Dwolla account balance.
|
29
|
+
pp Dwolla::FundingSources.deposit('funding_source_id', {:amount => 12.95, :pin => @pin})
|
30
|
+
|
31
|
+
# EXAMPLE 4:
|
32
|
+
# Withdraw funds from a Dwolla account balance into
|
33
|
+
# a funding source (bank account)
|
34
|
+
pp Dwolla::FundingSources.withdraw('funding_source_id', {:amount => 12.95, :pin => @pin})
|
35
|
+
|
36
|
+
# EXAMPLE 5:
|
37
|
+
# Add a new funding source (bank account).
|
38
|
+
# Possible values for account_type: "Checking" and "Savings"
|
39
|
+
pp Dwolla::FundingSources.add({:routing_number => 99999999, :account_number => 99999999, :account_type => "Checking", :name => "Some Nickname"})
|
data/examples/oauth.rb
CHANGED
@@ -1,60 +1,60 @@
|
|
1
|
-
# Include the Dwolla gem
|
2
|
-
require 'rubygems'
|
3
|
-
require 'pp'
|
4
|
-
require 'sinatra'
|
5
|
-
require 'dwolla'
|
6
|
-
|
7
|
-
# Include any required keys
|
8
|
-
require './_keys.rb'
|
9
|
-
|
10
|
-
# Instantiate a new Dwolla User client
|
11
|
-
Dwolla::api_key = @api_key
|
12
|
-
Dwolla::api_secret = @api_secret
|
13
|
-
|
14
|
-
# Constants...
|
15
|
-
redirect_uri = 'http://localhost:4567/oauth_return'
|
16
|
-
|
17
|
-
# STEP 1:
|
18
|
-
# Create an authentication URL
|
19
|
-
# that the user will be redirected to
|
20
|
-
get '/' do
|
21
|
-
authUrl = Dwolla::OAuth.get_auth_url(redirect_uri)
|
22
|
-
"To begin the OAuth process, send the user off to <a href=\"#{authUrl}\">#{authUrl}</a>"
|
23
|
-
end
|
24
|
-
|
25
|
-
|
26
|
-
# STEP 2:
|
27
|
-
# Exchange the temporary code given
|
28
|
-
# to us in the querystring, for
|
29
|
-
# an expiring OAuth access token and refresh token pair.
|
30
|
-
get '/oauth_return' do
|
31
|
-
code = params['code']
|
32
|
-
info = Dwolla::OAuth.get_token(code, redirect_uri)
|
33
|
-
token = info['access_token']
|
34
|
-
refresh_token = info['refresh_token']
|
35
|
-
"Your expiring OAuth access token is: <b>#{token}</b>, and your refresh token is <b>#{refresh_token}</b>"
|
36
|
-
end
|
37
|
-
|
38
|
-
# STEP 3:
|
39
|
-
#
|
40
|
-
# The array returned in step 2 as 'info' also contains
|
41
|
-
# expiration times for when the OAuth token will become
|
42
|
-
# invalid. Use this method to refresh your token with
|
43
|
-
# the provided refresh token.
|
44
|
-
#
|
45
|
-
get '/oauth_refresh' do
|
46
|
-
refresh_token = params['refresh_token']
|
47
|
-
info = Dwolla::OAuth.refresh_auth(refresh_token)
|
48
|
-
token = info['access_token']
|
49
|
-
refresh_token = info['refresh_token']
|
50
|
-
"Your expiring OAuth access token is: <b>#{token}</b>, and your refresh token is <b>#{refresh_token}</b>"
|
51
|
-
end
|
52
|
-
|
53
|
-
# STEP 4: View the endpoints elligible for use with
|
54
|
-
# the passed OAuth token.
|
55
|
-
#
|
56
|
-
get '/catalog' do
|
57
|
-
token = params['token']
|
58
|
-
catalog = Dwolla::OAuth.catalog(token)
|
59
|
-
"The endpoints available for use with this token are #{catalog}"
|
1
|
+
# Include the Dwolla gem
|
2
|
+
require 'rubygems'
|
3
|
+
require 'pp'
|
4
|
+
require 'sinatra'
|
5
|
+
require 'dwolla'
|
6
|
+
|
7
|
+
# Include any required keys
|
8
|
+
require './_keys.rb'
|
9
|
+
|
10
|
+
# Instantiate a new Dwolla User client
|
11
|
+
Dwolla::api_key = @api_key
|
12
|
+
Dwolla::api_secret = @api_secret
|
13
|
+
|
14
|
+
# Constants...
|
15
|
+
redirect_uri = 'http://localhost:4567/oauth_return'
|
16
|
+
|
17
|
+
# STEP 1:
|
18
|
+
# Create an authentication URL
|
19
|
+
# that the user will be redirected to
|
20
|
+
get '/' do
|
21
|
+
authUrl = Dwolla::OAuth.get_auth_url(redirect_uri)
|
22
|
+
"To begin the OAuth process, send the user off to <a href=\"#{authUrl}\">#{authUrl}</a>"
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
# STEP 2:
|
27
|
+
# Exchange the temporary code given
|
28
|
+
# to us in the querystring, for
|
29
|
+
# an expiring OAuth access token and refresh token pair.
|
30
|
+
get '/oauth_return' do
|
31
|
+
code = params['code']
|
32
|
+
info = Dwolla::OAuth.get_token(code, redirect_uri)
|
33
|
+
token = info['access_token']
|
34
|
+
refresh_token = info['refresh_token']
|
35
|
+
"Your expiring OAuth access token is: <b>#{token}</b>, and your refresh token is <b>#{refresh_token}</b>"
|
36
|
+
end
|
37
|
+
|
38
|
+
# STEP 3:
|
39
|
+
#
|
40
|
+
# The array returned in step 2 as 'info' also contains
|
41
|
+
# expiration times for when the OAuth token will become
|
42
|
+
# invalid. Use this method to refresh your token with
|
43
|
+
# the provided refresh token.
|
44
|
+
#
|
45
|
+
get '/oauth_refresh' do
|
46
|
+
refresh_token = params['refresh_token']
|
47
|
+
info = Dwolla::OAuth.refresh_auth(refresh_token)
|
48
|
+
token = info['access_token']
|
49
|
+
refresh_token = info['refresh_token']
|
50
|
+
"Your expiring OAuth access token is: <b>#{token}</b>, and your refresh token is <b>#{refresh_token}</b>"
|
51
|
+
end
|
52
|
+
|
53
|
+
# STEP 4: View the endpoints elligible for use with
|
54
|
+
# the passed OAuth token.
|
55
|
+
#
|
56
|
+
get '/catalog' do
|
57
|
+
token = params['token']
|
58
|
+
catalog = Dwolla::OAuth.catalog(token)
|
59
|
+
"The endpoints available for use with this token are #{catalog}"
|
60
60
|
end
|
data/examples/offsiteGateway.rb
CHANGED
@@ -1,31 +1,31 @@
|
|
1
|
-
# Include the Dwolla gem
|
2
|
-
require 'rubygems'
|
3
|
-
require 'pp'
|
4
|
-
require 'dwolla'
|
5
|
-
|
6
|
-
# Include any required keys
|
7
|
-
require './_keys.rb'
|
8
|
-
|
9
|
-
# Instantiate a new Dwolla User client
|
10
|
-
Dwolla::api_key = @api_key
|
11
|
-
Dwolla::api_secret = @api_secret
|
12
|
-
|
13
|
-
# Clear out any previous session data
|
14
|
-
Dwolla::OffsiteGateway.clear_session
|
15
|
-
|
16
|
-
# Optional Settings
|
17
|
-
Dwolla::OffsiteGateway.redirect = 'http://dwolla.com/payment_redirect'
|
18
|
-
Dwolla::OffsiteGateway.callback = 'http://dwolla.com/payment_callback'
|
19
|
-
Dwolla::OffsiteGateway.set_customer_info('Michael', 'Schonfeld', 'michael@dwolla.com', 'New York', 'NY', '10001')
|
20
|
-
Dwolla::OffsiteGateway.discount = 4.95
|
21
|
-
Dwolla::OffsiteGateway.notes = 'This is just an offsite gateway test...'
|
22
|
-
|
23
|
-
# Add products
|
24
|
-
Dwolla::OffsiteGateway.add_product('Macbook Air', '13" Macbook Air; Model #0001', 499.99, 1)
|
25
|
-
|
26
|
-
# Generate a checkout sesssion
|
27
|
-
pp Dwolla::OffsiteGateway.get_checkout_url('812-734-7288')
|
28
|
-
|
29
|
-
# Verify and parse gateway callback
|
30
|
-
data = Dwolla::OffsiteGateway.read_callback('{"Amount":0.01,"OrderId":null,"Status":"Completed","Error":null,"TransactionId":3396300,"CheckoutId":"51f9dfaa-20ed-41a7-8874-00a47c19c655","Signature":"8be03dfd0e95c567b2855f5876acfc98992f6402","TestMode":"false","ClearingDate":"7/22/2013 8:42:18 PM"}')
|
31
|
-
pp data
|
1
|
+
# Include the Dwolla gem
|
2
|
+
require 'rubygems'
|
3
|
+
require 'pp'
|
4
|
+
require 'dwolla'
|
5
|
+
|
6
|
+
# Include any required keys
|
7
|
+
require './_keys.rb'
|
8
|
+
|
9
|
+
# Instantiate a new Dwolla User client
|
10
|
+
Dwolla::api_key = @api_key
|
11
|
+
Dwolla::api_secret = @api_secret
|
12
|
+
|
13
|
+
# Clear out any previous session data
|
14
|
+
Dwolla::OffsiteGateway.clear_session
|
15
|
+
|
16
|
+
# Optional Settings
|
17
|
+
Dwolla::OffsiteGateway.redirect = 'http://dwolla.com/payment_redirect'
|
18
|
+
Dwolla::OffsiteGateway.callback = 'http://dwolla.com/payment_callback'
|
19
|
+
Dwolla::OffsiteGateway.set_customer_info('Michael', 'Schonfeld', 'michael@dwolla.com', 'New York', 'NY', '10001')
|
20
|
+
Dwolla::OffsiteGateway.discount = 4.95
|
21
|
+
Dwolla::OffsiteGateway.notes = 'This is just an offsite gateway test...'
|
22
|
+
|
23
|
+
# Add products
|
24
|
+
Dwolla::OffsiteGateway.add_product('Macbook Air', '13" Macbook Air; Model #0001', 499.99, 1)
|
25
|
+
|
26
|
+
# Generate a checkout sesssion
|
27
|
+
pp Dwolla::OffsiteGateway.get_checkout_url('812-734-7288')
|
28
|
+
|
29
|
+
# Verify and parse gateway callback
|
30
|
+
data = Dwolla::OffsiteGateway.read_callback('{"Amount":0.01,"OrderId":null,"Status":"Completed","Error":null,"TransactionId":3396300,"CheckoutId":"51f9dfaa-20ed-41a7-8874-00a47c19c655","Signature":"8be03dfd0e95c567b2855f5876acfc98992f6402","TestMode":"false","ClearingDate":"7/22/2013 8:42:18 PM"}')
|
31
|
+
pp data
|
data/examples/transactions.rb
CHANGED
@@ -1,72 +1,72 @@
|
|
1
|
-
# Include the Dwolla gem
|
2
|
-
require 'rubygems'
|
3
|
-
require 'pp'
|
4
|
-
require '../lib/dwolla'
|
5
|
-
|
6
|
-
# Include any required keys
|
7
|
-
require './_keys.rb'
|
8
|
-
|
9
|
-
# Instantiate a new Dwolla User client
|
10
|
-
# And, seed a previously generated access token
|
11
|
-
Dwolla::token = @token
|
12
|
-
Dwolla::debug = true
|
13
|
-
|
14
|
-
# EXAMPLE 1:
|
15
|
-
# Send money ($1.00) to a Dwolla ID
|
16
|
-
transactionId = Dwolla::Transactions.send({:destinationId => '812-626-8794', :amount => 1.00, :pin => @pin})
|
17
|
-
pp transactionId
|
18
|
-
|
19
|
-
# EXAMPLE 2:
|
20
|
-
# Send money ($1.00) to an email address, with a note
|
21
|
-
transactionId = Dwolla::Transactions.send({:destinationId => '812-626-8794', :destinationType => 'Email', :amount => 1.00, :pin => @pin, :notes => 'Everyone loves getting money'})
|
22
|
-
pp transactionId
|
23
|
-
|
24
|
-
# EXAMPLE 3:
|
25
|
-
# Get details about all recent transactions
|
26
|
-
pp Dwolla::Transactions.get
|
27
|
-
|
28
|
-
# EXAMPLE 4:
|
29
|
-
# Get details about a certain Transaction
|
30
|
-
pp Dwolla::Transactions.get(transactionId)
|
31
|
-
|
32
|
-
# EXAMPLE 5:
|
33
|
-
# Get details about a certain Transaction
|
34
|
-
# using the API key & secret
|
35
|
-
Dwolla::token = ''
|
36
|
-
Dwolla::api_key = @api_key
|
37
|
-
Dwolla::api_secret = @api_secret
|
38
|
-
pp Dwolla::Transactions.get(transactionId, {}, false)
|
39
|
-
|
40
|
-
# EXAMPLE 6:
|
41
|
-
# Send money ($1.00) to a Dwolla ID
|
42
|
-
# on 2015-09-09 from funding source "abcdef"
|
43
|
-
pp Dwolla::Transactions.schedule({
|
44
|
-
:pin => @pin,
|
45
|
-
:amount => 1.00,
|
46
|
-
:destinationId => '812-111-1111',
|
47
|
-
:fundsSource => 'abcdef',
|
48
|
-
:scheduleDate => '2015-09-09'})
|
49
|
-
|
50
|
-
|
51
|
-
# EXAMPLE 7:
|
52
|
-
# Get all scheduled transactions
|
53
|
-
pp Dwolla::Transactions.scheduled()
|
54
|
-
|
55
|
-
# EXAMPLE 8:
|
56
|
-
# Get scheduled transaction with ID
|
57
|
-
# 'abcd214'
|
58
|
-
pp Dwolla::Transactions.scheduled_by_id('abcd214')
|
59
|
-
|
60
|
-
# EXAMPLE 9:
|
61
|
-
# Edit scheduled transaction with ID
|
62
|
-
# 'abcd123' to have new amount 10.50
|
63
|
-
pp Dwolla::Transactions.edit_scheduled_by_id('abcd123', {:amount => 10.50})
|
64
|
-
|
65
|
-
# EXAMPLE 10:
|
66
|
-
# Delete the scheduled transaction with ID
|
67
|
-
# 'abcd123'
|
68
|
-
pp Dwolla::Transactions.delete_scheduled_by_id('abcd123', {:pin => @pin})
|
69
|
-
|
70
|
-
# EXAMPLE 11:
|
71
|
-
# Delete all scheduled transactions
|
72
|
-
pp Dwolla::Transactions.delete_all_scheduled({:pin => @pin})
|
1
|
+
# Include the Dwolla gem
|
2
|
+
require 'rubygems'
|
3
|
+
require 'pp'
|
4
|
+
require '../lib/dwolla'
|
5
|
+
|
6
|
+
# Include any required keys
|
7
|
+
require './_keys.rb'
|
8
|
+
|
9
|
+
# Instantiate a new Dwolla User client
|
10
|
+
# And, seed a previously generated access token
|
11
|
+
Dwolla::token = @token
|
12
|
+
Dwolla::debug = true
|
13
|
+
|
14
|
+
# EXAMPLE 1:
|
15
|
+
# Send money ($1.00) to a Dwolla ID
|
16
|
+
transactionId = Dwolla::Transactions.send({:destinationId => '812-626-8794', :amount => 1.00, :pin => @pin})
|
17
|
+
pp transactionId
|
18
|
+
|
19
|
+
# EXAMPLE 2:
|
20
|
+
# Send money ($1.00) to an email address, with a note
|
21
|
+
transactionId = Dwolla::Transactions.send({:destinationId => '812-626-8794', :destinationType => 'Email', :amount => 1.00, :pin => @pin, :notes => 'Everyone loves getting money'})
|
22
|
+
pp transactionId
|
23
|
+
|
24
|
+
# EXAMPLE 3:
|
25
|
+
# Get details about all recent transactions
|
26
|
+
pp Dwolla::Transactions.get
|
27
|
+
|
28
|
+
# EXAMPLE 4:
|
29
|
+
# Get details about a certain Transaction
|
30
|
+
pp Dwolla::Transactions.get(transactionId)
|
31
|
+
|
32
|
+
# EXAMPLE 5:
|
33
|
+
# Get details about a certain Transaction
|
34
|
+
# using the API key & secret
|
35
|
+
Dwolla::token = ''
|
36
|
+
Dwolla::api_key = @api_key
|
37
|
+
Dwolla::api_secret = @api_secret
|
38
|
+
pp Dwolla::Transactions.get(transactionId, {}, false)
|
39
|
+
|
40
|
+
# EXAMPLE 6:
|
41
|
+
# Send money ($1.00) to a Dwolla ID
|
42
|
+
# on 2015-09-09 from funding source "abcdef"
|
43
|
+
pp Dwolla::Transactions.schedule({
|
44
|
+
:pin => @pin,
|
45
|
+
:amount => 1.00,
|
46
|
+
:destinationId => '812-111-1111',
|
47
|
+
:fundsSource => 'abcdef',
|
48
|
+
:scheduleDate => '2015-09-09'})
|
49
|
+
|
50
|
+
|
51
|
+
# EXAMPLE 7:
|
52
|
+
# Get all scheduled transactions
|
53
|
+
pp Dwolla::Transactions.scheduled()
|
54
|
+
|
55
|
+
# EXAMPLE 8:
|
56
|
+
# Get scheduled transaction with ID
|
57
|
+
# 'abcd214'
|
58
|
+
pp Dwolla::Transactions.scheduled_by_id('abcd214')
|
59
|
+
|
60
|
+
# EXAMPLE 9:
|
61
|
+
# Edit scheduled transaction with ID
|
62
|
+
# 'abcd123' to have new amount 10.50
|
63
|
+
pp Dwolla::Transactions.edit_scheduled_by_id('abcd123', {:amount => 10.50})
|
64
|
+
|
65
|
+
# EXAMPLE 10:
|
66
|
+
# Delete the scheduled transaction with ID
|
67
|
+
# 'abcd123'
|
68
|
+
pp Dwolla::Transactions.delete_scheduled_by_id('abcd123', {:pin => @pin})
|
69
|
+
|
70
|
+
# EXAMPLE 11:
|
71
|
+
# Delete all scheduled transactions
|
72
|
+
pp Dwolla::Transactions.delete_all_scheduled({:pin => @pin})
|