class Kuva::Elements::Photoset

Attributes

created_at[R]
description[R]
farm[R]
id[R]
number_of_photos[R]
primary[R]
secret[R]
server[R]
title[R]
updated_at[R]
views[R]

Public Class Methods

find(id) click to toggle source
# File lib/kuva/elements/photoset.rb, line 23
def self.find(id)
  Rails.cache.fetch "photoset-#{id}", expires_in: Kuva.cache_expiration do
    new flickr.photosets.getInfo(photoset_id: id)
  end
end
new(attributes = {}) click to toggle source
# File lib/kuva/elements/photoset.rb, line 7
def initialize(attributes = {})
  @id               = attributes.try :id
  @title            = attributes.try :title
  @description      = attributes.try :description
  @views            = attributes.try :count_views
  @number_of_photos = attributes.try :photos
  @farm             = attributes.try :farm
  @server           = attributes.try :server
  @secret           = attributes.try :secret
  @primary          = attributes.try :primary
  @created_at       = attributes.try :date_create
  @updated_at       = attributes.try :date_update

  self
end

Public Instance Methods

image_url() click to toggle source
# File lib/kuva/elements/photoset.rb, line 35
def image_url
  FlickRaw.url_q Kuva::Elements::UrlInfo.new primary, farm, server, secret
end
with_photos() click to toggle source
# File lib/kuva/elements/photoset.rb, line 29
def with_photos
  @with_photos ||= photos.each_with_object([]) do |photo, collection|
    collection << Kuva::Elements::Photo.new(photo)
  end
end

Private Instance Methods

photos() click to toggle source
# File lib/kuva/elements/photoset.rb, line 41
def photos
  Rails.cache.fetch "photos-from-photoset-#{id}-#{updated_at}", expires_in: Kuva.cache_expiration do
    flickr.photosets.getPhotos(photoset_id: id).photo
  end
end