Module: EyeEmConnector::Client::Photos

Included in:
EyeEmConnector::Client
Defined in:
lib/EyeEmConnector/models/photos.rb

Instance Method Summary collapse

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",options.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,options={}) #expects file object, valid image types not defined in the api
  response = post("photos",options.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,message,options={})
  response = post("photos/#{photo_id}/comments",options.merge(:message => 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",options.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,options={})
  response = put("photos/#{photo_id}/likers/#{liker_id}",options,true)
end

#photo(id, options = {}) ⇒ Object



15
16
17
18
# File 'lib/EyeEmConnector/models/photos.rb', line 15

def photo(id,options={})
  response = get('photos/'+id.to_s,options)
  response.body
end

#photo_albums(id, options = {}) ⇒ Object



39
40
41
42
# File 'lib/EyeEmConnector/models/photos.rb', line 39

def photo_albums(id,options={})
  response = get('photos/'+id.to_s+'/albums',options)
  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,options={})
  response = get("photos/#{photo_id.to_s}/comments/#{contributer_id}",options)
  response.body
end

#photo_comments(id, options = {}) ⇒ Object



29
30
31
32
# File 'lib/EyeEmConnector/models/photos.rb', line 29

def photo_comments(id,options={})
  response = get('photos/'+id.to_s+'/comments',options)
  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,options={})
  response = get("photos/#{photo_id.to_s}/likers/#{liker_id}",options,true)
end

#photo_likers(id, options = {}) ⇒ Object



20
21
22
23
# File 'lib/EyeEmConnector/models/photos.rb', line 20

def photo_likers(id,options={})
  response = get('photos/'+id.to_s+'/likers',options)
  response.body
end

#photos(options = {}) ⇒ Object

GET Request



10
11
12
13
# File 'lib/EyeEmConnector/models/photos.rb', line 10

def photos(options={}) #access token needed, returns photos of authenticated user
  response = get('photos',options)
  response.body
end

#random_photo(options = {}) ⇒ Object



44
45
46
47
# File 'lib/EyeEmConnector/models/photos.rb', line 44

def random_photo(options={})
  response = get('api/popular/random',options)
  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",options.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}",options,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,options={})
  response = put("photos/#{photo_id}",true)        
end