Skip to content
This repository has been archived by the owner on Aug 20, 2019. It is now read-only.

Commit

Permalink
Merge pull request #67 from fullcontact/hotfix/auth-type-error
Browse files Browse the repository at this point in the history
Fix 403 Error for default requests without any auth type
  • Loading branch information
digitaltracer authored Mar 3, 2019
2 parents 564521d + caf6228 commit 46e6316
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ A Ruby wrapper for the [FullContact API](http://www.fullcontact.com/)

Changes
-------
- 0.18.1
- Always use the token in header even when the option is given as query.
- 0.18.0
- Add ability to query Company API by company name
- Fix XML bug in Company API module
Expand Down
12 changes: 4 additions & 8 deletions lib/fullcontact/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,12 @@ def get(path, options={}, raw=false, faraday_options={})

# Perform an HTTP request
def request(method, path, options, raw=false, faraday_options={})
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]
if FullContact.options[:auth_type] == :query
options[:apiKey] = FullContact.options[:api_key]
end
request.url(formatted_path(path), options)
request.headers[FullContact::Configuration::AUTH_HEADER_NAME] = FullContact.options[:api_key]
end

raw ? response : response.body
Expand Down
2 changes: 1 addition & 1 deletion lib/fullcontact/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module FullContact
VERSION = '0.18.0'
VERSION = '0.18.1'
end

0 comments on commit 46e6316

Please sign in to comment.