flickr_vision 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/flickr_vision.rb +21 -0
  2. 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"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flickr_vision
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: