standardapi 1.0.21 → 1.0.22

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/standard_api/includes.rb +9 -1
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ef0aa98997ab3c271fa9882316baea8f8938055e
4
- data.tar.gz: 804d221520ba66b22af9b0bb782b74008caff663
3
+ metadata.gz: 0c235c68ca069d23f7a7bab6cacf6c3c0437731d
4
+ data.tar.gz: ee26ab2fc982ac69b49089d7d11145e4a06a0d21
5
5
  SHA512:
6
- metadata.gz: 565c6b0391f52b397aa037c1d2d6408f912476c162af5f2832417b007745757cfa4387125b3625f3be61717cbc2805183ed0bbfc71e81843d5540531d9cd0694
7
- data.tar.gz: eda8718a1494c8661e48f1e8a87dde451f44a098a7e030db89e606d3534b07f15cebb67150be3659006be61ce1d2dea9f0c870fe0c44a57f2309b334a5689202
6
+ metadata.gz: 1a87e9d682ef1c5b5c5881bd959fff6ee97ae76832e9ca2d04bd73e1455b28a2aebaa52db10b2485da1360209c2a0bba7ad9ff5c23daf7548018c5a3a97dd730
7
+ data.tar.gz: 8088daf1b652f27db181021b391e5b2457a67e2a69c354321947296cffb5984abcb766f759026befed6be50238053c9eb9aabe1992cd72fcbb3513ed14215f24
@@ -7,6 +7,8 @@ module StandardAPI
7
7
  # { x: true, y: true } => { x: {}, y: {} }
8
8
  # { x: { y: true } } => { x: { y: {} } }
9
9
  # { x: [:y] } => { x: { y: {} } }
10
+ # { x: { where: { y: false } } } => { x: { where: { y: false } } }
11
+ # { x: { order: { y: :asc } } } => { x: { order: { y: :asc } } }
10
12
  def self.normalize(includes)
11
13
  normalized = ActiveSupport::HashWithIndifferentAccess.new
12
14
 
@@ -14,7 +16,13 @@ module StandardAPI
14
16
  when Array
15
17
  includes.flatten.compact.each { |v| normalized.merge!(normalize(v)) }
16
18
  when Hash
17
- includes.each_pair { |k, v| normalized[k] = normalize(v) }
19
+ includes.each_pair do |k, v|
20
+ if ['where', 'order'].include?(k.to_s) # Where and order are not normalized
21
+ normalized[k] = v
22
+ else
23
+ normalized[k] = normalize(v)
24
+ end
25
+ end
18
26
  when nil
19
27
  {}
20
28
  else
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standardapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.21
4
+ version: 1.0.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Bracy