Class: VenmoAPI::Payment
- Inherits:
-
Object
- Object
- VenmoAPI::Payment
- Defined in:
- lib/venmo/payment.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#audience ⇒ Object
Returns the value of attribute audience.
-
#data ⇒ Object
Returns the value of attribute data.
-
#email ⇒ Object
Returns the value of attribute email.
-
#note ⇒ Object
Returns the value of attribute note.
-
#phone ⇒ Object
Returns the value of attribute phone.
-
#sent ⇒ Object
Returns the value of attribute sent.
-
#user_id ⇒ Object
Returns the value of attribute user_id.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Payment
constructor
A new instance of Payment.
- #send(access_token) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Payment
Returns a new instance of Payment.
4 5 6 7 8 9 10 11 12 |
# File 'lib/venmo/payment.rb', line 4 def initialize( = {}) self.phone = [:phone] self.email = [:email] self.user_id = [:user_id] self.note = [:note] self.amount = [:amount] self.audience = [:audience] ? [:audience] : 'friends' validate_properties end |
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
3 4 5 |
# File 'lib/venmo/payment.rb', line 3 def amount @amount end |
#audience ⇒ Object
Returns the value of attribute audience.
3 4 5 |
# File 'lib/venmo/payment.rb', line 3 def audience @audience end |
#data ⇒ Object
Returns the value of attribute data.
3 4 5 |
# File 'lib/venmo/payment.rb', line 3 def data @data end |
#email ⇒ Object
Returns the value of attribute email.
3 4 5 |
# File 'lib/venmo/payment.rb', line 3 def email @email end |
#note ⇒ Object
Returns the value of attribute note.
3 4 5 |
# File 'lib/venmo/payment.rb', line 3 def note @note end |
#phone ⇒ Object
Returns the value of attribute phone.
3 4 5 |
# File 'lib/venmo/payment.rb', line 3 def phone @phone end |
#sent ⇒ Object
Returns the value of attribute sent.
3 4 5 |
# File 'lib/venmo/payment.rb', line 3 def sent @sent end |
#user_id ⇒ Object
Returns the value of attribute user_id.
3 4 5 |
# File 'lib/venmo/payment.rb', line 3 def user_id @user_id end |
Instance Method Details
#send(access_token) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/venmo/payment.rb', line 14 def send (access_token) uri = URI(VenmoAPI::Helper::VENMO_BASE_URL + 'payments') res = Net::HTTP.post_form(uri, 'access_token' => access_token, 'phone' => self.phone, 'email' => self.email, 'user_id' => self.user_id, 'note' => self.note, 'amount' => self.amount, 'audience' => self.audience) res_data = JSON.parse(res.body) if res_data["data"] self.data = VenmoAPI::Helper::recursive_symbolize_keys! res_data["data"] end return self end |