Class: Dwolla::Transactions
- Inherits:
-
Object
- Object
- Dwolla::Transactions
- Defined in:
- lib/dwolla/transactions.rb
Class Method Summary collapse
- .create(params = {}, token = nil) ⇒ Object (also: send)
- .get(id = nil, filters = {}, token = nil) ⇒ Object (also: listing)
- .guest_send(params = {}) ⇒ Object
- .refund(params = {}, token = nil) ⇒ Object
- .stats(filters = {}, token = nil) ⇒ Object
Class Method Details
.create(params = {}, token = nil) ⇒ Object Also known as: send
24 25 26 27 28 29 30 31 32 |
# File 'lib/dwolla/transactions.rb', line 24 def self.create(params={}, token=nil) raise MissingParameterError.new('No PIN Provided.') unless params[:pin] raise MissingParameterError.new('No Destination ID Provided.') unless params[:destinationId] raise MissingParameterError.new('No Amount Provided.') unless params[:amount] url = transactions_url + 'send' Dwolla.request(:post, url, params, {}, token) end |
.get(id = nil, filters = {}, token = nil) ⇒ Object Also known as: listing
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/dwolla/transactions.rb', line 3 def self.get(id=nil, filters={}, token=nil) url = transactions_url if id.is_a?(Hash) filters = id id = nil else filters = {} end url += id.to_s unless id.nil? Dwolla.request(:get, url, filters, {}, token) end |
.guest_send(params = {}) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/dwolla/transactions.rb', line 45 def self.guest_send(params={}) raise MissingParameterError.new('No Destination ID Provided.') unless params[:destinationId] raise MissingParameterError.new('No Amount Provided.') unless params[:amount] raise MissingParameterError.new('No First Name Provided.') unless params[:firstName] raise MissingParameterError.new('No Last Name Provided.') unless params[:lastName] raise MissingParameterError.new('No Email Address Provided.') unless params[:emailAddress] raise MissingParameterError.new('No Routing Number (ABA) Provided.') unless params[:routingNumber] raise MissingParameterError.new('No Account Number Provided.') unless params[:accountNumber] raise MissingParameterError.new('No Account Type Provided.') unless params[:accountType] url = transactions_url + 'guestsend' Dwolla.request(:post, url, params, {}, false) end |
.refund(params = {}, token = nil) ⇒ Object
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/dwolla/transactions.rb', line 34 def self.refund(params={}, token=nil) raise MissingParameterError.new('No PIN Provided.') unless params[:pin] raise MissingParameterError.new('No Funding Source Provided.') unless params[:fundsSource] raise MissingParameterError.new('No Transaction ID Provided.') unless params[:transactionId] raise MissingParameterError.new('No Amount Provided.') unless params[:amount] url = transactions_url + 'refund' Dwolla.request(:post, url, params, {}, token) end |
.stats(filters = {}, token = nil) ⇒ Object
18 19 20 21 22 |
# File 'lib/dwolla/transactions.rb', line 18 def self.stats(filters={}, token=nil) url = transactions_url + 'stats' Dwolla.request(:get, url, filters, {}, token) end |