Class: WishSimple::User

Inherits:
Resource show all
Defined in:
lib/wishsimple/user.rb

Constant Summary collapse

ATTRS =
[:facebook_uid, :access_token]

Instance Attribute Summary

Attributes inherited from Resource

#created_at

Instance Method Summary collapse

Methods inherited from Resource

create, #destroy, #save

Constructor Details

#initialize(facebook_uid, access_token = nil) ⇒ User

Returns a new instance of User.



8
9
10
11
# File 'lib/wishsimple/user.rb', line 8

def initialize(facebook_uid, access_token=nil)
  self.facebook_uid = facebook_uid
  self.access_token = access_token
end

Instance Method Details

#==(other) ⇒ Object



13
14
15
# File 'lib/wishsimple/user.rb', line 13

def ==(other)
  super || (other.class == self.class && other.facebook_uid == self.facebook_uid)
end

#purchase!(product) ⇒ Object

Actions



18
19
20
# File 'lib/wishsimple/user.rb', line 18

def purchase!(product)
  WishSimple::Purchase.create(user: self, product: product)
end