Sha256: 51d8b7dab6e864f3be17978cd4b239a42b21c33467e72535f5f6d46cbfe696ba
Contents?: true
Size: 1.27 KB
Versions: 3
Compression:
Stored size: 1.27 KB
Contents
# frozen_string_literal: true module Weneedfeed module Controllers class ShowFeed < ::Hibana::Controller def call env = request.env page_name = env.dig( 'router.params', :page_name ) properties = env.dig( 'weneedfeed.schema', 'pages', page_name ) unless properties response.status = 404 return end scraping = ::Weneedfeed::Scraping.new( item_description_xpath: properties['xpath']['item_description'], item_link_xpath: properties['xpath']['item_link'], item_time_xpath: properties['xpath']['item_time'], item_title_xpath: properties['xpath']['item_title'], item_xpath: properties['xpath']['item'], title: properties['title'], url: properties['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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
weneedfeed-0.3.0 | lib/weneedfeed/controllers/show_feed.rb |
weneedfeed-0.2.0 | lib/weneedfeed/controllers/show_feed.rb |
weneedfeed-0.1.0 | lib/weneedfeed/controllers/show_feed.rb |