Class: OutsideIn::Resource::StoryFinder

Inherits:
Base
  • Object
show all
Defined in:
lib/outside_in/resource/story_finder.rb

Overview

A resource that performs queries for stories.

Since:

  • 1.0

Constant Summary collapse

QP =

Since:

  • 1.0

QueryParams.new({:limit => :limit, :'max-age' => :max_age}, {:keyword => :keyword, :vertical => :vertical,
:format => :format, :'author-type' => :'author-type'})

Class Method Summary collapse

Methods inherited from Base

#GET, #initialize, sign

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.

Returns:

  • (String)

    the URL including query parameters

Since:

  • 1.0



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.

Returns:

  • (String)

    the potentially scoped URL

Since:

  • 1.0



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