Sha256: 178b517690dfa3f81e81025cbfe57e6922b81e991243b889ba555c57f1ede2f0
Contents?: true
Size: 1.34 KB
Versions: 1
Compression:
Stored size: 1.34 KB
Contents
class Amazon::MWS::Authentication class QueryString < String def initialize(params = {}) query_params = { 'AWSAccessKeyId' => params[:access_key], 'SignatureMethod' => Signature::METHOD, 'SignatureVersion' => Signature::VERSION, 'Timestamp' => Time.now.iso8601 } if params[:path].include? 'Orders' query_params['SellerId'] = params[:merchant_id] query_params['Version'] = Amazon::MWS::Authentication::ORDERS_VERSION elsif params[:path].include? 'Products' query_params['SellerId'] = params[:merchant_id] query_params['Version'] = Amazon::MWS::Authentication::PRODUCTS_VERSION else query_params['Merchant'] = params[:merchant_id] query_params['Version'] = Amazon::MWS::Authentication::VERSION end # Add any params that are passed in via uri before calculating the signature query_params = query_params.merge(params[:query_params] || {}) # Calculate the signature query_params['Signature'] = Signature.new(query_params, params) self << formatted_querystring(query_params) end def formatted_querystring(query_params) query_params.collect { |key, value| [CGI.escape(key.to_s), CGI.escape(value.to_s)].join('=') }.join('&') # order doesn't matter for the actual request end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
amazon-mws-plus-0.1.3 | lib/amazon/mws/authentication/query_string.rb |