Skip to content

Commit

Permalink
Readme updated
Browse files Browse the repository at this point in the history
  • Loading branch information
ilpoldo committed May 5, 2010
1 parent 77544ff commit f471141
Showing 1 changed file with 83 additions and 1 deletion.
84 changes: 83 additions & 1 deletion README.rdoc
Expand Up @@ -4,6 +4,89 @@ Heavily based on the {flixcloud gem}[http://github.com/flixcloud/flix_cloud-gem]
I removed dependancies on a specific httpclient. To play nice with fakeweb this gem relies on rest-client.
I will improve tests as I go.

== Installation

Install the gem

gem install flixit

Require the gem in your rails app

config.gem 'flixit'

The gem looks for the ssl key and certificate stored heroku-style.

ENV['SSL_KEY']
ENV['SSL_CERT']

You can always load them up from the files in an initializer.

== Usage

=== Creating Jobs

====== From the {flixcloud gem}[http://github.com/flixcloud/flix_cloud-gem] README

You can create jobs using the Job class:

job = FlixCloud::Job.new(:api_key => 'your-api-key-here',
:recipe_id => 1,
:input_url => 'http://url/to/your/input/file',
:output_url => 'ftp://url/to/your/output/file',
:output_user => 'username-for-ftp-here',
:output_password => 'password-for-ftp-here',
:watermark_url => 's3://url/to/your/watermark/file',
:thumbnails_url => 's3://url/to/your/thumbnail-out-file')
job.valid? # true or false
job.save # true or false
job.id # returns the id of the saved job, or nil if it failed to save
job.initialized_at # returns the time the job was created, or nil if it failed to save

Job is modeled after ActiveRecord, so create, create!, save, save!, etc all work.

See {this}[http://flixcloud.com/api#sending_jobs_to_flix_cloud] for more information.

=== Job Notifications

When you receive a notification from FlixCloud, you can process it using the Notification class:

job = FlixCloud::Notification.new(notification_xml_or_hash)
job.successful? # true if the state is 'successful_job', false if not
job.failed? # true if the state is 'failed_job', false if not
job.cancelled? # true if the state is 'cancelled_job', false if not
job.id # the id of the job that finished
job.finished_job_at # the time the job finished at
job.initialized_job_at # the time the job was created at
job.recipe_name # the name of the recipe used to process the job
job.recipe_id # the id of the recipe used to process the job
job.state # the state of the finished job. 'successful_job', 'failed_job', or 'cancelled_job'
job.error_message # the error message given for the job if it failed to process
job.input_media_file.url # url of the input file
job.input_media_file.width # width of the input file in pixels
job.input_media_file.height # height of the input file in pixels
job.input_media_file.size # size of the input file in bytes
job.input_media_file.duration # duration of the input file in milliseconds
job.input_media_file.cost # cost of the input file in millicents (1/1000th of a cent)
job.output_media_file.url # url of the output file
job.output_media_file.width # width of the output file in pixels
job.output_media_file.height # height of the output file in pixels
job.output_media_file.size # size of the output file in bytes
job.output_media_file.duration # duration of the output file in milliseconds
job.output_media_file.cost # cost of the output file in millicents (1/1000th of a cent)
job.watermark_file.url # url of the watermark file
job.watermark_file.size # size of the watermark file in bytes
job.watermark_file.cost # cost of the watermark file in millicents (1/1000th of a cent)

See {this}[http://flixcloud.com/api#job_notifications] for more information.

Note
----

Creating jobs sends HTTP requests to FlixCloud, which may take some time. It's
best to do this asynchronously in your application.



== Note on Patches/Pull Requests

* Fork the project.
Expand All @@ -16,5 +99,4 @@ I will improve tests as I go.

== Copyright


Copyright (c) 2010 Leandro Pedroni. See LICENSE for details.

0 comments on commit f471141

Please sign in to comment.