Class: Viddlereo::Video

Inherits:
Resource show all
Defined in:
lib/viddlereo/video.rb

Constant Summary

Constants inherited from Resource

Resource::BASE_URI

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

auth_required, auth_required?, client, default_options, get, inherited, #initialize, param, params, #params, post, resource_name, uri

Constructor Details

This class inherits a constructor from Viddlereo::Resource

Class Method Details

.find_by_id(identifier, options = {}) ⇒ Object



23
24
25
26
27
28
# File 'lib/viddlereo/video.rb', line 23

def self.find_by_id(identifier, options = {})
  response = get(:method => :getDetails, 
    :video_id => identifier,
    :add_embed_code => options[:add_embed_code] || 3)
  video = parse(response)
end

.prepare_uploadObject



43
44
45
# File 'lib/viddlereo/video.rb', line 43

def self.prepare_upload
  Viddlereo::Upload.prepare
end

Instance Method Details

#get_embed_code(options = {}) ⇒ Object



36
37
38
39
40
41
# File 'lib/viddlereo/video.rb', line 36

def get_embed_code(options = {})
  response = self.class.get(:method => :getEmbedCode,
    :video_id => self.id,
    :embed_code => options[:embed_code] || 3)
  self.embed_code = self.class.parse(response).embed_code
end

#update_attributes(options = {}) ⇒ Object



30
31
32
33
34
# File 'lib/viddlereo/video.rb', line 30

def update_attributes(options = {})
  response = self.class.post({
    :method => :setDetails,
    :video_id => self.id}.merge(options))
end