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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a556cd70405a2948ff5f775edc6b66ae5a93cd27
4
- data.tar.gz: 71155c24a5263bb0d0ad65bb1ab1af1b52269c32
3
+ metadata.gz: a3e5df02376be89684e9f96cbf8ad690c019c9d8
4
+ data.tar.gz: 091a58e53993de73db21c2d9c5ad5c88758e936d
5
5
  SHA512:
6
- metadata.gz: f58522307fb2ffe50ec20ecbd364087b2ecde70a9c13d5b3a11f5405fc37cbd842f985b1effb2f1ea399fb822a28dfb6edac141044ac84352d2f68a7e36bb03a
7
- data.tar.gz: 014a92f71c0e468eb7863e3c091cccde8f0ef0bf5032e8e3289e9d325a723d94c0569f006eebb2fb577dda9a76bddf1fc84801a3191bbe24590838f6b6d83555
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'
@@ -1,5 +1,5 @@
1
1
  module Cortex
2
2
  module Snippets
3
- VERSION = '0.1.1'
3
+ VERSION = '0.1.2'
4
4
  end
5
5
  end
@@ -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.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-07 00:00:00.000000000 Z
11
+ date: 2015-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cortex-client