Skip to content

Commit b91f0b8

Browse files
committed
Fix issues connecting to Cortex, serving up Webpage result contents, and Snippet view helper output
1 parent 63a107f commit b91f0b8

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

lib/cortex/snippets/client.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ module Client
77
class << self
88
def cortex_client
99
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
1210
@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']) }
1313
end
1414
end
1515

1616
def current_webpage(request)
1717
if defined?(Rails)
1818
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
2020
end
2121
else
2222
raise 'Your Web framework is not supported. Supported frameworks: Rails'

lib/cortex/snippets/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Cortex
22
module Snippets
3-
VERSION = '0.1.1'
3+
VERSION = '0.1.2'
44
end
55
end

lib/cortex/snippets/view_helpers.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module ViewHelpers
44
def snippet(options = {}, &block)
55
snippet = webpage[:snippets].find { |snippet| snippet.name == options[:id] }
66

7-
if snippet.empty?
7+
if snippet.nil? || snippet.empty?
88
content_tag(:snippet, capture(&block), id: options[:id])
99
else
1010
content_tag(:snippet, snippet, id: options[:id])

0 commit comments

Comments
 (0)