cortex-snippets-client-ruby 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cortex/snippets/client.rb +3 -3
- data/lib/cortex/snippets/version.rb +1 -1
- data/lib/cortex/snippets/view_helpers.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3e5df02376be89684e9f96cbf8ad690c019c9d8
|
4
|
+
data.tar.gz: 091a58e53993de73db21c2d9c5ad5c88758e936d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fa53fd25b6cfa0b64bd7a25c7e14d3c148c25ae9e99b9938bc58f3e834dfbfed769ccd1802071c28c310f834cd2d3f20f95ced741e82945a761cea6e5edee9e
|
7
|
+
data.tar.gz: 45baff63b1a0d377c6f9fb8e7c928ef7c9cc0628d310ae7fad8d8a825bfce2413f017ce75094ebbb7f8aa85e86b6c3ee3af6df949629ee9a54643e5cb0cb2d63
|
@@ -7,16 +7,16 @@ module Cortex
|
|
7
7
|
class << self
|
8
8
|
def cortex_client
|
9
9
|
if ENV['CORTEX_SNIPPET_ACCESS_TOKEN'].nil? || ENV['CORTEX_SNIPPET_ACCESS_TOKEN'].empty?
|
10
|
-
@cortex_client ||= ConnectionPool::Wrapper.new(size: 5, timeout: 3) { Cortex::Client.new(access_token: ENV['CORTEX_SNIPPET_ACCESS_TOKEN']) }
|
11
|
-
else
|
12
10
|
@cortex_client ||= ConnectionPool::Wrapper.new(size: 5, timeout: 3) { Cortex::Client.new(key: ENV['CORTEX_SNIPPET_KEY'], secret: ENV['CORTEX_SNIPPET_SECRET'], base_url: ENV['CORTEX_SNIPPET_BASE_URL']) }
|
11
|
+
else
|
12
|
+
@cortex_client ||= ConnectionPool::Wrapper.new(size: 5, timeout: 3) { Cortex::Client.new(access_token: ENV['CORTEX_SNIPPET_ACCESS_TOKEN']) }
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
16
|
def current_webpage(request)
|
17
17
|
if defined?(Rails)
|
18
18
|
Rails.cache.fetch("webpages/#{request_url(request)}", expires_in: 30.minutes) do
|
19
|
-
cortex_client.webpages.get_feed(request_url(request))
|
19
|
+
cortex_client.webpages.get_feed(request_url(request)).contents
|
20
20
|
end
|
21
21
|
else
|
22
22
|
raise 'Your Web framework is not supported. Supported frameworks: Rails'
|
@@ -4,7 +4,7 @@ module Cortex
|
|
4
4
|
def snippet(options = {}, &block)
|
5
5
|
snippet = webpage[:snippets].find { |snippet| snippet.name == options[:id] }
|
6
6
|
|
7
|
-
if snippet.empty?
|
7
|
+
if snippet.nil? || snippet.empty?
|
8
8
|
content_tag(:snippet, capture(&block), id: options[:id])
|
9
9
|
else
|
10
10
|
content_tag(:snippet, snippet, id: options[:id])
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cortex-snippets-client-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- CB Content Enablement
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cortex-client
|