Class: FoursquareUser
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- FoursquareUser
- Defined in:
- lib/generators/foursquare/authentication/templates/models/foursquare_user.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.find_or_create_by_access_token(access_token) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/generators/foursquare/authentication/templates/models/foursquare_user.rb', line 11 def find_or_create_by_access_token(access_token) client = FoursquareClient.new(access_token) unless user = self.find_by_foursquare_id(client.user_id) user = self.new user.foursquare_id = client.user_id user.access_token = client.access_token user.save! end user end |
Instance Method Details
#client ⇒ Object
6 7 8 |
# File 'lib/generators/foursquare/authentication/templates/models/foursquare_user.rb', line 6 def client @client ||= FoursquareClient.new(access_token) end |
#name ⇒ Object
2 3 4 |
# File 'lib/generators/foursquare/authentication/templates/models/foursquare_user.rb', line 2 def name client.user_name end |