Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/emailable/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def request(method, endpoint, params = {})

uri = URI("#{@base_url}/#{endpoint}")
headers = {
'Authorization': "Bearer #{Emailable.api_key || api_key || access_token}",
'Authorization': "Bearer #{api_key || access_token || Emailable.api_key}",
'Content-Type': 'application/json'
}

Expand Down
6 changes: 6 additions & 0 deletions test/authentication_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,10 @@ def test_request_time_api_key_authentication
refute_nil Emailable::Batch.new(bid).status(api_key: @api_key).id
end

def test_request_time_authentication_takes_priority_over_global
Emailable.api_key = 'invalid_api_key'

refute_nil Emailable.verify(@email, api_key: @api_key).domain
end

end