Class: Nytimes::Articles::Query
- Inherits:
-
Object
- Object
- Nytimes::Articles::Query
- Defined in:
- lib/nytimes_articles/query.rb
Overview
The Query class represents a single query to the Article Search API. Supports all of the named parameters to Article.search as accessor methods.
Constant Summary collapse
- FIELDS =
[:only_facets, :except_facets, :begin_date, :end_date, :since, :before, :fee, :has_thumbnail, :facets, :fields, :query, :offset] + Article::TEXT_FIELDS.map{|f| f.to_sym}
Instance Method Summary collapse
-
#hash ⇒ Object
Produce a hash which uniquely identifies this query.
-
#perform ⇒ Object
Perform this query.
Instance Method Details
#hash ⇒ Object
Produce a hash which uniquely identifies this query
15 16 17 18 |
# File 'lib/nytimes_articles/query.rb', line 15 def hash strs = FIELDS.collect {|f| "#{f}:#{send(f).inspect}"} Digest::SHA256.hexdigest(strs.join(' ')) end |