Sha256: 8d5501a56dbbb859d04b9b0650439b3957c8b98032565df55d4fae0b6007dd48
Contents?: true
Size: 1.33 KB
Versions: 1
Compression:
Stored size: 1.33 KB
Contents
module Fog module Storage class GoogleJSON module Utils def http_url(params, expires) "http://" << host_path_query(params, expires) end def https_url(params, expires) "https://" << host_path_query(params, expires) end def url(params, expires) Fog::Logger.deprecation("Fog::Storage::Google => #url is deprecated, use #https_url instead [light_black](#{caller.first})[/]") https_url(params, expires) end private def host_path_query(params, expires) params[:headers]["Date"] = expires.to_i # implementation from CGI.escape, but without ' ' to '+' conversion params[:path] = params[:path].b.gsub(/([^a-zA-Z0-9_.\-~]+)/) do |m| '%' + m.unpack('H2' * m.bytesize).join('%').upcase end query = [] if params[:query] filtered = params[:query].reject { |k, v| k.nil? || v.nil? } query = filtered.map { |k, v| [k.to_s, Fog::Google.escape(v)].join("=") } end query << "GoogleAccessId=#{google_access_id}" query << "Signature=#{CGI.escape(signature(params))}" query << "Expires=#{params[:headers]['Date']}" "#{params[:host]}/#{params[:path]}?#{query.join('&')}" end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fog-google-1.13.0 | lib/fog/storage/google_json/utils.rb |