Class: Panda::Video

Inherits:
Resource show all
Includes:
VideoState
Defined in:
lib/panda/resources/video.rb

Constant Summary

Constants included from Router

Router::VAR_PATTERN

Instance Attribute Summary

Attributes inherited from Base

#attributes, #errors

Class Method Summary collapse

Instance Method Summary collapse

Methods included from VideoState

#fail?, #processing?, #success?

Methods inherited from Resource

#cloud, cloud, #initialize, method_missing, #reload

Methods included from CloudConnection

#connection

Methods included from Associations

included

Methods included from Destroyers

#delete, included

Methods inherited from Base

#changed?, #id, #id=, #initialize, #inspect, #new?, #reload, sti_name, #to_json

Methods included from Finders

included

Methods included from Builders

#create, #create!, included

Methods included from Router

included, #replace_pattern_with_self_variables

Constructor Details

This class inherits a constructor from Panda::Resource

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Panda::Base

Class Method Details

.firstObject



7
8
9
# File 'lib/panda/resources/video.rb', line 7

def first
  VideoScope.new(self).per_page(1).first
end

Instance Method Details

#metadataObject



12
13
14
# File 'lib/panda/resources/video.rb', line 12

def 
  connection.get("/videos/#{id}/metadata.json")
end

#preview_url(options = {}) ⇒ Object



16
17
18
19
20
# File 'lib/panda/resources/video.rb', line 16

def preview_url(options={})
  default_options = {:https => false}
  options = default_options.merge(options)
  get_url("#{path}_1.jpg", options[:https]) if success?
end

#url(options = {}) ⇒ Object



22
23
24
25
26
# File 'lib/panda/resources/video.rb', line 22

def url(options={})
  default_options = {:https => false}
  options = default_options.merge(options)
  get_url("#{path}#{extname}", options[:https]) if success?
end