jahuty 3.3.0 → 3.3.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 +4 -4
- data/CHANGELOG.md +15 -9
- data/lib/jahuty/service/snippet.rb +6 -7
- data/lib/jahuty/version.rb +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: b7f9dd15bdc516d3e7249bba915822f742642f59c7209f47151b963ba34b53d1
|
|
4
|
+
data.tar.gz: 11bb09b250f358f13d5cafb3a585a1db525ddf988b6fea70dd19c7586a5a77a3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 42ee47a4e2e936a10c4e14bee9990db9c170e53e852d257190cf7636d8c27ce6e7f4da04eeb1cf1ea333e00f65ffc7ed1847b0a47ec4c7ea024d067ee9bca196
|
|
7
|
+
data.tar.gz: e1ec48bb180b4f81145f4a6b939bc3a9fe64a792bbb7a513b705b49e61b4ac379dfbc0c38fb12880122282d12816d90c8798ca6b283bb8fce6befe5777eb3174
|
data/CHANGELOG.md
CHANGED
|
@@ -5,27 +5,33 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
## 3.3.
|
|
8
|
+
## 3.3.1 - 2021-05-02
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- Fixed [#19](https://github.com/jahuty/jahuty-ruby/issues/19) where renders were cached without regard for their content version.
|
|
13
|
+
|
|
14
|
+
## 3.3.0 - 2021-04-29
|
|
9
15
|
|
|
10
16
|
- Add the `prefer_latest` configuration option to the client and render methods. This setting allows you to render a snippet's _latest_ content instead of the default _published_ content.
|
|
11
17
|
|
|
12
|
-
## 3.2.1 -
|
|
18
|
+
## 3.2.1 - 2021-03-16
|
|
13
19
|
|
|
14
|
-
|
|
15
|
-
|
|
20
|
+
- Fix issue with double-enveloping the `params` query string parameter.
|
|
21
|
+
- Add system tests for params, caching, problems, and collections.
|
|
16
22
|
|
|
17
|
-
## 3.2.0 -
|
|
23
|
+
## 3.2.0 - 2021-03-08
|
|
18
24
|
|
|
19
|
-
|
|
20
|
-
|
|
25
|
+
- Added collections to the library with `all_renders` method. This was a rather large change and required adding new objects like `Action::Show`, refactoring old ones like `Resource::Factory`, and removing some objects like `Cache::Manager` and `Service::Factory` which added unnecessary complexity.
|
|
26
|
+
- Added `snippet_id` to `Resource::Render` to help keep track of a render's parent snippet.
|
|
21
27
|
|
|
22
|
-
## 3.1.1 -
|
|
28
|
+
## 3.1.1 - 2021-02-26
|
|
23
29
|
|
|
24
30
|
- Add support for extra, unused attributes returned by the API to support evolution.
|
|
25
31
|
- Fix the `method redefined` warnings in `cache/manager_spec.rb` and `cache/facade_spec.rb`.
|
|
26
32
|
- Fix the `expect { }.not_to raise_error(SpecificErrorClass)` false positives warnings in `resource/render_spec.rb`.
|
|
27
33
|
|
|
28
|
-
## 3.1.0 -
|
|
34
|
+
## 3.1.0 - 2021-01-04
|
|
29
35
|
|
|
30
36
|
- Add caching support for any cache implementation that supports `get/set` or `read/write` methods.
|
|
31
37
|
- Default to using in-memory [mini-cache](https://github.com/derrickreimer/mini_cache) storage.
|
|
@@ -15,13 +15,13 @@ module Jahuty
|
|
|
15
15
|
def all_renders(tag, params: {}, expires_in: @expires_in, prefer_latest: @prefer_latest)
|
|
16
16
|
renders = index_renders tag: tag, params: params, prefer_latest: prefer_latest
|
|
17
17
|
|
|
18
|
-
cache_renders renders: renders, params: params, expires_in: expires_in
|
|
18
|
+
cache_renders renders: renders, params: params, expires_in: expires_in, latest: prefer_latest
|
|
19
19
|
|
|
20
20
|
renders
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def render(snippet_id, params: {}, expires_in: @expires_in, prefer_latest: @prefer_latest)
|
|
24
|
-
key = cache_key snippet_id: snippet_id, params: params
|
|
24
|
+
key = cache_key snippet_id: snippet_id, params: params, latest: prefer_latest
|
|
25
25
|
|
|
26
26
|
render = @cache.read(key)
|
|
27
27
|
|
|
@@ -38,17 +38,16 @@ module Jahuty
|
|
|
38
38
|
|
|
39
39
|
private
|
|
40
40
|
|
|
41
|
-
def cache_key(snippet_id:, params: {})
|
|
41
|
+
def cache_key(snippet_id:, params: {}, latest: false)
|
|
42
42
|
fingerprint = Digest::MD5.new
|
|
43
43
|
fingerprint << "snippets/#{snippet_id}/render/"
|
|
44
44
|
fingerprint << params.to_json
|
|
45
|
+
fingerprint << '/latest' if latest
|
|
45
46
|
|
|
46
47
|
"jahuty_#{fingerprint.hexdigest}"
|
|
47
48
|
end
|
|
48
49
|
|
|
49
|
-
def cache_renders(renders:, params:, expires_in:
|
|
50
|
-
expires_in ||= @expires_in
|
|
51
|
-
|
|
50
|
+
def cache_renders(renders:, params:, expires_in: @expires_in, latest: false)
|
|
52
51
|
return if renders.nil?
|
|
53
52
|
|
|
54
53
|
return unless cacheable?(expires_in)
|
|
@@ -59,7 +58,7 @@ module Jahuty
|
|
|
59
58
|
local_params = params[render.snippet_id.to_s] || {}
|
|
60
59
|
render_params = ::Jahuty::Util.deep_merge global_params, local_params
|
|
61
60
|
|
|
62
|
-
key = cache_key snippet_id: render.snippet_id, params: render_params
|
|
61
|
+
key = cache_key snippet_id: render.snippet_id, params: render_params, latest: latest
|
|
63
62
|
|
|
64
63
|
@cache.write key, render, expires_in: expires_in
|
|
65
64
|
end
|
data/lib/jahuty/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jahuty
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.3.
|
|
4
|
+
version: 3.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jack Clayton
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-05-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|