fotolia_rails 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/lib/fotolia_rails.rb CHANGED
@@ -9,11 +9,17 @@ module FotoliaRails
9
9
  end
10
10
 
11
11
  def search_object(id)
12
- uri = URI.parse("http://#{@api_key}@api.fotolia.com/Rest/1/media/getMediaData?id=#{id}")
13
- http = Net::HTTP.new(uri.host, uri.port)
14
- request = Net::HTTP::Get.new(uri.request_uri)
15
- response = http.request(request)
16
- return JSON.parse(response.body)
12
+ url = URI.parse("http://#{@api_key}@api.fotolia.com/Rest/1/media/getMediaData?id=#{id}")
13
+ req = Net::HTTP::Get.new(url.path)
14
+ res = Net::HTTP.start(url.host, url.port) {|http|
15
+ http.request(req)
16
+ }
17
+ return JSON.parse(res.body)
18
+ #uri = URI.parse("http://#{@api_key}@api.fotolia.com/Rest/1/media/getMediaData?id=#{id}")
19
+ #http = Net::HTTP.new(uri.host, uri.port)
20
+ #request = Net::HTTP::Get.new(uri.request_uri)
21
+ #response = http.request(request)
22
+ #return JSON.parse(response.body)
17
23
  end
18
24
  end
19
25
  end
@@ -1,3 +1,3 @@
1
1
  module FotoliaRails
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fotolia_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: