json_api_resource_connections 0.2.3 → 0.3.0

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: b177657fab9e94a6d99342a765b5a0dd66851e40
4
- data.tar.gz: c4197d9d7d4adc9394fb5bb8da5da22c9ae13448
3
+ metadata.gz: 5464f3db319f337b50a49b11d643c6b667b25f24
4
+ data.tar.gz: 849c3f3dc0eebc242e7fa0b24a29bd5ca1b0a1db
5
5
  SHA512:
6
- metadata.gz: a133ecb64dfd9e76246473f4f51e5dee3890c4c931d7d15555cc52eeb1cf624c8dd5d07d8f80cef2a3869750297bc5d9ffc3a110006733790b190df89b0efb1e
7
- data.tar.gz: bbfab1ee3dae9871c7e647b9255b78b943c4d02841ae44939a1bf10a96645d7b322a0e37dca4ba543a28c38936d45580b2cf87bb960998d11037cf84cd1eadaf
6
+ metadata.gz: 58861256f912031c5364396f1d7d1d2dbab728c77a095809176683f597706cd1ac4b3a428e3dd02e9a290b50848f8dfc47379cf97d50bf0c7e3a04ac5fd3aa83
7
+ data.tar.gz: bbc346515f3454d659f8c3edb5e144e73629b2a9e98f614566bc54a4a1c25ca037423698d50d4333252ab315366bbaf869c1e40aa646309013ff0d1ae0da2258
@@ -28,9 +28,23 @@ module JsonApiResourceConnections
28
28
  class_attribute :_fallbacks
29
29
  self._fallbacks = []
30
30
 
31
+ class_attribute :_cache_first
32
+ self._cache_first = []
33
+
31
34
  def cache_fallback(*actions)
32
35
  self._fallbacks = _fallbacks + Array(actions)
33
- add_connection JsonApiResource::Connections::CacheConnection, client: self.client_class, only: self._fallbacks
36
+ options = { client: self.client_class }
37
+ options[:only] = self._fallbacks if self._fallbacks.present?
38
+
39
+ add_connection JsonApiResource::Connections::CacheConnection, options
40
+ end
41
+
42
+ def try_cache_first(*actions)
43
+ self._cache_first = _cache_first + Array(actions)
44
+ options = { client: self.client_class }
45
+ options[:only] = self._cache_first if self._cache_first.present?
46
+
47
+ prepend_connection JsonApiResource::Connections::CacheConnection, options
34
48
  end
35
49
 
36
50
  def wraps(client)
@@ -1,3 +1,3 @@
1
1
  module JsonApiResourceConnections
2
- VERSION = "0.2.3"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_api_resource_connections
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.0
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-20 00:00:00.000000000 Z
11
+ date: 2016-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport