Class: Flickr::People
Defined Under Namespace
Classes: Person
Constant Summary
Constants inherited from Base
Base::AUTH_ENDPOINT, Base::REST_ENDPOINT, Base::UPLOAD_ENDPOINT
Instance Attribute Summary
Attributes inherited from Base
#api_key, #api_secret, #token, #token_cache
Instance Method Summary collapse
-
#find_by_email(email) ⇒ Object
Get information about a user.
-
#find_by_id(id) ⇒ Object
Get information about a user.
-
#find_by_username(username) ⇒ Object
Get information about a user.
-
#initialize(flickr) ⇒ People
constructor
A new instance of People.
Methods inherited from Base
#auth, #contacts, #people, #photos, #photosets, #send_request, #sign_request, #test, #uploader, #urls
Constructor Details
#initialize(flickr) ⇒ People
Returns a new instance of People.
2 3 4 |
# File 'lib/flickr/people.rb', line 2 def initialize(flickr) @flickr = flickr end |
Instance Method Details
#find_by_email(email) ⇒ Object
Get information about a user.
Params
-
email (Required)
the email of the user to get information for
49 50 51 52 53 |
# File 'lib/flickr/people.rb', line 49 def find_by_email(email) rsp = @flickr.send_request('flickr.people.findByEmail', {:find_email => email}) find_by_id(rsp.user[:nsid]) end |
#find_by_id(id) ⇒ Object
Get information about a user.
Params
-
id (Required)
the nsid of the user to get information for
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/flickr/people.rb', line 12 def find_by_id(id) rsp = @flickr.send_request('flickr.people.getInfo', {:user_id => id}) Person.new(@flickr, :nsid => rsp.person[:nsid], :is_admin => (rsp.person[:isadmin] == "1" ? true : false), :is_pro => (rsp.person[:ispro] == "1" ? true : false), :icon_server => rsp.person[:iconserver], :icon_farm => rsp.person[:iconfarm], :username => rsp.person.username.to_s, :realname => rsp.person.realname.to_s, :mbox_sha1sum => (rsp.person.mbox_sha1sum.to_s rescue nil), :location => rsp.person.location.to_s, :photos_url => rsp.person.photosurl.to_s, :profile_url => rsp.person.profileurl.to_s, :photo_count => rsp.person.photos.count.to_s.to_i, :photo_first_upload => (Time.at(rsp.person.photos.firstdate.to_s.to_i) rescue nil), :photo_first_taken => (Time.parse(rsp.person.photos.firstdatetaken.to_s) rescue nil)) end |
#find_by_username(username) ⇒ Object
Get information about a user.
Params
-
username (Required)
the username of the user to get information for
37 38 39 40 41 |
# File 'lib/flickr/people.rb', line 37 def find_by_username(username) rsp = @flickr.send_request('flickr.people.findByUsername', {:username => username}) find_by_id(rsp.user[:nsid]) end |