Class: GoogleMapsAPI::Core::URISigner

Inherits:
Object
  • Object
show all
Defined in:
lib/google_maps_api/core/uri_signer.rb

Class Method Summary collapse

Class Method Details

.sign(uri, client, key, channel = nil) ⇒ Object



5
6
7
8
9
10
# File 'lib/google_maps_api/core/uri_signer.rb', line 5

def self.sign(uri, client, key, channel = nil)
  uri = URI(URI.encode(uri))
  path = "#{uri.path}?#{uri.query}&client=#{client}"
  path << "&channel=#{channel}" if channel
  URI("#{uri.scheme}://#{uri.host}#{path}&signature=#{signature(path, key)}")
end