cb-api 1.1.7 → 1.1.8
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/lib/cb/utils/response_array_extractor.rb +10 -0
- data/lib/cb/version.rb +1 -1
- metadata +2 -2
|
@@ -15,6 +15,8 @@ module Cb
|
|
|
15
15
|
def extract
|
|
16
16
|
if response_has_collection?
|
|
17
17
|
extract_array_from_collection
|
|
18
|
+
elsif response_has_array?
|
|
19
|
+
build_array_from_delimited_values
|
|
18
20
|
else
|
|
19
21
|
[]
|
|
20
22
|
end
|
|
@@ -22,10 +24,18 @@ module Cb
|
|
|
22
24
|
|
|
23
25
|
private
|
|
24
26
|
|
|
27
|
+
def response_has_array?
|
|
28
|
+
!@response_hash[@key].nil? && @response_hash[@key].class != Hash
|
|
29
|
+
end
|
|
30
|
+
|
|
25
31
|
def response_has_collection?
|
|
26
32
|
!@response_hash[@key].nil? && !@response_hash[@key][@singular_key].nil?
|
|
27
33
|
end
|
|
28
34
|
|
|
35
|
+
def build_array_from_delimited_values
|
|
36
|
+
@response_hash[@key].split(',')
|
|
37
|
+
end
|
|
38
|
+
|
|
29
39
|
def extract_array_from_collection
|
|
30
40
|
if @response_hash[@key][@singular_key].is_a?(Array)
|
|
31
41
|
@response_hash[@key][@singular_key]
|
data/lib/cb/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cb-api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.8
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -19,7 +19,7 @@ authors:
|
|
|
19
19
|
autorequire:
|
|
20
20
|
bindir: bin
|
|
21
21
|
cert_chain: []
|
|
22
|
-
date: 2013-12-
|
|
22
|
+
date: 2013-12-17 00:00:00.000000000 Z
|
|
23
23
|
dependencies:
|
|
24
24
|
- !ruby/object:Gem::Dependency
|
|
25
25
|
name: httparty
|