clientele 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dd4cdcb536b1585df339d6c28edaaeaae5f7e800
4
- data.tar.gz: c62346d5f390ac8d3898aaeb8d3f606d156b5853
3
+ metadata.gz: 5ac2a3d1b3ba87a31e5fbdec46e6bc0d2db13cc9
4
+ data.tar.gz: 4af4adace3ee0efb96bf4875e1140537e94790fb
5
5
  SHA512:
6
- metadata.gz: bdaa588aa44d6a9cf4e02b7c99b2b5b6c10a2112ff61521e21b568d7d1f22a49b105306bfc644adc77c73d8a9030200f758acbe07155d47d690d8de8a8c3f92c
7
- data.tar.gz: d199739d7ee10c3e18d8c5d818d393a242f4fd5f835f474e4f15b6c7ac21a320b9169d69efde52444e7ef6acf8e0d7c8c7eff8947e87e9c74fe6ecd594cfbb07
6
+ metadata.gz: e07925ed6078e801f917b755632841f991849619e86c76d6509c937dbd2fcc91169e5091bad75c0da5ed7f21ab99bf83b5efbca2aae5e0aa8be89259724a2616
7
+ data.tar.gz: 20a38b8e284b4d693ab5d912864a3c23262fa8208090eb4bc1c3410c3cdfc6fb8f6daea94624bd70da79aec33b9f7ac6f4478a07e3b944dc3690e1dad805177b
@@ -58,12 +58,12 @@ module Clientele
58
58
  @nested_result_key || result_key
59
59
  end
60
60
 
61
- def build(data, client: nil)
62
- if data.kind_of? Array
61
+ def build(data, client: nil, klass: nil)
62
+ case (klass or data).kind_of? Array
63
63
  data.map do |dataset|
64
64
  build dataset, client: client
65
65
  end
66
- elsif data.kind_of? Hash and data.keys.map(&:to_s).include? method_name.to_s
66
+ elsif (klass or data).kind_of? Hash and data.keys.map(&:to_s).include? result_key.to_s
67
67
  build data.send method_name, client: client
68
68
  else
69
69
  new(data).tap do |instance|
@@ -11,7 +11,7 @@ module Clientele
11
11
  @response = response
12
12
  super(
13
13
  if resource
14
- resource.build response.body, client: client
14
+ resource.build response.body, client: client, klass: response.body.class
15
15
  else
16
16
  response.body
17
17
  end
@@ -1,3 +1,3 @@
1
1
  module Clientele
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clientele
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Keele