Sha256: 2120ec079ea7dc884f33459277e39d88f60eb524f5bed5cc9199a3c2a6ac6dea

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 KB

Contents

module Cortex
  module Snippets
    module Client
      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
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cortex-snippets-client-1.0.0 lib/cortex/snippets/client/webpage.rb