Class: MapPrint::Providers::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/map_print/providers/base.rb

Direct Known Subclasses

Bing, OpenStreetMap

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(south_west, north_east, zoom, base_url = nil) ⇒ Base

Returns a new instance of Base.



9
10
11
12
# File 'lib/map_print/providers/base.rb', line 9

def initialize(south_west, north_east, zoom, base_url=nil)
  @south_west, @north_east, @zoom = south_west, north_east, zoom
  @provider = build_provider(base_url)
end

Instance Attribute Details

#north_eastObject

Returns the value of attribute north_east.



7
8
9
# File 'lib/map_print/providers/base.rb', line 7

def north_east
  @north_east
end

#providerObject

Returns the value of attribute provider.



7
8
9
# File 'lib/map_print/providers/base.rb', line 7

def provider
  @provider
end

#south_westObject

Returns the value of attribute south_west.



7
8
9
# File 'lib/map_print/providers/base.rb', line 7

def south_west
  @south_west
end

#zoomObject

Returns the value of attribute zoom.



7
8
9
# File 'lib/map_print/providers/base.rb', line 7

def zoom
  @zoom
end

Instance Method Details

#build_provider(base_url = nil) ⇒ Object



14
15
16
# File 'lib/map_print/providers/base.rb', line 14

def build_provider(base_url = nil)
  raise 'SubClasses must override this method'
end

#downloadObject



18
19
20
21
22
# File 'lib/map_print/providers/base.rb', line 18

def download
  provider.download

  to_image
end