Class: NytSearch::Api
- Inherits:
-
Object
- Object
- NytSearch::Api
- Includes:
- HTTParty
- Defined in:
- lib/nyt_search/api.rb
Direct Known Subclasses
Class Method Summary collapse
Class Method Details
.config ⇒ Object
5 6 7 |
# File 'lib/nyt_search/api.rb', line 5 def self.config @@config ||= {} end |
.get_json(url) ⇒ Object
14 15 16 17 |
# File 'lib/nyt_search/api.rb', line 14 def self.get_json(url) response = HTTParty.get(url) JSON.parse(response.body) end |
.key(api_key) ⇒ Object
9 10 11 12 |
# File 'lib/nyt_search/api.rb', line 9 def self.key(api_key) self.config[:api_key] = api_key self.config[:base_uri] = "http://api.nytimes.com/svc/search/v2/articlesearch.json" end |