amazon-associates 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +5 -1
- data/VERSION.yml +1 -1
- data/amazon-associates.gemspec +1 -1
- data/lib/amazon-associates.rb +3 -1
- data/lib/amazon-associates/request.rb +3 -1
- data/lib/amazon-associates/types/browse_node.rb +4 -0
- metadata +8 -54
- data/.gitignore +0 -3
data/CHANGELOG
CHANGED
data/VERSION.yml
CHANGED
data/amazon-associates.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
|
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ben Woosley", "Dan Pickett", "Herryanto Siatono"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-10-24}
|
13
13
|
s.description = %q{amazon-associates offers object-oriented access to the Amazon Associates API, built on ROXML}
|
14
14
|
s.email = %q{ben.woosley@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/amazon-associates.rb
CHANGED
@@ -78,7 +78,9 @@ module Amazon
|
|
78
78
|
|
79
79
|
protected
|
80
80
|
def self.log(s)
|
81
|
-
if defined?
|
81
|
+
if defined?(Rails) && Rails.respond_to?(:logger)
|
82
|
+
Rails.logger.error(s)
|
83
|
+
elsif defined? RAILS_DEFAULT_LOGGER
|
82
84
|
RAILS_DEFAULT_LOGGER.error(s)
|
83
85
|
elsif defined? LOGGER
|
84
86
|
LOGGER.error(s)
|
@@ -33,6 +33,7 @@ module Amazon
|
|
33
33
|
if opts[:aWS_access_key_id].blank?
|
34
34
|
raise ArgumentError, "amazon-associates requires the :aws_access_key_id option"
|
35
35
|
end
|
36
|
+
log_body = opts.delete(:log)
|
36
37
|
|
37
38
|
request_url = prepare_url(opts)
|
38
39
|
response = nil
|
@@ -43,7 +44,7 @@ module Amazon
|
|
43
44
|
response = FilesystemCache.get(request_url)
|
44
45
|
end
|
45
46
|
|
46
|
-
|
47
|
+
unless response
|
47
48
|
log "Request URL: #{request_url}"
|
48
49
|
|
49
50
|
response = Net::HTTP.get_response(URI::parse(request_url))
|
@@ -54,6 +55,7 @@ module Amazon
|
|
54
55
|
end
|
55
56
|
|
56
57
|
doc = ROXML::XML::Node.from(response.body)
|
58
|
+
log(doc) if log_body
|
57
59
|
eval(doc.name).from_xml(doc, request_url)
|
58
60
|
end
|
59
61
|
|
@@ -11,6 +11,10 @@ module Amazon
|
|
11
11
|
xml_reader :children, :as => [BrowseNode]
|
12
12
|
xml_reader :top_sellers, :as => [Item]
|
13
13
|
|
14
|
+
def self.find(browse_node_id, opts = {}, &block)
|
15
|
+
Amazon::Associates.browse_node_lookup(opts.merge(:browse_node_id => browse_node_id), &block).browse_nodes.first
|
16
|
+
end
|
17
|
+
|
14
18
|
def initialize(id = nil, name = nil, parent = nil)
|
15
19
|
@id = id
|
16
20
|
@name = name
|
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amazon-associates
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 7
|
8
|
-
- 0
|
9
|
-
version: 0.7.0
|
4
|
+
prerelease:
|
5
|
+
version: 0.7.1
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Ben Woosley
|
@@ -16,8 +12,7 @@ autorequire:
|
|
16
12
|
bindir: bin
|
17
13
|
cert_chain: []
|
18
14
|
|
19
|
-
date:
|
20
|
-
default_executable:
|
15
|
+
date: 2011-05-28 00:00:00 Z
|
21
16
|
dependencies:
|
22
17
|
- !ruby/object:Gem::Dependency
|
23
18
|
name: roxml
|
@@ -27,10 +22,6 @@ dependencies:
|
|
27
22
|
requirements:
|
28
23
|
- - ">="
|
29
24
|
- !ruby/object:Gem::Version
|
30
|
-
segments:
|
31
|
-
- 3
|
32
|
-
- 1
|
33
|
-
- 6
|
34
25
|
version: 3.1.6
|
35
26
|
type: :runtime
|
36
27
|
version_requirements: *id001
|
@@ -42,10 +33,6 @@ dependencies:
|
|
42
33
|
requirements:
|
43
34
|
- - ">="
|
44
35
|
- !ruby/object:Gem::Version
|
45
|
-
segments:
|
46
|
-
- 3
|
47
|
-
- 0
|
48
|
-
- 0
|
49
36
|
version: 3.0.0
|
50
37
|
type: :runtime
|
51
38
|
version_requirements: *id002
|
@@ -57,10 +44,6 @@ dependencies:
|
|
57
44
|
requirements:
|
58
45
|
- - ">="
|
59
46
|
- !ruby/object:Gem::Version
|
60
|
-
segments:
|
61
|
-
- 2
|
62
|
-
- 3
|
63
|
-
- 4
|
64
47
|
version: 2.3.4
|
65
48
|
type: :runtime
|
66
49
|
version_requirements: *id003
|
@@ -72,8 +55,6 @@ dependencies:
|
|
72
55
|
requirements:
|
73
56
|
- - ">="
|
74
57
|
- !ruby/object:Gem::Version
|
75
|
-
segments:
|
76
|
-
- 0
|
77
58
|
version: "0"
|
78
59
|
type: :runtime
|
79
60
|
version_requirements: *id004
|
@@ -85,8 +66,6 @@ dependencies:
|
|
85
66
|
requirements:
|
86
67
|
- - ">="
|
87
68
|
- !ruby/object:Gem::Version
|
88
|
-
segments:
|
89
|
-
- 0
|
90
69
|
version: "0"
|
91
70
|
type: :runtime
|
92
71
|
version_requirements: *id005
|
@@ -98,8 +77,6 @@ dependencies:
|
|
98
77
|
requirements:
|
99
78
|
- - ">="
|
100
79
|
- !ruby/object:Gem::Version
|
101
|
-
segments:
|
102
|
-
- 0
|
103
80
|
version: "0"
|
104
81
|
type: :development
|
105
82
|
version_requirements: *id006
|
@@ -111,8 +88,6 @@ dependencies:
|
|
111
88
|
requirements:
|
112
89
|
- - ">="
|
113
90
|
- !ruby/object:Gem::Version
|
114
|
-
segments:
|
115
|
-
- 0
|
116
91
|
version: "0"
|
117
92
|
type: :development
|
118
93
|
version_requirements: *id007
|
@@ -124,10 +99,6 @@ dependencies:
|
|
124
99
|
requirements:
|
125
100
|
- - ">="
|
126
101
|
- !ruby/object:Gem::Version
|
127
|
-
segments:
|
128
|
-
- 2
|
129
|
-
- 0
|
130
|
-
- 0
|
131
102
|
version: 2.0.0
|
132
103
|
type: :development
|
133
104
|
version_requirements: *id008
|
@@ -141,7 +112,6 @@ extra_rdoc_files:
|
|
141
112
|
- LICENSE
|
142
113
|
- README.rdoc
|
143
114
|
files:
|
144
|
-
- .gitignore
|
145
115
|
- CHANGELOG
|
146
116
|
- LICENSE
|
147
117
|
- README.rdoc
|
@@ -190,13 +160,12 @@ files:
|
|
190
160
|
- test/amazon/item_test.rb
|
191
161
|
- test/test_helper.rb
|
192
162
|
- test/utilities/filesystem_test_helper.rb
|
193
|
-
has_rdoc: true
|
194
163
|
homepage: http://github.com/Empact/amazon-associates
|
195
164
|
licenses: []
|
196
165
|
|
197
166
|
post_install_message:
|
198
|
-
rdoc_options:
|
199
|
-
|
167
|
+
rdoc_options: []
|
168
|
+
|
200
169
|
require_paths:
|
201
170
|
- lib
|
202
171
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -204,34 +173,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
204
173
|
requirements:
|
205
174
|
- - ">="
|
206
175
|
- !ruby/object:Gem::Version
|
207
|
-
segments:
|
208
|
-
- 0
|
209
176
|
version: "0"
|
210
177
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
211
178
|
none: false
|
212
179
|
requirements:
|
213
180
|
- - ">="
|
214
181
|
- !ruby/object:Gem::Version
|
215
|
-
segments:
|
216
|
-
- 0
|
217
182
|
version: "0"
|
218
183
|
requirements: []
|
219
184
|
|
220
185
|
rubyforge_project:
|
221
|
-
rubygems_version: 1.
|
186
|
+
rubygems_version: 1.8.4
|
222
187
|
signing_key:
|
223
188
|
specification_version: 3
|
224
189
|
summary: Generic Amazon Associates Web Service (Formerly ECS) REST API. Supports ECS 4.0.
|
225
|
-
test_files:
|
226
|
-
|
227
|
-
- spec/requests/item_search_spec.rb
|
228
|
-
- spec/spec_helper.rb
|
229
|
-
- spec/types/cart_spec.rb
|
230
|
-
- spec/types/item_spec.rb
|
231
|
-
- spec/types/measurement_spec.rb
|
232
|
-
- test/amazon/browse_node_test.rb
|
233
|
-
- test/amazon/cache_test.rb
|
234
|
-
- test/amazon/caching/filesystem_cache_test.rb
|
235
|
-
- test/amazon/item_test.rb
|
236
|
-
- test/test_helper.rb
|
237
|
-
- test/utilities/filesystem_test_helper.rb
|
190
|
+
test_files: []
|
191
|
+
|
data/.gitignore
DELETED