Class: CloudMade::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudmade/service.rb

Overview

General class for all CloudMade’s services

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#connectionObject

Returns the value of attribute connection.



24
25
26
# File 'lib/cloudmade/service.rb', line 24

def connection
  @connection
end

#subdomainObject

Returns the value of attribute subdomain.



23
24
25
# File 'lib/cloudmade/service.rb', line 23

def subdomain
  @subdomain
end

Class Method Details

.to_url_params(params) ⇒ Object



38
39
40
# File 'lib/cloudmade/service.rb', line 38

def to_url_params(params)
  params.map {|k,v| "#{CGI.escape(k.to_s)}=#{CGI.escape(v.to_s)}" }.join('&')
end

Instance Method Details

#urlObject

Template for service’s domain By default it is <service_name>.cloudmade.com E.g. tile.cloudmade.com, geocoding.cloudmade.com



33
34
35
# File 'lib/cloudmade/service.rb', line 33

def url
  "#{@subdomain}.#{@connection.base_url}"
end

#url_templateObject



26
27
28
# File 'lib/cloudmade/service.rb', line 26

def url_template
  return "http://#{@subdomain}.#{@connection.url}/#{@connection.api_key}"
end