Class: CloudMade::Client

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



21
22
23
# File 'lib/cloudmade/client.rb', line 21

def api_key
  @api_key
end

#base_urlObject

Returns the value of attribute base_url.



19
20
21
# File 'lib/cloudmade/client.rb', line 19

def base_url
  @base_url
end

#connectionObject

Returns the value of attribute connection.



18
19
20
# File 'lib/cloudmade/client.rb', line 18

def connection
  @connection
end

#portObject

:nodoc:



30
31
32
33
# File 'lib/cloudmade/client.rb', line 30

def port
  return 80 if @port == nil
  @port
end

Class Method Details

.from_connection(connection) ⇒ Object



56
57
58
59
60
# File 'lib/cloudmade/client.rb', line 56

def from_connection(connection)
  client = Client.new
  client.connection = connection
  return client
end

.from_parameters(api_key, base_url = nil, port = nil) ⇒ Object



62
63
64
65
66
# File 'lib/cloudmade/client.rb', line 62

def from_parameters(api_key, base_url = nil, port = nil)
  client = Client.new
  client.connection = Connection.new(api_key, base_url, port)
  return client
end

Instance Method Details

#geocodingObject

Geocoding service



41
42
43
# File 'lib/cloudmade/client.rb', line 41

def geocoding
  @geocoding ||= GeocodingService.new(self.connection, 'geocoding')
end

#locationsObject

Locations service



51
52
53
# File 'lib/cloudmade/client.rb', line 51

def locations
  @locations ||= LocationsService.new(self.connection, '')
end

#routingObject

Routing service



46
47
48
# File 'lib/cloudmade/client.rb', line 46

def routing
  @routing ||= RoutingService.new(self.connection, 'routes')
end

#tilesObject

Tiles service



36
37
38
# File 'lib/cloudmade/client.rb', line 36

def tiles
  @tiles ||= TilesService.new(self.connection, 'tile')
end

#urlObject

:nodoc:



25
26
27
# File 'lib/cloudmade/client.rb', line 25

def url
  return "#{base_url}#{@port != nil ? ':' + port.to_s : ''}"
end