I'm using Faraday to create an SDK that will interact with an API, and I need to send two headers API_SIGNATURE
and API_REQUEST_TIME
, so that's what I've created:
class APIClient
def initialize(api_key)
@api_key = api_key
end
def get_users
request.post('/users')
end
private
def request
Faraday.new(@@BASE_API_URL, headers: headers)
end
def headers
timestamp = Time.now.to_i.to_s
return {
API_SIGNATURE: Digest::MD5.hexdigest(@api_key + timestamp),
API_REQUEST_TIME: timestamp
}
end
end
And for some reason Faraday is changing API_SIGNATURE to Api-Signature
and API_REQUEST_TIME
to Api-Request-Time
. Is it possible to prevent that from happening?
Thank you.