Method: NPR::API::Client#initialize
- Defined in:
- lib/npr/api/client.rb
#initialize(params = {}) ⇒ Client
Argument is a hash of params to send to the API. See <www.npr.org/api/inputReference.php> for API documentation.
Example:
NPR::Client.new(apiKey: "YOUR_API_KEY", sort: "date descending")
Any parameters passed into this method will override the global configuration.
33 34 35 36 37 |
# File 'lib/npr/api/client.rb', line 33 def initialize(params={}) @params = NPR.config.merge(params) @url = @params.delete(:url) || NPR::Configuration::API_ROOT @apiKey = @params.delete(:apiKey) end |