Sha256: 5ab7a9a1c698c19d2f782d9331dbdc83ebe4f17e67b074e15db4e5f74c01c935

Contents?: true

Size: 673 Bytes

Versions: 13

Compression:

Stored size: 673 Bytes

Contents

# frozen_string_literal: true

require 'hibana'

module Weneedfeed
  class Application < ::Hibana::Application
    route do
      get '/', to: ::Weneedfeed::Controllers::ShowTopPage, as: :top_page
      get '/feeds/:page_id.xml', to: ::Weneedfeed::Controllers::ShowFeed, as: :feed
    end

    # @param [Hash] schema
    def initialize(schema:)
      @schema = ::Weneedfeed::Schema.new(schema)
      super()
    end

    # @param [Hash] env
    def call(env)
      env['weneedfeed.schema'] = @schema
      super
    end

    # @return [Array<String>]
    def paths
      ['/'] + @schema.page_ids.map do |page_id|
        "/feeds/#{page_id}.xml"
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
weneedfeed-0.13.0 lib/weneedfeed/application.rb
weneedfeed-0.12.0 lib/weneedfeed/application.rb
weneedfeed-0.11.0 lib/weneedfeed/application.rb
weneedfeed-0.10.0 lib/weneedfeed/application.rb
weneedfeed-0.9.2 lib/weneedfeed/application.rb
weneedfeed-0.9.1 lib/weneedfeed/application.rb
weneedfeed-0.9.0 lib/weneedfeed/application.rb
weneedfeed-0.8.0 lib/weneedfeed/application.rb
weneedfeed-0.7.2 lib/weneedfeed/application.rb
weneedfeed-0.7.1 lib/weneedfeed/application.rb
weneedfeed-0.7.0 lib/weneedfeed/application.rb
weneedfeed-0.6.1 lib/weneedfeed/application.rb
weneedfeed-0.6.0 lib/weneedfeed/application.rb