Sha256: 568d2032a65868b6bdc1251863abd7ff1acb82d29b5b69c477d7b7c3f9b38e69

Contents?: true

Size: 1.23 KB

Versions: 4

Compression:

Stored size: 1.23 KB

Contents

module Cortex
  module Snippets
    class Webpage
      def initialize(cortex_client, url)
        @webpage = cortex_client.webpages.get_feed(url).contents
      end

      def seo_title
        @webpage[:seo_title]
      end

      def seo_description
        @webpage[:seo_description]
      end

      def seo_keywords
        @webpage[:seo_keyword_list]
      end

      def seo_robots
        robot_information = []
        index_options = [:noindex, :nofollow, :noodp, :nosnippet, :noarchive, :noimageindex]

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

        robot_information
      end

      def noindex
        @webpage[:noindex]
      end

      def nofollow
        @webpage[:nofollow]
      end

      def noodp
        @webpage[:noodp]
      end

      def nosnippet
        @webpage[:nosnippet]
      end

      def noarchive
        @webpage[:noarchive]
      end

      def noimageindex
        @webpage[:noimageindex]
      end

      def dynamic_yield
        {
          sku: @webpage[:dynamic_yield_sku],
          category: @webpage[:dynamic_yield_category]
        }
      end

      def snippets
        @webpage[:snippets]
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cortex-snippets-client-1.0.4 lib/cortex/snippets/webpage.rb
cortex-snippets-client-1.0.3 lib/cortex/snippets/webpage.rb
cortex-snippets-client-1.0.2 lib/cortex/snippets/webpage.rb
cortex-snippets-client-1.0.1 lib/cortex/snippets/webpage.rb