Class: Flickr::User
Instance Attribute Summary collapse
-
#nsid ⇒ Object
Returns the value of attribute nsid.
-
#username ⇒ Object
Returns the value of attribute username.
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
-
#buddy_icon? ⇒ Boolean
Do they have a buddy icon or not?.
- #buddy_icon_url ⇒ Object
-
#initialize(username, nsid) ⇒ User
constructor
A new instance of User.
-
#location ⇒ Object
The location string as entered in flickr.
-
#pro? ⇒ Boolean
has the user shelled out for flickr-pro account?.
-
#realname ⇒ Object
Instance methods.
Methods inherited from Base
#machine_tags, #photos, #sets, #tags
Constructor Details
#initialize(username, nsid) ⇒ User
Returns a new instance of User.
4 5 6 |
# File 'lib/flickr-wrapper/user.rb', line 4 def initialize username, nsid @username, @nsid = username, nsid end |
Instance Attribute Details
#nsid ⇒ Object
Returns the value of attribute nsid.
2 3 4 |
# File 'lib/flickr-wrapper/user.rb', line 2 def nsid @nsid end |
#username ⇒ Object
Returns the value of attribute username.
2 3 4 |
# File 'lib/flickr-wrapper/user.rb', line 2 def username @username end |
Class Method Details
.find_by_email(email) ⇒ Object
Class methods
12 13 14 15 |
# File 'lib/flickr-wrapper/user.rb', line 12 def self.find_by_email email result = Flickr::Query.new('').execute('flickr.people.findByEmail', :find_email => email) return Flickr::User.new(result.at(:username).inner_text, result.at(:user)['nsid']) end |
.find_by_username(username) ⇒ Object
17 18 19 20 |
# File 'lib/flickr-wrapper/user.rb', line 17 def self.find_by_username username result = Flickr::Query.new('').execute('flickr.people.findByUsername', :username => username) return Flickr::User.new(result.at(:username).inner_text, result.at(:user)['nsid']) end |
Instance Method Details
#buddy_icon? ⇒ Boolean
Do they have a buddy icon or not?
41 42 43 |
# File 'lib/flickr-wrapper/user.rb', line 41 def buddy_icon? (icon_server > 0) ? true : false end |
#buddy_icon_url ⇒ Object
45 46 47 |
# File 'lib/flickr-wrapper/user.rb', line 45 def buddy_icon_url buddy_icon? ? "http://farm#{icon_farm}.static.flickr.com/#{icon_server}/buddyicons/#{nsid}.jpg" : "http://www.flickr.com/images/buddyicon.jpg" end |
#location ⇒ Object
The location string as entered in flickr
31 32 33 |
# File 'lib/flickr-wrapper/user.rb', line 31 def location get_info.at(:location).inner_text || "Unknown" end |
#pro? ⇒ Boolean
has the user shelled out for flickr-pro account?
36 37 38 |
# File 'lib/flickr-wrapper/user.rb', line 36 def pro? (get_info.at(:person)["ispro"] == "1") ? true : false end |
#realname ⇒ Object
Instance methods
26 27 28 |
# File 'lib/flickr-wrapper/user.rb', line 26 def realname get_info.at(:realname).inner_text end |