Sha256: a75b4b2fb6c5d0bd8b7e3e4ea9f09b805ebac333094dbb966b8561bfbb8f615d

Contents?: true

Size: 1.25 KB

Versions: 18

Compression:

Stored size: 1.25 KB

Contents

# frozen_string_literal: true

module Weneedfeed
  module Controllers
    class ShowFeed < ::Weneedfeed::Controllers::Base
      def call
        page_schema = schema.find_page_schema(path_parameters[:page_id])
        unless page_schema
          response.status = 404
          return
        end

        scraping = ::Weneedfeed::Scraping.new(
          description: page_schema.description,
          item_description_selector: page_schema.item_description_selector,
          item_image_selector: page_schema.item_image_selector,
          item_link_selector: page_schema.item_link_selector,
          item_time_selector: page_schema.item_time_selector,
          item_title_selector: page_schema.item_title_selector,
          item_selector: page_schema.item_selector,
          title: page_schema.title,
          url: page_schema.url,
        )
        page = scraping.call

        response.content_type = 'application/xml; charset=utf-8'
        response.write(
          ::Weneedfeed::Views::ShowFeed.new(
            page: page,
            partial_template_path: ::File.expand_path(
              'templates/show_feed.xml.erb',
              "#{__dir__}/../../.."
            ),
            request: request
          ).to_s
        )
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
weneedfeed-0.20.0 lib/weneedfeed/controllers/show_feed.rb
weneedfeed-0.19.3 lib/weneedfeed/controllers/show_feed.rb
weneedfeed-0.19.2 lib/weneedfeed/controllers/show_feed.rb
weneedfeed-0.19.1 lib/weneedfeed/controllers/show_feed.rb
weneedfeed-0.19.0 lib/weneedfeed/controllers/show_feed.rb
weneedfeed-0.18.0 lib/weneedfeed/controllers/show_feed.rb
weneedfeed-0.17.0 lib/weneedfeed/controllers/show_feed.rb
weneedfeed-0.16.1 lib/weneedfeed/controllers/show_feed.rb
weneedfeed-0.16.0 lib/weneedfeed/controllers/show_feed.rb
weneedfeed-0.15.0 lib/weneedfeed/controllers/show_feed.rb
weneedfeed-0.14.0 lib/weneedfeed/controllers/show_feed.rb
weneedfeed-0.13.0 lib/weneedfeed/controllers/show_feed.rb
weneedfeed-0.12.0 lib/weneedfeed/controllers/show_feed.rb
weneedfeed-0.11.0 lib/weneedfeed/controllers/show_feed.rb
weneedfeed-0.10.0 lib/weneedfeed/controllers/show_feed.rb
weneedfeed-0.9.2 lib/weneedfeed/controllers/show_feed.rb
weneedfeed-0.9.1 lib/weneedfeed/controllers/show_feed.rb
weneedfeed-0.9.0 lib/weneedfeed/controllers/show_feed.rb