api-response-cache 0.4.2 → 0.4.3

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
  SHA256:
3
- metadata.gz: b9127ce0b56c2dbfd7336589c2ec2e26b3ca2997bc1aa4e0099ad4396e4dc713
4
- data.tar.gz: 28b202ac6d5faec27df4a096711758c7e9d39ba98c15b0915cad3e6e138c37b1
3
+ metadata.gz: 92ae9876badd7c10eba5260f8a725c90f8719352d154c211ed1c9673db158134
4
+ data.tar.gz: 4410d78e70c18911bc0131c9cc5649bfd3b359668249b900a47e756ec0a84bf4
5
5
  SHA512:
6
- metadata.gz: a1d5d63d22e337b68eda2cc4996d26eddf33621df0e16c58f9e236dc9b14f98caa505764b89d0b9719bcdf18f76d90388e2dc526133c29a0a184399a0b3edad3
7
- data.tar.gz: a2ebc0a03432439298c47fb47d1b6c56b9b6f2cbadefdab9d71ab31eb5164ce2ba8a630f64dbc7cb4f63f822d205535d28e5c35b24eba6e01533bc42a112eb5b
6
+ metadata.gz: c1ebbef4f266925f62cadc9c5985a82244025d0a4da3511c5bc6aa964af4a56d717c2df2ef8bd74d6e8d8d088d0b5d28f641ac6bbc405581e4386d2e4e918152
7
+ data.tar.gz: daf37af1b2a8ebd32d586287a7d97545c5af9f2f370d9ce5f4091eac4635afc18397108789eb8b6766d7f7add0aa36edb4d94ae8ac16db2ef10d4e230e2d52c5
@@ -14,7 +14,7 @@ module ApiResponseCache
14
14
  render_cached_response
15
15
  else
16
16
  yield
17
- @response_cache.write_cache(controller.response)
17
+ @response_cache.write_cache(controller.response) if @request.get?
18
18
  end
19
19
  end
20
20
 
@@ -25,23 +25,27 @@ module ApiResponseCache
25
25
  end
26
26
 
27
27
  def log_info
28
- processor = @processor_name.blue
29
- responder = Rainbow('API Response Cache').green
28
+ processor = "#{@controller.class.name}##{@controller.action_name}".blue
29
+ responder = Rainbow('API Response Cache').green
30
30
  Rails.logger.info "=== #{processor} response by #{responder} ==="
31
31
  end
32
32
 
33
33
  def init(controller)
34
34
  @controller = controller
35
35
  @request = controller.request
36
- @processor_name = "#{@controller.class.name}##{@controller.action_name}"
37
36
  @response_cache = ResponseCache.new(cache_path, @expires_in)
38
37
  end
39
38
 
40
39
  def cache_path
41
- @cache_path = "api-response-cache/#{@processor_name || @options[:cache_path]}"
40
+ @cache_path = "api-response-cache"
42
41
 
43
- if ApiResponseCache.configuration.refresh_by_request_params?
44
- @cache_path = "#{@cache_path}#{@request.fullpath}"
42
+ if @options[:cache_path].present?
43
+ @cache_path = "#{@cache_path}/#{@options[:cache_path]}"
44
+ elsif ApiResponseCache.configuration.refresh_by_request_params?
45
+ @cache_path = "#{@cache_path}/#{@request.fullpath}"
46
+ else
47
+ path_only = @request.fullpath.split('?').first
48
+ @cache_path = "#{@cache_path}/#{path_only}"
45
49
  end
46
50
 
47
51
  if ApiResponseCache.configuration.cache_by_headers.present?
@@ -1,3 +1,3 @@
1
1
  module ApiResponseCache
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api-response-cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Uysim Ty
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-07-04 00:00:00.000000000 Z
11
+ date: 2018-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rainbow