Class: Onebox::Engine::InstagramOnebox
- Inherits:
-
Object
- Object
- Onebox::Engine::InstagramOnebox
- Includes:
- Onebox::Engine, StandardEmbed, LayoutSupport
- Defined in:
- lib/onebox/engine/instagram_onebox.rb
Constant Summary
Constants included from Onebox::Engine
Instance Attribute Summary
Attributes included from Onebox::Engine
#errors, #options, #timeout, #uri, #url
Instance Method Summary collapse
Methods included from LayoutSupport
Methods included from StandardEmbed
add_oembed_provider, add_opengraph_provider, #always_https?, oembed_providers, opengraph_providers, #raw
Methods included from Onebox::Engine
all_iframe_origins, engines, included, #initialize, origins_to_regexes, #placeholder_html, #to_html
Instance Method Details
#clean_url ⇒ Object
13 14 15 |
# File 'lib/onebox/engine/instagram_onebox.rb', line 13 def clean_url url.scan(/^https?:\/\/(?:www\.)?(?:instagram\.com|instagr\.am)\/?(?:.*)\/(?:p|tv)\/[a-zA-Z\d_-]+/).flatten.first end |
#data ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/onebox/engine/instagram_onebox.rb', line 17 def data = raise "No oEmbed data found. Ensure 'facebook_app_access_token' is valid" if .data.empty? { link: clean_url.gsub("/#{.}/", "/"), title: "@#{.}", image: .thumbnail_url, description: Onebox::Helpers.truncate(.title, 250), } end |