cortex-snippets-client 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -0
- data/lib/cortex/snippets/client/version.rb +1 -1
- data/lib/cortex/snippets/client.rb +5 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1ad41908ffdd630d025f54a380ed73fcc7cba41
|
4
|
+
data.tar.gz: 49ea6f79d5098d931a7dd284ed1724b904802363
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe33d390bd68e94658ea6eaebca790824735614e631500d0a74ebb965b0e60271fa4a83620d8ebceb1a7359f14ea92f29c1937c0e7d11f00edaf4e29ab2708a0
|
7
|
+
data.tar.gz: d42f169a4692f931ac4bd484b126b5b91cb76429f903b05c2312fbc42410c2b90d8b9a26b83cb5137bd12ba72a928df3d752a871b0069c86b0b3a60911882664
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,7 @@ Version History
|
|
3
3
|
* All Version bumps are required to update this file as well!!
|
4
4
|
----
|
5
5
|
|
6
|
+
* 0.5.3 - Extract a framework-agnostic sanitized_webpage_url method
|
6
7
|
* 0.5.2 - Addendum to previous version: fix expiry issues
|
7
8
|
* 0.5.1 - Set Webpage feed cache to never expire
|
8
9
|
* 0.5.0 - Auto-inject Client Helper into Views/Controllers. Add 10s race condition resolution to Rails cache fetch. Pass through to Snippet tag entire set of HTML attributes. Implement new namespacing and support Bundler.require.
|
@@ -18,17 +18,17 @@ module Cortex
|
|
18
18
|
|
19
19
|
def current_webpage(request)
|
20
20
|
if defined?(Rails)
|
21
|
-
|
22
|
-
|
21
|
+
sanitized_url = sanitized_webpage_url(request.original_url)
|
22
|
+
Rails.cache.fetch("webpages/#{sanitized_url}", race_condition_ttl: 10) do
|
23
|
+
cortex_client.webpages.get_feed(sanitized_url).contents
|
23
24
|
end
|
24
25
|
else
|
25
26
|
raise 'Your Web framework is not supported. Supported frameworks: Rails'
|
26
27
|
end
|
27
28
|
end
|
28
29
|
|
29
|
-
def
|
30
|
-
|
31
|
-
uri = Addressable::URI.parse(request.original_url)
|
30
|
+
def sanitized_webpage_url(url)
|
31
|
+
uri = Addressable::URI.parse(url)
|
32
32
|
path = uri.path == '/' ? uri.path : uri.path.chomp('/')
|
33
33
|
"#{uri.scheme}://#{uri.authority}#{path}"
|
34
34
|
end
|