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
vj-sdk-0.6.5 lib/videojuicer/resource/embeddable.rb
vj-sdk-0.6.4 lib/videojuicer/resource/embeddable.rb
vj-sdk-0.6.3 lib/videojuicer/resource/embeddable.rb
vj-sdk-0.6.1 lib/videojuicer/resource/embeddable.rb
vj-sdk-0.6.0 lib/videojuicer/resource/embeddable.rb
vj-sdk-0.5.6 lib/videojuicer/resource/embeddable.rb
vj-sdk-0.5.5 lib/videojuicer/resource/embeddable.rb
vj-sdk-0.5.4 lib/videojuicer/resource/embeddable.rb
vj-sdk-0.5.3 lib/videojuicer/resource/embeddable.rb
vj-sdk-0.5.2 lib/videojuicer/resource/embeddable.rb
vj-sdk-0.5.1 lib/videojuicer/resource/embeddable.rb
vj-sdk-0.5.0 lib/videojuicer/resource/embeddable.rb
vj-sdk-0.4.3 lib/videojuicer/resource/embeddable.rb
vj-sdk-0.4.2 lib/videojuicer/resource/embeddable.rb
vj-sdk-0.4.1 lib/videojuicer/resource/embeddable.rb
vj-sdk-0.4.0 lib/videojuicer/resource/embeddable.rb
vj-sdk-0.2.1 lib/videojuicer/resource/embeddable.rb