Sha256: 7460a7f4839ac7efb481f456ae36939c8683bd7cf4900aad0f74f168dbd01b13
Contents?: true
Size: 1.32 KB
Versions: 3
Compression:
Stored size: 1.32 KB
Contents
class Ey::Hmac::Adapter::Faraday < Ey::Hmac::Adapter def method request[:method].to_s.upcase end def content_type %w[CONTENT-TYPE CONTENT_TYPE Content-Type Content_Type].inject(nil){|r, h| r || request[:request_headers][h]} end def content_digest if existing = %w[CONTENT-DIGEST CONTENT_DIGEST Content-Digest Content_Digest].inject(nil){|r,h| r || request[:request_headers][h]} existing elsif digestable = body && Digest::MD5.hexdigest(body) request[:request_headers]['Content-Digest'] = digestable else nil end end def body if request[:body] && request[:body].to_s != "" request[:body] else nil end end def date existing = %w[DATE Date].inject(nil){|r,h| r || request[h]} existing || (request[:request_headers]['Date'] = Time.now.httpdate) end def path request[:url].path end def sign!(key_id, key_secret) %w[CONTENT-TYPE CONTENT_TYPE Content-Type Content_Type].inject(nil){|r,h| request[:request_headers][h]} if options[:version] request[:request_headers]['X-Signature-Version'] = options[:version] end request[:request_headers][authorization_header] = authorization(key_id, key_secret) end def authorization_signature %w[Authorization AUTHORIZATION].inject(nil){|r, h| r || request[:request_headers][h]} end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ey-hmac-0.0.5 | lib/ey-hmac/adapter/faraday.rb |
ey-hmac-0.0.4 | lib/ey-hmac/adapter/faraday.rb |
ey-hmac-0.0.3 | lib/ey-hmac/adapter/faraday.rb |