Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

support deleting conversions (for regenerating watermarks, for example)

  • Loading branch information...
commit f09e9385be4786e6125826b48d2687e931e4be94 1 parent 63f74c6
Joshua Sierles authored

Showing 1 changed file with 13 additions and 2 deletions. Show diff stats Hide diff stats

  1. +13 2 lib/bits_on_the_run/video_conversion.rb
15 lib/bits_on_the_run/video_conversion.rb
@@ -3,12 +3,15 @@ class VideoConversion
3 3 def self.list(video_key)
4 4 client = Client.new('/videos/conversions/list', :video_key => video_key)
5 5 client.response.elements["//conversions"].map do |fragment|
6   - puts fragment.to_s
7 6 new(REXML::Document.new(fragment.to_s)) if fragment.respond_to?(:name)
8 7 end.compact
9 8 end
10 9
11   - attr_reader :key
  10 + def self.delete(conversion_key)
  11 + Client.new('/videos/conversions/delete', :conversion_key => conversion_key).response
  12 + end
  13 +
  14 + attr_reader :key, :duration, :width, :height
12 15 attr_accessor :file_size, :status, :template_id, :error_message
13 16
14 17 def initialize(*args)
@@ -18,12 +21,17 @@ def initialize(*args)
18 21 initialize_from_hash(*args)
19 22 end
20 23 end
  24 +
  25 + private
21 26
22 27 def initialize_from_hash(params = {})
23 28 params = params.symbolize_keys
24 29 @key = params[:key]
25 30 self.file_size = params[:file_size]
26 31 self.status = params[:status]
  32 + @duration = params[:duration]
  33 + @height = params[:height]
  34 + @width = params[:width]
27 35 self.template_id = params[:template_id]
28 36 self.error_message = params[:error_message]
29 37 end
@@ -32,6 +40,9 @@ def initialize_from_xml(doc)
32 40 initialize_from_hash(
33 41 :key => extract_xpath(doc, "//@key"),
34 42 :file_size => extract_xpath(doc, "//filesize").to_i,
  43 + :duration => extract_xpath(doc, "//duration").to_f,
  44 + :height => extract_xpath(doc, "//height").to_i,
  45 + :width => extract_xpath(doc, "//width").to_i,
35 46 :status => extract_xpath(doc, "//status"),
36 47 :template_id => extract_xpath(doc, "//template/@id").to_i,
37 48 :error_message => extract_xpath(doc, "//error/message")

0 comments on commit f09e938

Please sign in to comment.
Something went wrong with that request. Please try again.