Class: Flickr::People::Person
Overview
wrapping class to hold an flickr photo
Instance Attribute Summary collapse
-
#icon_farm ⇒ Object
Returns the value of attribute icon_farm.
-
#icon_server ⇒ Object
Returns the value of attribute icon_server.
-
#is_admin ⇒ Object
Returns the value of attribute is_admin.
-
#is_pro ⇒ Object
Returns the value of attribute is_pro.
-
#location ⇒ Object
Returns the value of attribute location.
-
#mbox_sha1sum ⇒ Object
Returns the value of attribute mbox_sha1sum.
-
#nsid ⇒ Object
Returns the value of attribute nsid.
-
#photo_count ⇒ Object
Returns the value of attribute photo_count.
-
#photo_first_taken ⇒ Object
Returns the value of attribute photo_first_taken.
-
#photo_first_upload ⇒ Object
Returns the value of attribute photo_first_upload.
-
#photos_url ⇒ Object
Returns the value of attribute photos_url.
-
#profile_url ⇒ Object
Returns the value of attribute profile_url.
-
#realname ⇒ Object
Returns the value of attribute realname.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
-
#initialize(flickr, attributes) ⇒ Person
constructor
create a new instance of a flickr person.
-
#public_photos(options = {}) ⇒ Object
Get a list of public photos for the given user.
Constructor Details
#initialize(flickr, attributes) ⇒ Person
create a new instance of a flickr person.
Params
-
flickr (Required)
the flickr object
-
attributes (Required)
a hash of attributes used to set the initial values of the person object
13 14 15 16 17 18 |
# File 'lib/flickr/person.rb', line 13 def initialize(flickr, attributes) @flickr = flickr attributes.each do |k,v| send("#{k}=", v) end end |
Instance Attribute Details
#icon_farm ⇒ Object
Returns the value of attribute icon_farm.
4 5 6 |
# File 'lib/flickr/person.rb', line 4 def icon_farm @icon_farm end |
#icon_server ⇒ Object
Returns the value of attribute icon_server.
4 5 6 |
# File 'lib/flickr/person.rb', line 4 def icon_server @icon_server end |
#is_admin ⇒ Object
Returns the value of attribute is_admin.
4 5 6 |
# File 'lib/flickr/person.rb', line 4 def is_admin @is_admin end |
#is_pro ⇒ Object
Returns the value of attribute is_pro.
4 5 6 |
# File 'lib/flickr/person.rb', line 4 def is_pro @is_pro end |
#location ⇒ Object
Returns the value of attribute location.
4 5 6 |
# File 'lib/flickr/person.rb', line 4 def location @location end |
#mbox_sha1sum ⇒ Object
Returns the value of attribute mbox_sha1sum.
4 5 6 |
# File 'lib/flickr/person.rb', line 4 def mbox_sha1sum @mbox_sha1sum end |
#nsid ⇒ Object
Returns the value of attribute nsid.
4 5 6 |
# File 'lib/flickr/person.rb', line 4 def nsid @nsid end |
#photo_count ⇒ Object
Returns the value of attribute photo_count.
4 5 6 |
# File 'lib/flickr/person.rb', line 4 def photo_count @photo_count end |
#photo_first_taken ⇒ Object
Returns the value of attribute photo_first_taken.
4 5 6 |
# File 'lib/flickr/person.rb', line 4 def photo_first_taken @photo_first_taken end |
#photo_first_upload ⇒ Object
Returns the value of attribute photo_first_upload.
4 5 6 |
# File 'lib/flickr/person.rb', line 4 def photo_first_upload @photo_first_upload end |
#photos_url ⇒ Object
Returns the value of attribute photos_url.
4 5 6 |
# File 'lib/flickr/person.rb', line 4 def photos_url @photos_url end |
#profile_url ⇒ Object
Returns the value of attribute profile_url.
4 5 6 |
# File 'lib/flickr/person.rb', line 4 def profile_url @profile_url end |
#realname ⇒ Object
Returns the value of attribute realname.
4 5 6 |
# File 'lib/flickr/person.rb', line 4 def realname @realname end |
#username ⇒ Object
Returns the value of attribute username.
4 5 6 |
# File 'lib/flickr/person.rb', line 4 def username @username end |
Instance Method Details
#public_photos(options = {}) ⇒ Object
Get a list of public photos for the given user.
Options
-
safe_search (Optional)
Safe search setting: 1 for safe. 2 for moderate. 3 for restricted. (Please note: Un-authed calls can only see Safe content.)
-
per_page (Optional)
Number of photos to return per page. If this argument is omitted, it defaults to 100. The maximum allowed value is 500.
-
page (Optional)
The page of results to return. If this argument is omitted, it defaults to 1.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/flickr/person.rb', line 33 def public_photos( = {}) .merge!({:user_id => self.nsid, :extras => "license,date_upload,date_taken,owner_name,icon_server,original_format,last_update,geo,tags,machine_tags,o_dims,views,media"}) rsp = @flickr.send_request('flickr.people.getPublicPhotos', ) returning Flickr::Photos::PhotoResponse.new(:page => rsp.photos[:page].to_i, :pages => rsp.photos[:pages].to_i, :per_page => rsp.photos[:perpage].to_i, :total => rsp.photos[:total].to_i, :photos => [], :api => self, :method => 'public_photos', :options => ) do |photos| rsp.photos.photo.each do |photo| attributes = {:id => photo[:id], :owner => photo[:owner], :secret => photo[:secret], :server => photo[:server], :farm => photo[:farm], :title => photo[:title], :is_public => photo[:ispublic], :is_friend => photo[:isfriend], :is_family => photo[:isfamily], :license => photo[:license], :uploaded_at => (Time.at(photo[:dateupload].to_i) rescue nil), :taken_at => (Time.parse(photo[:datetaken]) rescue nil), :owner_name => photo[:ownername], :icon_server => photo[:icon_server], :original_format => photo[:originalformat], :updated_at => (Time.at(photo[:lastupdate].to_i) rescue nil), :geo => photo[:geo], :tags => photo[:tags], :machine_tags => photo[:machine_tags], :o_dims => photo[:o_dims], :views => photo[:views].to_i, :media => photo[:media]} photos << Flickr::Photos::Photo.new(@flickr, attributes) end if rsp.photos.photo end end |