Class: Onebox::Oembed

Inherits:
OpenGraph show all
Defined in:
lib/onebox/oembed.rb

Instance Attribute Summary

Attributes inherited from Normalizer

#data

Instance Method Summary collapse

Methods inherited from OpenGraph

#secure_image_url, #title, #title_attr

Methods inherited from Normalizer

#get, #method_missing

Constructor Details

#initialize(response) ⇒ Oembed

Returns a new instance of Oembed.



5
6
7
8
9
10
# File 'lib/onebox/oembed.rb', line 5

def initialize(response)
  @data = Onebox::Helpers.symbolize_keys(::MultiJson.load(response))

  # never use oembed from WordPress 4.4 (it's broken)
  @data.delete(:html) if @data[:html] && @data[:html]["wp-embedded-content"]
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Onebox::Normalizer

Instance Method Details

#htmlObject



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

def html
  get(:html, nil, false)
end