lib/ny-times/congress/base.rb
# The copyright footer to be placed at the bottom of any data from the New York Times. Note this is only set after an API call.
The copyright footer to be placed at the bottom of any data from the New York Times. Note this is only set after an API call.
The copyright footer to be placed at the bottom of any data from the New York Times . Note this is only set after an API call .
def invoke(path, params={})
					begin
						if @@api_key.nil?
							raise "You must initialize the API key before you run any API queries"
						end
						full_params = params.merge 'api-key' => @@api_key
						uri = build_request_url(path, full_params)
						reply = uri.read
						reply = JSON.parse(reply)
						raise "Empty reply returned from API" if reply.nil?
						@@copyright = reply['copyright']
						reply
					rescue OpenURI::HTTPError => e
						return nil if e.message =~ /^404/						
						raise "Error connecting to URL #{uri} #{e}"
					end
				end
def invoke ( path , params = { } ) begin if @@api_key . nil? raise "You must initialize the API key before you run any API queries" end full_params = params . merge 'api-key' => @@api_key uri = build_request_url ( path , full_params ) reply = uri . read reply = JSON . parse ( reply ) raise "Empty reply returned from API" if reply . nil? @@copyright = reply [ 'copyright' ] reply rescue OpenURI :: HTTPError => e return nil if e . message =~ / ^404 / raise "Error connecting to URL #{uri} #{e}" end end
The copyright footer to be placed at the bottom of any data from the New York Times.
The copyright footer to be placed at the bottom of any data from the New York Times .
path
<not_specific>
params
<not_specific>