Skip to content

Instantly share code, notes, and snippets.

@drale2k
Created April 13, 2012 15:03
Show Gist options
  • Save drale2k/2377493 to your computer and use it in GitHub Desktop.
Save drale2k/2377493 to your computer and use it in GitHub Desktop.
# Error: invalid API key
# lib/video_encoder.rb
module VideoEncoder
def self.encode(video = nil)
response = Zencoder::Job.create({:input => "test.mp4"})
puts response.inspect
end
end
# config/initializers/zencoder.rb
Zencoder.api_key = "XXXX"
# models/video.rb
class Video < ActiveRecord::Base
# Associations
has_and_belongs_to_many :categories
# Validations
validates :title, :video, :poster, :categories, :presence => true
# CarrierWave Mount Uploaders
mount_uploader :poster, VideoPosterUploader
VideoEncoder.encode
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment