Class: Voom::Presenters::Plugins::GoogleMaps::GoogleMap

Inherits:
DSL::Components::EventBase show all
Defined in:
lib/voom/presenters/plugins/google_maps/google_map.rb

Instance Attribute Summary collapse

Attributes inherited from DSL::Components::EventBase

#event_parent_id

Attributes included from DSL::Components::Mixins::Event

#events

Attributes inherited from DSL::Components::Base

#attributes, #css_class, #draggable, #drop_zone, #id, #tag, #type

Instance Method Summary collapse

Methods included from DSL::Components::Mixins::Event

#event

Methods inherited from DSL::Components::Base

#expand!

Methods included from Voom::Presenters::Pluggable

#include_plugins, #plugin, #plugin_module

Methods included from DSL::Components::Mixins::YieldTo

#yield_to

Methods included from Serializer

#to_hash

Methods included from DSL::Lockable

#locked?

Constructor Details

#initialize(**attribs_, &block) ⇒ GoogleMap

Returns a new instance of GoogleMap.



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/voom/presenters/plugins/google_maps/google_map.rb', line 11

def initialize(**attribs_, &block)
  super(type: :google_map, **attribs_, &block)
  @address = attribs.delete(:address)
  @latitude = attribs.delete(:latitude)
  @longitude = attribs.delete(:longitude)
  @width = attribs.delete(:width) { 640 }
  @height = attribs.delete(:height) { 640 }
  @zoom = attribs.delete(:zoom) { 14 }
  @scale = attribs.delete(:scale) { 1 }
  @google_api_key = attribs.delete(:google_api_key) { ENV['GOOGLE_API_KEY'] }
  @url = build_static_map_image_url
  expand!
end

Instance Attribute Details

#google_api_keyObject (readonly)

Returns the value of attribute google_api_key.



9
10
11
# File 'lib/voom/presenters/plugins/google_maps/google_map.rb', line 9

def google_api_key
  @google_api_key
end

#heightObject (readonly)

Returns the value of attribute height.



9
10
11
# File 'lib/voom/presenters/plugins/google_maps/google_map.rb', line 9

def height
  @height
end

#urlObject (readonly)

Returns the value of attribute url.



9
10
11
# File 'lib/voom/presenters/plugins/google_maps/google_map.rb', line 9

def url
  @url
end

#widthObject (readonly)

Returns the value of attribute width.



9
10
11
# File 'lib/voom/presenters/plugins/google_maps/google_map.rb', line 9

def width
  @width
end