Class: Grin::Album
Constant Summary
Constants inherited from Client
Client::API_VERSION, Client::DOMAIN
Instance Method Summary collapse
- #create_photo(image_data) ⇒ Object
- #destroy ⇒ Object
- #find_or_create_photo(filename, image_data) ⇒ Object
-
#initialize(data) ⇒ Album
constructor
A new instance of Album.
- #photo(photo_id) ⇒ Object
- #photos ⇒ Object
Methods inherited from Client
#album, #albums, #categories, #category, #create_album, #create_category, #find_or_create_album, #find_or_create_category
Constructor Details
Instance Method Details
#create_photo(image_data) ⇒ Object
28 29 30 |
# File 'lib/grin/album.rb', line 28 def create_photo(image_data) post("albums/#{id}/photos.json", { :photo => { :image => image_data } }) end |
#destroy ⇒ Object
40 41 42 |
# File 'lib/grin/album.rb', line 40 def destroy delete("albums/#{id}.json") end |
#find_or_create_photo(filename, image_data) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/grin/album.rb', line 32 def find_or_create_photo(filename, image_data) if photo = photos.select { |p| p.filename == filename }.pop return photo else create_photo(image_data) end end |