Class: Onebox::Engine::GoogleMapsOnebox
- Inherits:
-
Object
- Object
- Onebox::Engine::GoogleMapsOnebox
show all
- Includes:
- Onebox::Engine
- Defined in:
- lib/onebox/engine/google_maps_onebox.rb
Constant Summary
DEFAULT
Instance Attribute Summary
#cache, #timeout, #uri, #url
Class Method Summary
collapse
Instance Method Summary
collapse
engines, included, #options, #options=
Constructor Details
#initialize(url, cache = nil, timeout = nil) ⇒ GoogleMapsOnebox
Returns a new instance of GoogleMapsOnebox.
39
40
41
42
43
44
|
# File 'lib/onebox/engine/google_maps_onebox.rb', line 39
def initialize(url, cache = nil, timeout = nil)
super
resolve_url!
rescue Net::HTTPServerException, Timeout::Error, Net::HTTPError, Errno::ECONNREFUSED, RuntimeError => err
raise ArgumentError, "malformed url or unresolveable: #{err.message}"
end
|
Class Method Details
.===(other) ⇒ Object
7
8
9
10
11
12
13
|
# File 'lib/onebox/engine/google_maps_onebox.rb', line 7
def ===(other)
if other.kind_of? URI
@@matchers && @@matchers.any? {|m| other.to_s =~ m[:regexp] }
else
super
end
end
|
Instance Method Details
#placeholder_html ⇒ Object
54
55
56
57
58
|
# File 'lib/onebox/engine/google_maps_onebox.rb', line 54
def placeholder_html
width = @placeholder_width || 690
height = @placeholder_height || 400
"<img src=\"#{CGI.escapeHTML(@placeholder)}\" width=\"#{width}\" height=\"#{height}\"/>"
end
|
#streetview? ⇒ Boolean
46
47
48
|
# File 'lib/onebox/engine/google_maps_onebox.rb', line 46
def streetview?
!!@streetview
end
|
#to_html ⇒ Object
50
51
52
|
# File 'lib/onebox/engine/google_maps_onebox.rb', line 50
def to_html
"<div class='maps-onebox'>#{Helpers.click_to_scroll_div + "<iframe src=\"#{link}\" width=\"690\" height=\"400\" frameborder=\"0\" style=\"border:0\">#{placeholder_html}</iframe>"}</div>"
end
|