Class: Myflickr::Photo
- Inherits:
-
Struct
- Object
- Struct
- Myflickr::Photo
- Defined in:
- lib/myflickr/photo.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#id ⇒ Object
Returns the value of attribute id.
-
#machine_tags ⇒ Object
Returns the value of attribute machine_tags.
-
#sizes ⇒ Object
readonly
Get the photo sizes for the photo in an array.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#title ⇒ Object
Returns the value of attribute title.
Class Method Summary collapse
-
.find(id) ⇒ Object
Find will grab all sizes of images, process the tags and standard attributes of a photo.
-
.recent ⇒ Object
Get recent photos.
-
.search(search_string) ⇒ Object
Find a collection of photos by text.
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description
2 3 4 |
# File 'lib/myflickr/photo.rb', line 2 def description @description end |
#id ⇒ Object
Returns the value of attribute id
2 3 4 |
# File 'lib/myflickr/photo.rb', line 2 def id @id end |
#machine_tags ⇒ Object
Returns the value of attribute machine_tags
2 3 4 |
# File 'lib/myflickr/photo.rb', line 2 def @machine_tags end |
#sizes ⇒ Object (readonly)
Get the photo sizes for the photo in an array
30 31 32 |
# File 'lib/myflickr/photo.rb', line 30 def sizes @sizes end |
#tags ⇒ Object
Returns the value of attribute tags
2 3 4 |
# File 'lib/myflickr/photo.rb', line 2 def @tags end |
#title ⇒ Object
Returns the value of attribute title
2 3 4 |
# File 'lib/myflickr/photo.rb', line 2 def title @title end |
Class Method Details
.find(id) ⇒ Object
Find will grab all sizes of images, process the tags and standard attributes of a photo
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/myflickr/photo.rb', line 16 def self.find(id) photo_call = Query.api_call('flickr.photos.getInfo', "photo_id=#{id}") # Set basic attributes photo = Photo.new(id, *%w(title description).map {|a| (photo_call/a).inner_text }) # Set tags for photo photo. = (photo_call/:tag).map{|tag| Tag.new tag.inner_text unless /(.*)\:(.*)\=(.*)/ } photo. = (photo_call/"tag[@machine_tag=1]").map{|tag| MachineTag.from_s tag.inner_text } return photo end |