Sha256: 7a4be5e18fc86aedcd3a223dcab39d90b3464c1d98ef2e4c8107b850d81e54dd
Contents?: true
Size: 1.15 KB
Versions: 3
Compression:
Stored size: 1.15 KB
Contents
module Rack module Contrib module Sign class Receipt attr_reader :request_method attr_reader :headers attr_accessor :api_key attr_accessor :api_secret attr_accessor :body attr_accessor :content_type attr_accessor :uri attr_accessor :host def initialize @headers = {} end def request_method= s @request_method = s.upcase end def body_md5 Digest::MD5.hexdigest(body) end def body_length body.length end def to_s preamble + header_text end def preamble s = "" s << "%s\n" % request_method s << "%s\n" % host s << "%s\n" % uri s << "%s\n" % api_key s << "%s\n" % content_type s << "%s\n" % body_length s << "%s\n" % body_md5 s end def header_text s = "" headers.sort_by { |k,v| k.downcase }.each do |header, value| s << "%s:%s\n" % [header.downcase, value] end s end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rack-contrib-sign-0.0.4 | lib/rack/contrib/sign/receipt.rb |
rack-contrib-sign-0.0.3 | lib/rack/contrib/sign/receipt.rb |
rack-contrib-sign-0.0.2 | lib/rack/contrib/sign/receipt.rb |