lib/phaxio/client.rb in phaxio-2.1.0.pre vs lib/phaxio/client.rb in phaxio-2.1.0
- old
+ new
@@ -42,14 +42,10 @@
def conn
Faraday.new(Phaxio.api_endpoint) do |conn|
conn.request :multipart
conn.request :url_encoded
conn.adapter :net_http
-
- if Phaxio.api_key && Phaxio.api_secret
- conn.basic_auth Phaxio.api_key, Phaxio.api_secret
- end
end
end
private
@@ -151,11 +147,11 @@
params
end
def api_headers params
- api_key = params[:api_key] || Phaxio.api_key
- api_secret = params[:api_secret] || Phaxio.api_secret
+ api_key = params.delete(:api_key) || Phaxio.api_key
+ api_secret = params.delete(:api_secret) || Phaxio.api_secret
return unless api_key && api_secret
auth = Base64.strict_encode64("#{api_key}:#{api_secret}")
{'Authorization' => "Basic #{auth}"}
end