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



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

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

#retryObject



31
32
33
# File 'lib/panda/resources/encoding.rb', line 31

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

#screenshotsObject



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

def screenshots
  ((1..7).map{|i| get_url("#{path}_#{i}.jpg")} if success?) || []
end

#urlObject



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

def url
  full_path = "#{path}#{extname}"
  get_url(full_path) if files.include?(full_path)
end

#urlsObject



19
20
21
# File 'lib/panda/resources/encoding.rb', line 19

def urls
  files.map {|f| "#{cloud.url}#{f}"}
end