json_api_resource_connecitons 0.1.1 → 0.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1aba17ec5f9227459bf8e23bec368067accc6edd
4
- data.tar.gz: f3f6b5f0e408ef3bf70b028f255de119c2f5c0d9
3
+ metadata.gz: a43f75ad9e6aefce97807f49f21b05a062cb0c91
4
+ data.tar.gz: 74d822cdeab78ccfad60080c5f8031b56b7f863c
5
5
  SHA512:
6
- metadata.gz: 9e752bf28de06193aa6fcd4a72a8a0f44aa8e945aa77d3d0a5d181ae9323683edea024199943c09d6045657dc9db2c0578d49bc797decb2c0cd16f2655362490
7
- data.tar.gz: f36dd5c5ebe717c4d6cb949cfe9eda47e9181c0dbf817e185349280dd438155d34d35cf07a4fbb5873b741d15a58dbbf39549543214323bfefbad59c4de9cff8
6
+ metadata.gz: 84b7985d8fa305924e75f07a9bc86b0a3097f6d990de23945d53089aba576a4e992b8b8f87839eedd4aca8995c813af82f3e59174b987c08de38e460fcfc76b9
7
+ data.tar.gz: dcc59dc372a0383eb4e68d5909c695d674fef7b9b2c05b6bd4af107ef50cdb5006ed62eb693aa22f6433542b97e32f7c1057cb0e34b874516578c472c8302502
@@ -7,7 +7,7 @@ module JsonApiResource
7
7
  result
8
8
  end
9
9
 
10
- def read( client, action, *args )
10
+ def fetch( client, action, *args )
11
11
  []
12
12
  end
13
13
  end
@@ -25,23 +25,26 @@ module JsonApiResource
25
25
  result
26
26
  end
27
27
 
28
- def read(client, action, *args)
28
+ def fetch(client, action, *args)
29
29
  key = cache_key(client, action, *args)
30
- set = cache.read key
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.read key
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.sort
68
+ end
66
69
  end
67
70
 
68
71
  def splitable?(result_set)
@@ -16,7 +16,7 @@ module JsonApiResource
16
16
  end
17
17
 
18
18
  def request( action, *args )
19
- cache_processor.read client, action, *args
19
+ cache_processor.fetch client, action, *args
20
20
  end
21
21
  end
22
22
  end
@@ -1,3 +1,3 @@
1
1
  module JsonApiResourceConnecitons
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.1"
3
3
  end
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.1.1
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-15 00:00:00.000000000 Z
11
+ date: 2016-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport