Sha256: 8ed3f514f6643dbd626e0cce230ce8cb9df7c39407f4f3a2e33d5681208a8254

Contents?: true

Size: 1023 Bytes

Versions: 13

Compression:

Stored size: 1023 Bytes

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
          params[:path] = CGI.escape(params[:path]).gsub("%2F", "/")
          query = [params[:query]].compact
          query << "GoogleAccessId=#{@client.authorization.issuer}"
          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

13 entries across 13 versions & 1 rubygems

Version Path
fog-google-0.6.0 lib/fog/storage/google_json/utils.rb
fog-google-0.5.5 lib/fog/storage/google_json/utils.rb
fog-google-0.5.4 lib/fog/storage/google_json/utils.rb
fog-google-0.5.3 lib/fog/storage/google_json/utils.rb
fog-google-0.5.2 lib/fog/storage/google_json/utils.rb
fog-google-0.5.1 lib/fog/storage/google_json/utils.rb
fog-google-0.5.0 lib/fog/storage/google_json/utils.rb
fog-google-0.4.2 lib/fog/storage/google_json/utils.rb
fog-google-0.4.1 lib/fog/storage/google_json/utils.rb
fog-google-0.4.0 lib/fog/storage/google_json/utils.rb
fog-google-0.3.2 lib/fog/storage/google_json/utils.rb
fog-google-0.3.1 lib/fog/storage/google_json/utils.rb
fog-google-0.3.0 lib/fog/storage/google_json/utils.rb