Module: EyeEmConnector::Client::Photos
- Included in:
- EyeEmConnector::Client
- Defined in:
- lib/EyeEmConnector/models/photos.rb
Instance Method Summary collapse
- #add_photo_to_album(photo_id, album_id) ⇒ Object
- #add_photo_to_topic(photo_id, topic) ⇒ Object
-
#create_photo(photo, options = {}) ⇒ Object
POST.
- #create_photo_comment(photo_id, message, options = {}) ⇒ Object
-
#delete_photo(photo_id) ⇒ Object
DELETE.
- #delete_photo_comment(photo_id, comment_id) ⇒ Object
- #flag_photo(photo_id, offense) ⇒ Object
- #like_photo(photo_id, liker_id, options = {}) ⇒ Object
- #photo(id, options = {}) ⇒ Object
- #photo_albums(id, options = {}) ⇒ Object
- #photo_comment(photo_id, contributer_id, options = {}) ⇒ Object
- #photo_comments(id, options = {}) ⇒ Object
- #photo_liker(photo_id, liker_id, options = {}) ⇒ Object
- #photo_likers(id, options = {}) ⇒ Object
-
#photos(options = {}) ⇒ Object
GET Request.
- #random_photo(options = {}) ⇒ Object
- #remove_photo_to_album(photo_id, album_id) ⇒ Object
-
#share_photo(photo_id, services) ⇒ Object
available services: twitter,facebook,tumblr,flickr,foursquare as comma separated string.
- #unlike_photo(photo_id, liker_id) ⇒ Object
-
#update_photo(photo_id, options = {}) ⇒ Object
PUT.
Instance Method Details
#add_photo_to_album(photo_id, album_id) ⇒ Object
83 84 85 |
# File 'lib/EyeEmConnector/models/photos.rb', line 83 def add_photo_to_album(photo_id,album_id) response = put("photos/#{photo_id}/albums/#{album_id}",true) end |
#add_photo_to_topic(photo_id, topic) ⇒ Object
61 62 63 |
# File 'lib/EyeEmConnector/models/photos.rb', line 61 def add_photo_to_topic(photo_id,topic) response = post("photos/#{photo_id}/topics",.merge(:topic => topic),true) end |
#create_photo(photo, options = {}) ⇒ Object
POST
51 52 53 54 |
# File 'lib/EyeEmConnector/models/photos.rb', line 51 def create_photo(photo,={}) #expects file object, valid image types not defined in the api response = post("photos",.merge(:photo => photo)) response.body end |
#create_photo_comment(photo_id, message, options = {}) ⇒ Object
56 57 58 59 |
# File 'lib/EyeEmConnector/models/photos.rb', line 56 def create_photo_comment(photo_id,,={}) response = post("photos/#{photo_id}/comments",.merge(:message => )) response.body end |
#delete_photo(photo_id) ⇒ Object
DELETE
89 90 91 |
# File 'lib/EyeEmConnector/models/photos.rb', line 89 def delete_photo(photo_id) response = delete("photos/#{photo_id}",true) end |
#delete_photo_comment(photo_id, comment_id) ⇒ Object
97 98 99 |
# File 'lib/EyeEmConnector/models/photos.rb', line 97 def delete_photo_comment(photo_id,comment_id) response = delete("photos/#{photo_id}/comments/#{comment_id}",true) end |
#flag_photo(photo_id, offense) ⇒ Object
65 66 67 |
# File 'lib/EyeEmConnector/models/photos.rb', line 65 def flag_photo(photo_id,offense) response = post("photos/#{photo_id}/flag",.merge(:offense => offense),true) end |
#like_photo(photo_id, liker_id, options = {}) ⇒ Object
79 80 81 |
# File 'lib/EyeEmConnector/models/photos.rb', line 79 def like_photo(photo_id,liker_id,={}) response = put("photos/#{photo_id}/likers/#{liker_id}",,true) end |
#photo(id, options = {}) ⇒ Object
15 16 17 18 |
# File 'lib/EyeEmConnector/models/photos.rb', line 15 def photo(id,={}) response = get('photos/'+id.to_s,) response.body end |
#photo_albums(id, options = {}) ⇒ Object
39 40 41 42 |
# File 'lib/EyeEmConnector/models/photos.rb', line 39 def photo_albums(id,={}) response = get('photos/'+id.to_s+'/albums',) response.body end |
#photo_comment(photo_id, contributer_id, options = {}) ⇒ Object
34 35 36 37 |
# File 'lib/EyeEmConnector/models/photos.rb', line 34 def photo_comment(photo_id,contributer_id,={}) response = get("photos/#{photo_id.to_s}/comments/#{contributer_id}",) response.body end |
#photo_comments(id, options = {}) ⇒ Object
29 30 31 32 |
# File 'lib/EyeEmConnector/models/photos.rb', line 29 def photo_comments(id,={}) response = get('photos/'+id.to_s+'/comments',) response.body end |
#photo_liker(photo_id, liker_id, options = {}) ⇒ Object
25 26 27 |
# File 'lib/EyeEmConnector/models/photos.rb', line 25 def photo_liker(photo_id,liker_id,={}) response = get("photos/#{photo_id.to_s}/likers/#{liker_id}",,true) end |
#photo_likers(id, options = {}) ⇒ Object
20 21 22 23 |
# File 'lib/EyeEmConnector/models/photos.rb', line 20 def photo_likers(id,={}) response = get('photos/'+id.to_s+'/likers',) response.body end |
#photos(options = {}) ⇒ Object
GET Request
10 11 12 13 |
# File 'lib/EyeEmConnector/models/photos.rb', line 10 def photos(={}) #access token needed, returns photos of authenticated user response = get('photos',) response.body end |
#random_photo(options = {}) ⇒ Object
44 45 46 47 |
# File 'lib/EyeEmConnector/models/photos.rb', line 44 def random_photo(={}) response = get('api/popular/random',) response.body end |
#remove_photo_to_album(photo_id, album_id) ⇒ Object
101 102 103 |
# File 'lib/EyeEmConnector/models/photos.rb', line 101 def remove_photo_to_album(photo_id,album_id) response = delete("photos/#{photo_id}/albums/#{album_id}",true) end |
#share_photo(photo_id, services) ⇒ Object
available services: twitter,facebook,tumblr,flickr,foursquare as comma separated string
69 70 71 |
# File 'lib/EyeEmConnector/models/photos.rb', line 69 def share_photo(photo_id,services) #available services: twitter,facebook,tumblr,flickr,foursquare as comma separated string response = post("photos/#{photo_id}/share",.merge(:services => services),true) end |
#unlike_photo(photo_id, liker_id) ⇒ Object
93 94 95 |
# File 'lib/EyeEmConnector/models/photos.rb', line 93 def unlike_photo(photo_id,liker_id) response = delete("photos/#{photo_id}/likers/#{liker_id}",,true) end |
#update_photo(photo_id, options = {}) ⇒ Object
PUT
75 76 77 |
# File 'lib/EyeEmConnector/models/photos.rb', line 75 def update_photo(photo_id,={}) response = put("photos/#{photo_id}",true) end |