Class: Dwolla::User
Instance Attribute Summary collapse
-
#city ⇒ Object
Returns the value of attribute city.
-
#contact_type ⇒ Object
Returns the value of attribute contact_type.
-
#id ⇒ Object
Returns the value of attribute id.
-
#image ⇒ Object
Returns the value of attribute image.
-
#latitude ⇒ Object
Returns the value of attribute latitude.
-
#longitude ⇒ Object
Returns the value of attribute longitude.
-
#name ⇒ Object
Returns the value of attribute name.
-
#oauth_token ⇒ Object
Returns the value of attribute oauth_token.
-
#state ⇒ Object
Returns the value of attribute state.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
- #balance ⇒ Object
- #contacts(options = {}) ⇒ Object
- #fetch ⇒ Object
-
#initialize(attrs = {}) ⇒ User
constructor
A new instance of User.
- #request_money_from(source, amount, pin, source_type = 'dwolla', description = '') ⇒ Object
- #send_money_to(destination, amount, pin, type = 'dwolla', description = '') ⇒ Object
- #update_attributes(attrs) ⇒ Object
Constructor Details
#initialize(attrs = {}) ⇒ User
Returns a new instance of User.
16 17 18 |
# File 'lib/dwolla/user.rb', line 16 def initialize(attrs={}) update_attributes(attrs) end |
Instance Attribute Details
#city ⇒ Object
Returns the value of attribute city.
5 6 7 |
# File 'lib/dwolla/user.rb', line 5 def city @city end |
#contact_type ⇒ Object
Returns the value of attribute contact_type.
5 6 7 |
# File 'lib/dwolla/user.rb', line 5 def contact_type @contact_type end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/dwolla/user.rb', line 5 def id @id end |
#image ⇒ Object
Returns the value of attribute image.
5 6 7 |
# File 'lib/dwolla/user.rb', line 5 def image @image end |
#latitude ⇒ Object
Returns the value of attribute latitude.
5 6 7 |
# File 'lib/dwolla/user.rb', line 5 def latitude @latitude end |
#longitude ⇒ Object
Returns the value of attribute longitude.
5 6 7 |
# File 'lib/dwolla/user.rb', line 5 def longitude @longitude end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/dwolla/user.rb', line 5 def name @name end |
#oauth_token ⇒ Object
Returns the value of attribute oauth_token.
5 6 7 |
# File 'lib/dwolla/user.rb', line 5 def oauth_token @oauth_token end |
#state ⇒ Object
Returns the value of attribute state.
5 6 7 |
# File 'lib/dwolla/user.rb', line 5 def state @state end |
#type ⇒ Object
Returns the value of attribute type.
5 6 7 |
# File 'lib/dwolla/user.rb', line 5 def type @type end |
Class Method Details
Instance Method Details
#balance ⇒ Object
37 38 39 |
# File 'lib/dwolla/user.rb', line 37 def balance get('balance') end |
#contacts(options = {}) ⇒ Object
41 42 43 44 45 46 |
# File 'lib/dwolla/user.rb', line 41 def contacts( = {}) contacts_url = 'contacts' contacts = get(contacts_url, ) instances_from_contacts(contacts) end |
#fetch ⇒ Object
24 25 26 27 28 |
# File 'lib/dwolla/user.rb', line 24 def fetch user_attributes = get('users') update_attributes(user_attributes) self end |
#request_money_from(source, amount, pin, source_type = 'dwolla', description = '') ⇒ Object
60 61 62 63 64 65 66 67 68 69 |
# File 'lib/dwolla/user.rb', line 60 def request_money_from(source, amount, pin, source_type='dwolla', description='') transaction = Transaction.new(:origin => self, :source => source, :source_type => source_type, :description => description, :type => :request, :amount => amount, :pin => pin) transaction.execute end |
#send_money_to(destination, amount, pin, type = 'dwolla', description = '') ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/dwolla/user.rb', line 48 def send_money_to(destination, amount, pin, type='dwolla', description='') transaction = Transaction.new(:origin => self, :destination => destination, :destination_type => type, :description => description, :type => :send, :amount => amount, :pin => pin) transaction.execute end |
#update_attributes(attrs) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/dwolla/user.rb', line 30 def update_attributes(attrs) attrs.each do |key, value| key_string = key.is_a?(String) ? key : key.to_s send("#{key_string.downcase}=".to_sym, value) end end |