rapa 0.5.0 → 0.5.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ba56ed4d0f79d06ce45915f60dc5ed2fd6ac38f3
4
- data.tar.gz: 86c164c8995ab818595635f083ceaca0d35dda73
3
+ metadata.gz: f5b7038a1d2e0b226439d25014351907abaef445
4
+ data.tar.gz: f01f0f430853d80866438add0bf6169460f70774
5
5
  SHA512:
6
- metadata.gz: f21d89d645bc4fd1946c65814c8d244c50f8a1e3e3c17a137e41e86853093b9e99e73f19f0a06ca0bb31eb37c05bf243a0f28658173238e9693b30649d241308
7
- data.tar.gz: 529162027e85321d942ad5b792de862cc8c9044446d1cc05c0e23e082d3f81cd20c4549689f3f6ceca84533ec41d20abfd71004be4d755db2982f64648cd3b17
6
+ metadata.gz: 313c277bd07d18f745505fc190e28bc2ebaaba6f10f00cc47599d91ebb3733a80d47e0c9310f0a1bce2ba3907c05d5a2577e094492bd86bc8a2487a10f436dec
7
+ data.tar.gz: 67685e16f114e00f536af1028d72c1b53ef88c7b11c42dcf0c31d188723437d1e5cd63832bd9dd11be847cac2f53fa51616f77237b95906b9ea34efb9ee271cd
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## v0.5.1
2
+
3
+ - Fix `Rapa::Resources::ItemResource#alternate_versions` type
4
+ - Fix `Rapa::Resources::ItemResource#authors` type
5
+ - Fix `Rapa::Resources::ItemResource#browse_nodes` type
6
+ - Fix `Rapa::Resources::ItemResource#languages` type
7
+ - Fix `Rapa::Resources::ItemResource#related_items` type
8
+ - Fix `Rapa::Resources::ItemResource#similar_products` type
9
+
1
10
  ## v0.5.0
2
11
 
3
12
  - Change `Rapa::Resources::ItemResource#browse_nodes` returned value type
@@ -10,12 +10,17 @@ module Rapa
10
10
  end
11
11
  end
12
12
 
13
- # @return [Array<Rapa::AlternateVersion>, nil]
13
+ # @return [Array<Rapa::AlternateVersion>]
14
14
  def alternate_versions
15
- if alternate_version_sources = source.dig("AlternateVersions", "AlternateVersion")
16
- ::Array.wrap(alternate_version_sources).map do |alternate_version_source|
17
- ::Rapa::AlternateVersion.new(alternate_version_source)
18
- end
15
+ case alternate_version_source_or_sources = source.dig("AlternateVersions", "AlternateVersion")
16
+ when ::Array
17
+ alternate_version_source_or_sources
18
+ when ::Hash
19
+ [alternate_version_source_or_sources]
20
+ else
21
+ []
22
+ end.map do |alternate_version_source|
23
+ ::Rapa::AlternateVersion.new(alternate_version_source)
19
24
  end
20
25
  end
21
26
 
@@ -24,10 +29,15 @@ module Rapa
24
29
  source["ASIN"]
25
30
  end
26
31
 
27
- # @return [Array<String>, nil]
32
+ # @return [Array<String>]
28
33
  def authors
29
- if author_sources = source.dig("ItemAttributes", "Author")
30
- Array(author_sources)
34
+ case author_source_or_sources = source.dig("ItemAttributes", "Author")
35
+ when ::Array
36
+ author_source_or_sources
37
+ when ::String
38
+ [author_source_or_sources]
39
+ else
40
+ []
31
41
  end
32
42
  end
33
43
 
@@ -36,9 +46,16 @@ module Rapa
36
46
  source.dig("ItemAttributes", "Binding")
37
47
  end
38
48
 
39
- # @return [Array, nil]
49
+ # @return [Array<Rapa::BrowseNode>]
40
50
  def browse_nodes
41
- source.dig("BrowseNodes", "BrowseNode").map do |browse_node_source|
51
+ case browse_node_source_or_sources = source.dig("BrowseNodes", "BrowseNode")
52
+ when ::Array
53
+ browse_node_source_or_sources
54
+ when ::Hash
55
+ [browse_node_source_or_sources]
56
+ else
57
+ []
58
+ end.map do |browse_node_source|
42
59
  ::Rapa::BrowseNode.new(browse_node_source)
43
60
  end
44
61
  end
@@ -146,12 +163,17 @@ module Rapa
146
163
  source.dig("ItemAttributes", "Label")
147
164
  end
148
165
 
149
- # @return [Array<Rapa::Language>, nil]
166
+ # @return [Array<Rapa::Language>]
150
167
  def languages
151
- if language_sources = source.dig("ItemAttributes", "Languages", "Language")
152
- language_sources.map do |language_source|
153
- ::Rapa::Language.new(language_source)
154
- end
168
+ case language_source_or_sources = source.dig("ItemAttributes", "Languages", "Language")
169
+ when ::Array
170
+ language_source_or_sources
171
+ when ::Hash
172
+ [language_source_or_sources]
173
+ else
174
+ []
175
+ end.map do |language_source|
176
+ ::Rapa::Language.new(language_source)
155
177
  end
156
178
  end
157
179
 
@@ -238,16 +260,17 @@ module Rapa
238
260
  end
239
261
  end
240
262
 
241
- # @return [Array<Rapa::Resources::ItemResource>, nil]
263
+ # @return [Array<Rapa::Resources::ItemResource>]
242
264
  def related_items
243
- if source_or_sources = source.dig("RelatedItems", "RelatedItem")
244
- if source_or_sources.is_a?(::Array)
245
- source_or_sources
246
- else
247
- [source_or_sources]
248
- end.map do |related_item_source|
249
- ::Rapa::Resources::ItemResource.new(related_item_source["Item"])
250
- end
265
+ case item_source_or_sources = source.dig("RelatedItems", "RelatedItem")
266
+ when ::Array
267
+ item_source_or_sources
268
+ when ::Hash
269
+ [item_source_or_sources]
270
+ else
271
+ []
272
+ end.map do |related_item_source|
273
+ ::Rapa::Resources::ItemResource.new(related_item_source["Item"])
251
274
  end
252
275
  end
253
276
 
@@ -287,12 +310,17 @@ module Rapa
287
310
  end
288
311
  end
289
312
 
290
- # @return [Array<Rapa::SimilarProduct>, nil]
313
+ # @return [Array<Rapa::SimilarProduct>]
291
314
  def similar_products
292
- if similar_product_sources = source["SimilarProducts"]
293
- similar_product_sources.map do |similar_product_source|
294
- ::Rapa::SimilarProduct.new(similar_product_source)
295
- end
315
+ case similar_product_source_or_sources = source["SimilarProducts"]
316
+ when ::Array
317
+ similar_product_sources
318
+ when ::Hash
319
+ [similar_product_source_or_sources]
320
+ else
321
+ []
322
+ end.map do |similar_product_source|
323
+ ::Rapa::SimilarProduct.new(similar_product_source)
296
324
  end
297
325
  end
298
326
 
data/lib/rapa/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rapa
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rapa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura