Class: Fleakr::Objects::User
- Inherits:
-
Object
- Object
- Fleakr::Objects::User
- Includes:
- Support::Object
- Defined in:
- lib/fleakr/objects/user.rb
Overview
User
Accessors
This class maps directly onto the flickr.people.* API methods and provides the following attributes for a user:
- id
-
The ID for this user (also referred to as the NSID in the API docs)
- username
-
This user’s username
- name
-
This user’s full name (if entered)
- location
-
This user’s location (if entered)
- photos_url
-
The direct URL to this user’s photostream
- profile_url
-
The direct URL to this user’s profile
- photos_count
-
The number of photos that this user has uploaded
- icon_url
-
This user’s buddy icon (or a default one if an icon wasn’t uploaded)
- pro?
-
Does this user have a pro account?
- admin?
-
Is this user an admin?
Associations
The User class is pretty central to many of the other data available across the system, so there are a few associations available to a user:
- sets
-
A list of this user’s public sets (newest first). See Fleakr::Objects::Set for more information.
- groups
-
A list of this user’s public groups. See Fleakr::Objects::Group.
- photos
-
A list of this user’s public photos (newest first). See Fleakr::Objects::Photo.
- contacts
-
A list of this user’s contacts - these are simply User objects
- tags
-
The tags associated with this user
Examples
Access to a specific user is typically done through the Fleakr.user method:
user = Fleakr.user('brownout')
user.id
user.username
user.sets
user.contacts
Instance Method Summary collapse
-
#admin? ⇒ Boolean
Is this user an admin?.
-
#icon_url ⇒ Object
This user’s buddy icon.
-
#load_info ⇒ Object
:nodoc:.
-
#pro? ⇒ Boolean
Is this a pro account?.
Methods included from Support::Object
Instance Method Details
#admin? ⇒ Boolean
Is this user an admin?
75 76 77 |
# File 'lib/fleakr/objects/user.rb', line 75 def admin? (self.admin.to_i == 0) ? false : true end |
#icon_url ⇒ Object
This user’s buddy icon
80 81 82 83 84 85 86 |
# File 'lib/fleakr/objects/user.rb', line 80 def icon_url if self.icon_server.to_i > 0 "http://farm#{self.icon_farm}.static.flickr.com/#{self.icon_server}/buddyicons/#{self.id}.jpg" else 'http://www.flickr.com/images/buddyicon.jpg' end end |
#load_info ⇒ Object
:nodoc:
88 89 90 91 |
# File 'lib/fleakr/objects/user.rb', line 88 def load_info # :nodoc: response = Fleakr::Api::MethodRequest.with_response!('people.getInfo', :user_id => self.id) self.populate_from(response.body) end |
#pro? ⇒ Boolean
Is this a pro account?
70 71 72 |
# File 'lib/fleakr/objects/user.rb', line 70 def pro? (self.pro.to_i == 0) ? false : true end |