fotolia_rails 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.
@@ -1,3 +1,3 @@
1
1
  module FotoliaRails
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/fotolia_rails.rb CHANGED
@@ -9,17 +9,12 @@ module FotoliaRails
9
9
  end
10
10
 
11
11
  def search_object(id)
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)
12
+ url = URI.parse("http://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
+ request.basic_auth("#{@api_key}", "")
16
+ response = http.request(request)
17
+ return JSON.parse(response.body)
23
18
  end
24
19
  end
25
20
  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.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: