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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a2c0e6de04706557a1df49fd8247f85b0aaa6c53
4
- data.tar.gz: 7df7220792e7849b3c75cd58d390c8f3110998cb
3
+ metadata.gz: c1ad41908ffdd630d025f54a380ed73fcc7cba41
4
+ data.tar.gz: 49ea6f79d5098d931a7dd284ed1724b904802363
5
5
  SHA512:
6
- metadata.gz: 8ad651751cc5ad4ae55220fb18b94e0db245752d4e0208cc34380c21aeb3818c0a09e6d305ab12060f14ca6be6c59c4c657c5a503ac0e815d6f3095ed768dc03
7
- data.tar.gz: b4c9bbf1b648bd21cf510029946a0232f2d5ee7f2d6e96407e6f75dc0d67b2dfc46e1f8accbbbb8c92e971ef82100079eb0ac6945905c4dcd1b1060b89685a3b
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.
@@ -1,7 +1,7 @@
1
1
  module Cortex
2
2
  module Snippets
3
3
  module Client
4
- VERSION = '0.5.2'
4
+ VERSION = '0.5.3'
5
5
  end
6
6
  end
7
7
  end
@@ -18,17 +18,17 @@ module Cortex
18
18
 
19
19
  def current_webpage(request)
20
20
  if defined?(Rails)
21
- Rails.cache.fetch("webpages/#{request_url(request)}", race_condition_ttl: 10) do
22
- cortex_client.webpages.get_feed(request_url(request)).contents
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 request_url(request)
30
- # TODO: Should be grabbing request URL in a framework-agnostic manner, but this is fine for now
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cortex-snippets-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - CB Content Enablement