class NytSearch::Api
Public Class Methods
config()
click to toggle source
# File lib/nyt_search/api.rb, line 5 def self.config @@config ||= {} end
get_json(url)
click to toggle source
# 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)
click to toggle source
# 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