Class: Panda::Encoding

Inherits:
Resource show all
Includes:
VideoState
Defined in:
lib/panda/resources/encoding.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



9
10
11
# File 'lib/panda/resources/encoding.rb', line 9

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

Instance Method Details

#cancelObject



33
34
35
# File 'lib/panda/resources/encoding.rb', line 33

def cancel
  connection.post("/encodings/#{id}/cancel.json")['canceled']
end

#retryObject



37
38
39
# File 'lib/panda/resources/encoding.rb', line 37

def retry
  connection.post("/encodings/#{id}/retry.json")['retried']
end

#screenshots(options = {}) ⇒ Object



27
28
29
30
31
# File 'lib/panda/resources/encoding.rb', line 27

def screenshots(options={})
  default_options = {:https => false}
  options = default_options.merge(options)
  ((1..7).map{|i| get_url("#{path}_#{i}.jpg", options[:https])} if success?) || []
end

#url(options = {}) ⇒ Object



14
15
16
17
18
19
# File 'lib/panda/resources/encoding.rb', line 14

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

#urls(options = {}) ⇒ Object



21
22
23
24
25
# File 'lib/panda/resources/encoding.rb', line 21

def urls(options={})
  default_options = {:https => false}
  options = default_options.merge(options)
  files.map {|f| get_url(f, options[:https])}
end