clientele 0.3.4 → 0.3.5

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: 5ac2a3d1b3ba87a31e5fbdec46e6bc0d2db13cc9
4
- data.tar.gz: 4af4adace3ee0efb96bf4875e1140537e94790fb
3
+ metadata.gz: bf35f41aec66613763efd57e96b0133aa1575c09
4
+ data.tar.gz: 5a18a2f492750d10f0a70eb28cf5632a8ebf575b
5
5
  SHA512:
6
- metadata.gz: e07925ed6078e801f917b755632841f991849619e86c76d6509c937dbd2fcc91169e5091bad75c0da5ed7f21ab99bf83b5efbca2aae5e0aa8be89259724a2616
7
- data.tar.gz: 20a38b8e284b4d693ab5d912864a3c23262fa8208090eb4bc1c3410c3cdfc6fb8f6daea94624bd70da79aec33b9f7ac6f4478a07e3b944dc3690e1dad805177b
6
+ metadata.gz: 879994c740dc32c41dfc00a4f5c0273f949412c24b3bbe08da3fb54d972b3a3a74472838e1f9a13cd1196863200cec98a2d289ae6d06d4e6e8abb69be61c9230
7
+ data.tar.gz: f338fb9aea534ca80aaa322859d7bd7c749424c01d7bbd831eb81472cf802b0c4501c4875d24e3f4f6b6ca57d5f235d26fac01da94b4e42c386b5c9c02c53a48
@@ -51,13 +51,21 @@ module Clientele
51
51
  end
52
52
 
53
53
  def result_key
54
- @result_key || method_name
54
+ @result_key || method_name.singularize
55
+ end
56
+
57
+ def plural_key
58
+ @plural_key || method_name
55
59
  end
56
60
 
57
61
  def nested_result_key
58
62
  @nested_result_key || result_key
59
63
  end
60
64
 
65
+ def nested_plural_key
66
+ @nested_plural_key || plural_key
67
+ end
68
+
61
69
  def build(data, client: nil, klass: nil)
62
70
  case (klass or data).kind_of? Array
63
71
  data.map do |dataset|
@@ -65,6 +73,8 @@ module Clientele
65
73
  end
66
74
  elsif (klass or data).kind_of? Hash and data.keys.map(&:to_s).include? result_key.to_s
67
75
  build data.send method_name, client: client
76
+ elsif (klass or data).kind_of? Hash and data.keys.map(&:to_s).include? plural_key.to_s
77
+ build data.send method_name, client: client
68
78
  else
69
79
  new(data).tap do |instance|
70
80
  instance.instance_variable_set :@client, client if client
@@ -1,3 +1,3 @@
1
1
  module Clientele
2
- VERSION = "0.3.4"
2
+ VERSION = "0.3.5"
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.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Keele