briandunn-a2ws 0.1.11 → 0.1.12
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.
- data/a2ws.gemspec +1 -1
- data/lib/a2ws/base.rb +16 -2
- data/lib/a2ws/image_search.rb +2 -2
- data/lib/a2ws/item_search.rb +4 -1
- data/lib/a2ws.rb +2 -1
- metadata +1 -1
data/a2ws.gemspec
CHANGED
data/lib/a2ws/base.rb
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
module A2WS
|
|
2
2
|
class Base
|
|
3
3
|
include HTTParty
|
|
4
|
+
extend Signature
|
|
4
5
|
base_uri 'http://ecs.amazonaws.com'
|
|
5
6
|
default_params :Service => 'AWSECommerceService', :Operation => 'ItemSearch'
|
|
7
|
+
@@secret_key = ''
|
|
6
8
|
|
|
7
9
|
def self.configure
|
|
8
10
|
yield self
|
|
@@ -11,9 +13,21 @@ module A2WS
|
|
|
11
13
|
def self.api_key=(key)
|
|
12
14
|
default_params :AWSAccessKeyId => key
|
|
13
15
|
end
|
|
14
|
-
|
|
16
|
+
|
|
17
|
+
def self.secret_key=(key)
|
|
18
|
+
@@secret_key = key
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def self.secret_key
|
|
22
|
+
@@secret_key
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def self.request_uri
|
|
26
|
+
'/onca/xml'
|
|
27
|
+
end
|
|
28
|
+
|
|
15
29
|
private
|
|
16
|
-
|
|
30
|
+
|
|
17
31
|
def self.downcase_keys(hash)
|
|
18
32
|
new_hash = {}
|
|
19
33
|
hash.keys.each do |key|
|
data/lib/a2ws/image_search.rb
CHANGED
|
@@ -4,7 +4,7 @@ module A2WS
|
|
|
4
4
|
class ImageSearch < Base
|
|
5
5
|
|
|
6
6
|
def self.find(item)
|
|
7
|
-
items = get(
|
|
7
|
+
items = get(request_url, :query => {:ItemId => item, :Operation => "ItemLookup", :ResponseGroup => "Images"})
|
|
8
8
|
puts items.inspect
|
|
9
9
|
if items['ItemLookupResponse']["Items"]["Request"]['IsValid'] == 'True'
|
|
10
10
|
items["ItemLookupResponse"]["Items"]["Item"].delete("ImageSets")
|
|
@@ -18,4 +18,4 @@ module A2WS
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
end
|
|
21
|
+
end
|
data/lib/a2ws/item_search.rb
CHANGED
|
@@ -4,7 +4,10 @@ module A2WS
|
|
|
4
4
|
|
|
5
5
|
def self.find(keywords, search_index = :All, options = {})
|
|
6
6
|
options.merge!({:Keywords => keywords, :SearchIndex => search_index})
|
|
7
|
-
|
|
7
|
+
query = sign_request(options)
|
|
8
|
+
puts query.inspect
|
|
9
|
+
result = get( request_uri, :query => query )
|
|
10
|
+
puts result.inspect
|
|
8
11
|
|
|
9
12
|
items = result["ItemSearchResponse"]["Items"]
|
|
10
13
|
if items['Request']['IsValid'] == 'True'
|
data/lib/a2ws.rb
CHANGED
|
@@ -4,9 +4,10 @@ require 'activesupport'
|
|
|
4
4
|
require 'pp'
|
|
5
5
|
|
|
6
6
|
$:.unshift File.join(File.dirname(__FILE__),'..','lib')
|
|
7
|
+
require 'a2ws/signature'
|
|
7
8
|
require 'a2ws/base'
|
|
8
9
|
require 'a2ws/methodize'
|
|
9
10
|
require 'a2ws/item'
|
|
10
11
|
require 'a2ws/image'
|
|
11
12
|
require 'a2ws/item_search'
|
|
12
|
-
require 'a2ws/image_search'
|
|
13
|
+
require 'a2ws/image_search'
|