cb-api 1.1.7 → 1.1.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -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]
@@ -1,3 +1,3 @@
1
1
  module Cb
2
- VERSION = '1.1.7'
2
+ VERSION = '1.1.8'
3
3
  end
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.7
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-10 00:00:00.000000000 Z
22
+ date: 2013-12-17 00:00:00.000000000 Z
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency
25
25
  name: httparty