Module: Onebox::Engine::StandardEmbed

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.add_oembed_provider(regexp, endpoint) ⇒ Object



16
17
18
# File 'lib/onebox/engine/standard_embed.rb', line 16

def self.add_oembed_provider(regexp, endpoint)
  oembed_providers[regexp] = endpoint
end

.add_opengraph_provider(regexp) ⇒ Object



24
25
26
# File 'lib/onebox/engine/standard_embed.rb', line 24

def self.add_opengraph_provider(regexp)
  opengraph_providers << regexp
end

.oembed_providersObject



12
13
14
# File 'lib/onebox/engine/standard_embed.rb', line 12

def self.oembed_providers
  @@oembed_providers ||= {}
end

.opengraph_providersObject



20
21
22
# File 'lib/onebox/engine/standard_embed.rb', line 20

def self.opengraph_providers
  @@opengraph_providers ||= []
end

Instance Method Details

#always_https?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/onebox/engine/standard_embed.rb', line 36

def always_https?
  AllowlistedGenericOnebox.host_matches(uri, AllowlistedGenericOnebox.https_hosts) || super
end

#rawObject



40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/onebox/engine/standard_embed.rb', line 40

def raw
  return @raw if defined?(@raw)

  @raw = {}

  set_opengraph_data_on_raw
  set_twitter_data_on_raw
  set_oembed_data_on_raw
  set_json_ld_data_on_raw
  set_favicon_data_on_raw
  set_description_on_raw

  @raw
end