Class: Kuva::Elements::Photo
- Inherits:
-
Object
- Object
- Kuva::Elements::Photo
- Defined in:
- lib/kuva/elements/photo.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#farm ⇒ Object
readonly
Returns the value of attribute farm.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#is_primary ⇒ Object
readonly
Returns the value of attribute is_primary.
-
#secret ⇒ Object
readonly
Returns the value of attribute secret.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Photo
constructor
A new instance of Photo.
- #url ⇒ Object
- #url_n ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Photo
Returns a new instance of Photo.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/kuva/elements/photo.rb', line 7 def initialize(attributes = {}) @id = attributes.try :id @title = attributes.try :title @description = attributes.try :description @farm = attributes.try :farm @server = attributes.try :server @secret = attributes.try :secret @is_primary = attributes.try :is_primary self end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
5 6 7 |
# File 'lib/kuva/elements/photo.rb', line 5 def description @description end |
#farm ⇒ Object (readonly)
Returns the value of attribute farm.
5 6 7 |
# File 'lib/kuva/elements/photo.rb', line 5 def farm @farm end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/kuva/elements/photo.rb', line 5 def id @id end |
#is_primary ⇒ Object (readonly)
Returns the value of attribute is_primary.
5 6 7 |
# File 'lib/kuva/elements/photo.rb', line 5 def is_primary @is_primary end |
#secret ⇒ Object (readonly)
Returns the value of attribute secret.
5 6 7 |
# File 'lib/kuva/elements/photo.rb', line 5 def secret @secret end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
5 6 7 |
# File 'lib/kuva/elements/photo.rb', line 5 def server @server end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
5 6 7 |
# File 'lib/kuva/elements/photo.rb', line 5 def title @title end |
Class Method Details
.find(id) ⇒ Object
19 20 21 22 23 |
# File 'lib/kuva/elements/photo.rb', line 19 def self.find(id) Rails.cache.fetch "photo-#{id}", expires_in: Kuva.cache_expiration do new flickr.photos.getInfo(photo_id: id) end end |
Instance Method Details
#url ⇒ Object
25 26 27 |
# File 'lib/kuva/elements/photo.rb', line 25 def url FlickRaw.url info end |
#url_n ⇒ Object
29 30 31 |
# File 'lib/kuva/elements/photo.rb', line 29 def url_n FlickRaw.url_n info end |