zanox_api 0.2.1 → 0.2.2

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/zanox_api.rb +6 -1
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8f546ff957ca4861b5e0b7273df670ad7f666c52
4
- data.tar.gz: 2e16f72bc9ba94ae78bf2c4598ab043d51408391
3
+ metadata.gz: 3e455f93feddd568ae8e810d380019e8ce8752be
4
+ data.tar.gz: 7569107dde7f47e9f9f41c89f868ea01a458da9b
5
5
  SHA512:
6
- metadata.gz: 5b908386001667b41f3f92840fd0fd1b730e29d73f2c77b32ce4dcd55681c655cfa6adb02ac85fc9adadd5220429dab09acdc3e25de44c6d5db0eda14f91feb4
7
- data.tar.gz: 718a69edb8959e78f016bb35472b94c0c0426db654745f14dc0f18932260454b648ca7fb4d607ef8a13d330bc4dd1ac9cc92b7ac774435a3d9464a56a488e433
6
+ metadata.gz: 7f5a0c21e355d22d29d8d7927fbccd42dff10cbd4a33bd235825c1b5bf64a860d7ea7e2f1c775e57c954f893d30523bffeeadff3c3fc3a776e4aa9cf77233042
7
+ data.tar.gz: 7fbc458e82d2ca047d18643e4ba871d543f63dae5f61fe85031eae856ae65fec6273f06570bfe3e9fc5076f7bd2119661e612ab13d2d5e3b56745b839c6d8de5
data/lib/zanox_api.rb CHANGED
@@ -30,7 +30,8 @@ module Zanox
30
30
  def self.normalize_response(response)
31
31
  # Convert items to array
32
32
  if response.has_key?(:items)
33
- if response[:items].to_i == 0
33
+ items = response[:items].to_i
34
+ if items == 0
34
35
  response = []
35
36
  else
36
37
  items_key = response.keys.select { |k| k.to_s.end_with?('_items') }.first
@@ -40,6 +41,10 @@ module Zanox
40
41
  item_key = items_key.to_s[0..-2].to_sym
41
42
 
42
43
  response = response[item_key]
44
+
45
+ if items == 1
46
+ response = [response]
47
+ end
43
48
  end
44
49
  end
45
50
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zanox_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emilio Cobos Álvarez