Class: Flickr::Api::Set

Inherits:
Abstract show all
Defined in:
lib/flickr/api/set.rb

Instance Method Summary collapse

Methods inherited from Abstract

#find, #initialize, object_class

Methods included from Flickr::AutoloadHelper

#autoload_dir, #autoload_names

Constructor Details

This class inherits a constructor from Flickr::Api::Abstract

Instance Method Details

#add_photo(set_id, photo_id, params = {}) ⇒ response



75
76
77
# File 'lib/flickr/api/set.rb', line 75

def add_photo(set_id, photo_id, params = {})
  post "photosets.addPhoto", params.merge(photoset_id: set_id, photo_id: photo_id)
end

#create(params = {}) ⇒ Flickr::Object::Set



11
12
13
14
# File 'lib/flickr/api/set.rb', line 11

def create(params = {})
  response = post "photosets.create", params
  new_object(:Set, response["photoset"])
end

#delete(set_id, params = {}) ⇒ response



30
31
32
# File 'lib/flickr/api/set.rb', line 30

def delete(set_id, params = {})
  post "photosets.delete", params.merge(photoset_id: set_id)
end

#edit_meta(set_id, params = {}) ⇒ response



105
106
107
# File 'lib/flickr/api/set.rb', line 105

def edit_meta(set_id, params = {})
  post "photosets.editMeta", params.merge(photoset_id: set_id)
end

#edit_photos(set_id, params = {}) ⇒ response



40
41
42
# File 'lib/flickr/api/set.rb', line 40

def edit_photos(set_id, params = {})
  post "photosets.editPhotos", params.merge(photoset_id: set_id)
end

#get_info(set_id, params = {}) ⇒ Flickr::Object::Set



50
51
52
53
# File 'lib/flickr/api/set.rb', line 50

def get_info(set_id, params = {})
  response = get "photosets.getInfo", params.merge(photoset_id: set_id)
  new_object(:Set, response["photoset"])
end

#get_photos(set_id, params = {}) ⇒ Flickr::Object::List<Flickr::Object::Photo>

Options Hash (params):

  • :sizes (Boolean, Array<String>)

    For all sizes use ‘true`, for specific ones chuck them into an array (e.g. `[“Square 75”, “Medium 500”]`).



63
64
65
66
# File 'lib/flickr/api/set.rb', line 63

def get_photos(set_id, params = {})
  response = get "photosets.getPhotos", params.merge(photoset_id: set_id)
  new_list(:Photo, response["photoset"]["photo"].map { |h| h.merge("owner" => response["photoset"]["owner"]) }, response["photoset"])
end

#order(set_ids, params = {}) ⇒ response



21
22
23
# File 'lib/flickr/api/set.rb', line 21

def order(set_ids, params = {})
  post "photosets.orderSets", params.merge(photoset_ids: set_ids)
end

#remove_photo(set_id, photo_id, params = {}) ⇒ response



95
96
97
# File 'lib/flickr/api/set.rb', line 95

def remove_photo(set_id, photo_id, params = {})
  post "photosets.removePhoto", params.merge(photoset_id: set_id, photo_id: photo_id)
end

#remove_photos(set_id, photo_ids, params = {}) ⇒ response



85
86
87
# File 'lib/flickr/api/set.rb', line 85

def remove_photos(set_id, photo_ids, params = {})
  post "photosets.removePhotos", params.merge(photoset_id: set_id, photo_ids: photo_ids)
end

#reorder_photos(set_id, photo_ids, params = {}) ⇒ response



115
116
117
# File 'lib/flickr/api/set.rb', line 115

def reorder_photos(set_id, photo_ids, params = {})
  post "photosets.reorderPhotos", params.merge(photoset_id: set_id, photo_ids: photo_ids)
end

#set_primary_photo(set_id, photo_id, params = {}) ⇒ response



125
126
127
# File 'lib/flickr/api/set.rb', line 125

def set_primary_photo(set_id, photo_id, params = {})
  post "photosets.setPrimaryPhoto", params.merge(photoset_id: set_id, photo_id: photo_id)
end