Module: Videojuicer::Resource::Embeddable

Included in:
Presentation
Defined in:
lib/videojuicer/resource/embeddable.rb

Constant Summary collapse

OEMBED_ENDPOINT =
"/oembed".freeze

Instance Method Summary collapse

Instance Method Details

#embed_code(maxwidth, maxheight) ⇒ Object



24
25
26
# File 'lib/videojuicer/resource/embeddable.rb', line 24

def embed_code(maxwidth, maxheight)
  oembed_payload(maxwidth, maxheight)["html"]
end

#embed_size(maxwidth, maxheight) ⇒ Object



19
20
21
22
# File 'lib/videojuicer/resource/embeddable.rb', line 19

def embed_size(maxwidth, maxheight)
  p = oembed_payload(maxwidth, maxheight)
  return p["width"], p["height"]
end

#oembed_payload(maxwidth, maxheight) ⇒ Object



13
14
15
16
17
# File 'lib/videojuicer/resource/embeddable.rb', line 13

def oembed_payload(maxwidth, maxheight)
  proxy = proxy_for(config)
  result = proxy.get(OEMBED_ENDPOINT, :format=>"json", :url=>"#{proxy.host_stub}#{resource_path}?seed_name=#{seed_name}", :maxwidth=>maxwidth, :maxheight=>maxheight)
  JSON.parse(result.body)
end