Sha256: 5f958dd906570ee7cc7f9c20aa32d9690e6b916ceabb0b4345016c7a9d4401a4

Contents?: true

Size: 793 Bytes

Versions: 37

Compression:

Stored size: 793 Bytes

Contents

=begin rdoc
  
  A module that provides OEmbed functionality to any Videojuicer::Resource model.

=end

module Videojuicer
  module Resource
    module Embeddable
      
      OEMBED_ENDPOINT = "/oembed".freeze
      
      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
      
      def embed_size(maxwidth, maxheight)
        p = oembed_payload(maxwidth, maxheight)
        return p["width"], p["height"]
      end
      
      def embed_code(maxwidth, maxheight)
        oembed_payload(maxwidth, maxheight)["html"]
      end
      
    end
  end
end

Version data entries

37 entries across 37 versions & 2 rubygems

Version Path
videojuicer-vj-sdk-0.1.12 lib/videojuicer/resource/embeddable.rb
vj-sdk-0.8.2 lib/videojuicer/resource/embeddable.rb
vj-sdk-0.8.0.1 lib/videojuicer/resource/embeddable.rb
vj-sdk-0.7.14 lib/videojuicer/resource/embeddable.rb
vj-sdk-0.7.13 lib/videojuicer/resource/embeddable.rb
vj-sdk-0.7.11 lib/videojuicer/resource/embeddable.rb
vj-sdk-0.7.10 lib/videojuicer/resource/embeddable.rb
vj-sdk-0.7.9 lib/videojuicer/resource/embeddable.rb
vj-sdk-0.7.8 lib/videojuicer/resource/embeddable.rb
vj-sdk-0.7.7 lib/videojuicer/resource/embeddable.rb
vj-sdk-0.7.6 lib/videojuicer/resource/embeddable.rb
vj-sdk-0.7.5 lib/videojuicer/resource/embeddable.rb
vj-sdk-0.7.4 lib/videojuicer/resource/embeddable.rb
vj-sdk-0.7.3 lib/videojuicer/resource/embeddable.rb
vj-sdk-0.7.2 lib/videojuicer/resource/embeddable.rb
vj-sdk-0.7.1 lib/videojuicer/resource/embeddable.rb
vj-sdk-0.7.0 lib/videojuicer/resource/embeddable.rb
vj-sdk-0.6.9 lib/videojuicer/resource/embeddable.rb
vj-sdk-0.6.8 lib/videojuicer/resource/embeddable.rb
vj-sdk-0.6.7 lib/videojuicer/resource/embeddable.rb