class Mapbox::Base
Base
class
Attributes
access_token[RW]
access_token_secret[RW]
lat[RW]
lon[RW]
map_option[RW]
map_type[RW]
mapid[RW]
overlays[RW]
x[RW]
y[RW]
z[RW]
zoom[RW]
Public Class Methods
new(opts = {}) { |self| ... }
click to toggle source
# File lib/mapbox/base.rb, line 16 def initialize(opts = {}) opts.each do |key, value| instance_variable_set("@#{key}", value) end @overlays ||= [] yield(self) if block_given? end
Public Instance Methods
base_url()
click to toggle source
# File lib/mapbox/base.rb, line 30 def base_url tmp_overlays = @overlays.join(',') if @overlays.size > 0 tmp_overlays ||= nil [API_URL, API_VERSION, @mapid, tmp_overlays, @llz, @z, @x, @y, @map_option, @wh] .compact .join('/') + ".#{@map_type}" end
connection()
click to toggle source
# File lib/mapbox/base.rb, line 40 def connection Excon.new(base_url, query: { access_token: @access_token }) end
llz()
click to toggle source
latitude longitude zoom
# File lib/mapbox/base.rb, line 45 def llz [@lat, @lon, @zoom].join(',') end
parameters_check()
click to toggle source
# File lib/mapbox/base.rb, line 25 def parameters_check fail ArgumentError, ':access_token' if @access_token.nil? fail ArgumentError, ':mapid' if @mapid.nil? end
wh()
click to toggle source
width and height
# File lib/mapbox/base.rb, line 50 def wh [@width, @height].join('x') end