./lib/rack/newsstand.rb in rack-newsstand-0.0.3 vs ./lib/rack/newsstand.rb in rack-newsstand-0.1.0

- old
+ new

@@ -18,12 +18,12 @@ Sequel::Migrator.run(DB, ::File.join(::File.dirname(__FILE__), "newsstand/migrations"), table: 'newsstand_schema_info') end end - get '/issues' do - @issues = Issue.order(:published_at).all + get '/issues/?' do + @issues = Issue.where("published_at <= :now AND (expires_at > :now OR expires_at IS NULL)", now: Time.now).order(:published_at).all request.accept.each do |type| case type.to_s when 'application/atom+xml', 'application/xml', 'text/xml' content_type 'application/x-plist' @@ -37,14 +37,12 @@ end halt 406 end - get '/issues/:name' do + get '/issues/:name/?' do pass unless request.accept? 'application/x-plist' content_type 'application/x-plist' - - param :name, String, empty: false Issue.find(name: params[:name]).to_plist end template :atom do