Class: CloudMade::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/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/client.rb', line 21

def api_key
  @api_key
end

#base_urlObject

Returns the value of attribute base_url.



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

def base_url
  @base_url
end

#connectionObject

Returns the value of attribute connection.



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

def connection
  @connection
end

#portObject

:nodoc:



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

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

Class Method Details

.from_connection(connection) ⇒ Object



60
61
62
63
64
# File 'lib/client.rb', line 60

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

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



66
67
68
69
70
# File 'lib/client.rb', line 66

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



42
43
44
45
# File 'lib/client.rb', line 42

def geocoding
  @geocoding = GeocodingService.new(self.connection, 'geocoding') if @geocoding == nil
  return @geocoding
end

#locationsObject

Locations service



54
55
56
57
# File 'lib/client.rb', line 54

def locations
  @locations = LocationsService.new(self.connection, '') if @locations == nil
  return @locations
end

#routingObject

Routing service



48
49
50
51
# File 'lib/client.rb', line 48

def routing
  @routing = RoutingService.new(self.connection, 'routes') if @routing == nil
  return @routing
end

#tilesObject

Tiles service



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

def tiles
  @tiles = TilesService.new(self.connection, 'tile') if @tiles == nil
  return @tiles
end

#urlObject

:nodoc:



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

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