Class: OutsideIn::Resource::StoryFinder
- Defined in:
- lib/outside_in/resource/story_finder.rb
Overview
A resource that performs queries for stories.
Constant Summary collapse
- QP =
QueryParams.new({:limit => :limit, :'max-age' => :max_age}, {:keyword => :keyword, :vertical => :vertical, :format => :format, :'author-type' => :'author-type'})
Class Method Summary collapse
-
.parameterize(url, inputs) ⇒ String
Returns a version of
url
with parameters in the query string corresponding toinputs
. -
.scope(url, inputs) ⇒ String
Returns a version of
url
that includes publication scoping wheninputs
contains a non-nilpublication-id
entry.
Methods inherited from Base
Constructor Details
This class inherits a constructor from OutsideIn::Resource::Base
Class Method Details
.parameterize(url, inputs) ⇒ String
Returns a version of url
with parameters in the query string corresponding to inputs
.
26 27 28 |
# File 'lib/outside_in/resource/story_finder.rb', line 26 def self.parameterize(url, inputs) QP.parameterize(url, inputs) end |
.scope(url, inputs) ⇒ String
Returns a version of url
that includes publication scoping when inputs
contains a non-nil publication-id
entry.
16 17 18 19 |
# File 'lib/outside_in/resource/story_finder.rb', line 16 def self.scope(url, inputs) inputs['publication-id'].nil?? url : url.gsub(/\/stories$/, "/publications/#{inputs['publication-id']}/stories") end |