logical_model 0.7.3 → 0.7.5
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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/logical_model/rest_actions.rb +3 -5
- data/lib/typhoeus_fix/array_decoder.rb +7 -2
- data/logical_model.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c54ee15e0413bd22ec9565523d2c9717913acc6475dbb65c0a130fb8b74cb1b
|
4
|
+
data.tar.gz: e74b18396a817b26aef40359788048e5a58c78c71cd43c2ad0de44cca6626b6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92209ab1bf6f806bf873cba8baa7e56753e0ddf68d7fcec333760e622b180f868dbdfaa47beae8b7b535aa39dc7b8ed23b6882e1a02147c671480063d144377a
|
7
|
+
data.tar.gz: 28693c7d61c83359dd9fbfe6b9056f74a86f4aeac28bc4913656bfb78404243db76d5dc45050326a6a32a77ee8c34ea85ca3217e41b0c84972ecbf61ba14701d
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.6
|
@@ -236,11 +236,9 @@ class LogicalModel
|
|
236
236
|
# this paginate is will_paginate's Array pagination
|
237
237
|
collection = Kaminari.paginate_array(
|
238
238
|
result_set[:collection],
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
:offset => options[:per_page] * ([options[:page], 1].max - 1)
|
243
|
-
}
|
239
|
+
limit: options[:per_page],
|
240
|
+
offset: options[:per_page] * ([options[:page], 1].max - 1),
|
241
|
+
total_count: result_set[:total]
|
244
242
|
)
|
245
243
|
|
246
244
|
yield collection
|
@@ -33,9 +33,9 @@ module TyphoeusFix
|
|
33
33
|
#
|
34
34
|
# @return [Hash] Hash with properly decoded nested arrays.
|
35
35
|
def decode!(hash)
|
36
|
-
return hash unless
|
36
|
+
return hash unless is_hash?(hash)
|
37
37
|
hash.each_pair do |key,value|
|
38
|
-
if
|
38
|
+
if is_hash?(value)
|
39
39
|
decode!(value)
|
40
40
|
hash[key] = convert(value)
|
41
41
|
end
|
@@ -49,6 +49,10 @@ module TyphoeusFix
|
|
49
49
|
|
50
50
|
private
|
51
51
|
|
52
|
+
def is_hash?(hash)
|
53
|
+
hash.is_a?(Hash) || hash.is_a?(HashWithIndifferentAccess) || hash.is_a?(ActionController::Parameters)
|
54
|
+
end
|
55
|
+
|
52
56
|
# Checks if Hash is an Array encoded as a Hash.
|
53
57
|
# Specifically will check for the Hash to have this
|
54
58
|
# form: {'0' => v0, '1' => v1, .., 'n' => vN }
|
@@ -74,6 +78,7 @@ module TyphoeusFix
|
|
74
78
|
# @return [Arraya/Hash]
|
75
79
|
def convert(hash)
|
76
80
|
if encoded?(hash)
|
81
|
+
hash = hash.to_unsafe_h if hash.respond_to?(:to_unsafe_h)
|
77
82
|
Hash[hash.sort_by{|k,v|k.to_i}].values
|
78
83
|
else
|
79
84
|
hash
|
data/logical_model.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logical_model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dwayne Macgowan
|
@@ -301,7 +301,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
301
301
|
- !ruby/object:Gem::Version
|
302
302
|
version: '0'
|
303
303
|
requirements: []
|
304
|
-
rubygems_version: 3.
|
304
|
+
rubygems_version: 3.3.7
|
305
305
|
signing_key:
|
306
306
|
specification_version: 4
|
307
307
|
summary: LogicalModel allows to use a resource as a model.
|