Module: Videojuicer::Asset::Base::InstanceMethods

Defined in:
lib/videojuicer/asset/base.rb

Instance Method Summary collapse

Instance Method Details

#derive(preset) ⇒ Object



60
61
62
63
# File 'lib/videojuicer/asset/base.rb', line 60

def derive(preset)
  response = proxy_for(config).post(resource_path, :preset_id => preset.id)
  self.class.new(JSON.parse(response.body))
end

#fileObject



65
66
67
# File 'lib/videojuicer/asset/base.rb', line 65

def file
  raise "use the value of #{self.class}#url to download a copy of the asset"
end

#returnable_attributesObject



69
70
71
72
73
# File 'lib/videojuicer/asset/base.rb', line 69

def returnable_attributes
  attrs = super
  attrs.delete(:file) unless new_record?
  attrs
end

#set_derived(from_asset, preset) ⇒ Object



75
76
77
78
79
80
81
82
83
# File 'lib/videojuicer/asset/base.rb', line 75

def set_derived(from_asset, preset)
  params = {
    :original_asset_type => from_asset.class.to_s.split("::").last,
    :original_asset_id => from_asset.id,
    :preset_id => preset.id
  }
  response = proxy_for(config).post(resource_path(:set_derived), params)
  self.attributes = JSON.parse(response.body)
end