Sha256: 61e5f8ad9750271efb7f99e6aa48e097d1e64dd1b82e0e1a385be78104b23c1a
Contents?: true
Size: 778 Bytes
Versions: 1
Compression:
Stored size: 778 Bytes
Contents
require "mws/query_string/percent_encoded_string" module MWS class QueryString < ::String class RequestString < ::String def initialize(args) @method = args[:method] @endpoint = args[:endpoint] @path = args[:path] @params = args[:params] super(request_string) end private def sorted_params Hash[@params.sort_by{|param| param[0] }] end def encoded_params Hash[sorted_params.map{|pair| pair.map{|elm| PercentEncodedString.new(elm.to_s) } } ] end def request_string [ @method.to_s.upcase, @endpoint, @path, encoded_params.map{|pair| pair.join("=") }.join("&") ].join("\n") end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
marketplace_web_service-0.0.4 | lib/mws/query_string/request_string.rb |