lib/fullcontact/request.rb in fullcontact-0.14.0 vs lib/fullcontact/request.rb in fullcontact-0.15.0
- old
+ new
@@ -8,13 +8,19 @@
private
# Perform an HTTP request
def request(method, path, options, raw=false, faraday_options={})
- options[:apiKey] = FullContact.options[:api_key]
+ if FullContact.options[:auth_type] == :query
+ options[:apiKey] = FullContact.options[:api_key]
+ end
response = connection(raw, faraday_options).send(method) do |request|
request.url(formatted_path(path), options)
+
+ if FullContact.options[:auth_type] == :header
+ request.headers[FullContact::Configuration::AUTH_HEADER_NAME] = FullContact.options[:api_key]
+ end
end
raw ? response : response.body
end