flickr_vision 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/flickr_vision.rb +21 -0
- metadata +1 -1
data/lib/flickr_vision.rb
CHANGED
@@ -33,6 +33,27 @@ class FlickrVision
|
|
33
33
|
return result
|
34
34
|
end
|
35
35
|
|
36
|
+
def get_photo(photo_id)
|
37
|
+
uri = URI(API_URL + "method=flickr.photos.getInfo" + "&api_key=" + self.app_id + "&photo_id=" + photo_id + "&user_id=" + self.user_id)
|
38
|
+
|
39
|
+
response = Net::HTTP.start(uri.host, uri.port,:use_ssl => uri.scheme == 'https',:verify_mode => OpenSSL::SSL::VERIFY_NONE) do |https|
|
40
|
+
request = Net::HTTP::Get.new uri.request_uri
|
41
|
+
https.request(request)
|
42
|
+
end
|
43
|
+
|
44
|
+
flickrPhoto = FlickrPhoto.new
|
45
|
+
doc = REXML::Document.new(response.body)
|
46
|
+
doc.elements.each('rsp/photo') do |photo|
|
47
|
+
flickrPhoto.id = photo.attributes["id"]
|
48
|
+
flickrPhoto.farm_id = photo.attributes["farm"]
|
49
|
+
flickrPhoto.server_id = photo.attributes["server"]
|
50
|
+
flickrPhoto.secret = photo.attributes["secret"]
|
51
|
+
flickrPhoto.title = photo.elements["title"]
|
52
|
+
flickrPhoto.description = photo.elements["description"]
|
53
|
+
end
|
54
|
+
return flickrPhoto
|
55
|
+
end
|
56
|
+
|
36
57
|
def get_photos(photoset_id, per_page, page)
|
37
58
|
if per_page == nil
|
38
59
|
url = API_URL + "method=flickr.photosets.getPhotos" + "&api_key=" + self.app_id + "&photoset_id=" + photoset_id + "&extras=date_upload"
|