json_api_resource_connecitons 0.1.1 → 0.2.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a43f75ad9e6aefce97807f49f21b05a062cb0c91
|
4
|
+
data.tar.gz: 74d822cdeab78ccfad60080c5f8031b56b7f863c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84b7985d8fa305924e75f07a9bc86b0a3097f6d990de23945d53089aba576a4e992b8b8f87839eedd4aca8995c813af82f3e59174b987c08de38e460fcfc76b9
|
7
|
+
data.tar.gz: dcc59dc372a0383eb4e68d5909c695d674fef7b9b2c05b6bd4af107ef50cdb5006ed62eb693aa22f6433542b97e32f7c1057cb0e34b874516578c472c8302502
|
@@ -25,23 +25,26 @@ module JsonApiResource
|
|
25
25
|
result
|
26
26
|
end
|
27
27
|
|
28
|
-
def
|
28
|
+
def fetch(client, action, *args)
|
29
29
|
key = cache_key(client, action, *args)
|
30
|
-
set = cache.
|
30
|
+
set = cache.fetch key
|
31
|
+
|
32
|
+
raise KeyError.new("#{key} not found") if set.blank?
|
31
33
|
|
32
34
|
# set can be an array of blobs or an array of ids
|
33
|
-
set.map do |item|
|
35
|
+
set.map! do |item|
|
34
36
|
# if the results are ids
|
35
37
|
if item.is_a? Integer
|
36
38
|
# grab the actual object from cache
|
37
39
|
key = item_cache_key(client, action, item)
|
38
|
-
cache.
|
40
|
+
cache.fetch key
|
39
41
|
# if they are not ids
|
40
42
|
else
|
41
43
|
# they have to be the full objects. return them
|
42
44
|
item
|
43
45
|
end
|
44
46
|
end
|
47
|
+
JsonApiClient::ResultSet.new(Array(set))
|
45
48
|
end
|
46
49
|
|
47
50
|
private
|
@@ -62,7 +65,7 @@ module JsonApiResource
|
|
62
65
|
def ordered_args(*args)
|
63
66
|
args.map do |arg|
|
64
67
|
arg.is_a?(Hash) ? arg.sort.to_h : arg
|
65
|
-
end
|
68
|
+
end
|
66
69
|
end
|
67
70
|
|
68
71
|
def splitable?(result_set)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json_api_resource_connecitons
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|