class Cortex::Snippets::Webpage

Attributes

contents[R]
response[R]
status[R]
url[R]

Public Class Methods

new(cortex_client, url) click to toggle source
# File lib/cortex/snippets/webpage.rb, line 6
def initialize(cortex_client, url)
  @url = url
  @response = cortex_client.webpages.get_feed(url)
  @status = @response.status
  @contents = @response.contents
end

Public Instance Methods

accordion_group_widget_data() click to toggle source
# File lib/cortex/snippets/webpage.rb, line 101
def accordion_group_widget_data
  JSON.parse(@contents[:accordion_group_widget_json] || 'null', quirks_mode: true)
end
accordion_group_widget_data_for(section_name) click to toggle source
# File lib/cortex/snippets/webpage.rb, line 105
def accordion_group_widget_data_for(section_name)
  accordion_group_widget_data&.[](section_name) || []
end
buy_box_widget_data() click to toggle source
# File lib/cortex/snippets/webpage.rb, line 113
def buy_box_widget_data
  JSON.parse(@contents[:buy_box_widget_json] || 'null', quirks_mode: true)
end
card_group_widget_data() click to toggle source
# File lib/cortex/snippets/webpage.rb, line 93
def card_group_widget_data
  JSON.parse(@contents[:card_group_widget_json] || 'null', quirks_mode: true)
end
card_group_widget_data_for(section_name) click to toggle source
# File lib/cortex/snippets/webpage.rb, line 97
def card_group_widget_data_for(section_name)
  card_group_widget_data&.[](section_name)
end
carousels_widget_data() click to toggle source
# File lib/cortex/snippets/webpage.rb, line 69
def carousels_widget_data
  JSON.parse(@contents[:carousels_widget_json] || 'null', quirks_mode: true)
end
carousels_widget_data_for(section_name) click to toggle source
# File lib/cortex/snippets/webpage.rb, line 73
def carousels_widget_data_for(section_name)
  carousels_widget_data&.[](section_name)
end
charts_widget_data() click to toggle source
# File lib/cortex/snippets/webpage.rb, line 109
def charts_widget_data
  JSON.parse(@contents[:charts_widget_json] || 'null', quirks_mode: true)
end
charts_widget_data_for(section_name) click to toggle source
# File lib/cortex/snippets/webpage.rb, line 117
def charts_widget_data_for(section_name)
  charts_widget_data&.[](section_name) || {}
end
form_configs() click to toggle source
# File lib/cortex/snippets/webpage.rb, line 125
def form_configs
  @form_configs ||= JSON.parse(@contents[:form_configs_json] || 'null', quirks_mode: true)
end
galleries_widget_data() click to toggle source
# File lib/cortex/snippets/webpage.rb, line 77
def galleries_widget_data
  JSON.parse(@contents[:galleries_widget_json] || 'null', quirks_mode: true)
end
galleries_widget_data_for(section_name) click to toggle source
# File lib/cortex/snippets/webpage.rb, line 81
def galleries_widget_data_for(section_name)
  galleries_widget_data&.[](section_name)
end
noarchive() click to toggle source
# File lib/cortex/snippets/webpage.rb, line 53
def noarchive
  @contents[:noarchive]
end
nofollow() click to toggle source
# File lib/cortex/snippets/webpage.rb, line 41
def nofollow
  @contents[:nofollow]
end
noimageindex() click to toggle source
# File lib/cortex/snippets/webpage.rb, line 57
def noimageindex
  @contents[:noimageindex]
end
noindex() click to toggle source
# File lib/cortex/snippets/webpage.rb, line 37
def noindex
  @contents[:noindex]
end
noodp() click to toggle source
# File lib/cortex/snippets/webpage.rb, line 45
def noodp
  @contents[:noodp]
end
nosnippet() click to toggle source
# File lib/cortex/snippets/webpage.rb, line 49
def nosnippet
  @contents[:nosnippet]
end
product_data() click to toggle source
# File lib/cortex/snippets/webpage.rb, line 121
def product_data
  @product_data ||= JSON.parse(@contents[:product_data_json] || 'null', quirks_mode: true)
end
seo_description() click to toggle source
# File lib/cortex/snippets/webpage.rb, line 17
def seo_description
  @contents[:seo_description]
end
seo_keywords() click to toggle source
# File lib/cortex/snippets/webpage.rb, line 21
def seo_keywords
  @contents[:seo_keyword_list]
end
seo_robots() click to toggle source
# File lib/cortex/snippets/webpage.rb, line 25
def seo_robots
  robot_information = []
  index_options = [:noindex, :nofollow, :noodp, :nosnippet, :noarchive, :noimageindex]

  index_options.each do |index_option|
    robot_information << index_option if @contents[index_option]
  end

  robot_information = index_options unless Rails.env.production? || Rails.env.failover?
  robot_information
end
seo_title() click to toggle source
# File lib/cortex/snippets/webpage.rb, line 13
def seo_title
  @contents[:seo_title]
end
slider_widget_data() click to toggle source
# File lib/cortex/snippets/webpage.rb, line 85
def slider_widget_data
  JSON.parse(@contents[:slider_widget_json] || 'null', quirks_mode: true)
end
slider_widget_data_for(section_name) click to toggle source
# File lib/cortex/snippets/webpage.rb, line 89
def slider_widget_data_for(section_name)
  slider_widget_data&.[](section_name)
end
snippets() click to toggle source
# File lib/cortex/snippets/webpage.rb, line 129
def snippets
  @contents[:snippets]
end
tables_widget_data() click to toggle source
# File lib/cortex/snippets/webpage.rb, line 61
def tables_widget_data
  JSON.parse(@contents[:tables_widget_json] || 'null', quirks_mode: true)
end
tables_widget_data_for(section_name) click to toggle source
# File lib/cortex/snippets/webpage.rb, line 65
def tables_widget_data_for(section_name)
  tables_widget_data&.[](section_name) || []
end