flixit 0.0.15 → 0.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +83 -1
- data/VERSION +1 -1
- data/lib/flixit/record.rb +2 -0
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -4,6 +4,89 @@ Heavily based on the {flixcloud gem}[http://github.com/flixcloud/flix_cloud-gem]
|
|
4
4
|
I removed dependancies on a specific httpclient. To play nice with fakeweb this gem relies on rest-client.
|
5
5
|
I will improve tests as I go.
|
6
6
|
|
7
|
+
== Installation
|
8
|
+
|
9
|
+
Install the gem
|
10
|
+
|
11
|
+
gem install flixit
|
12
|
+
|
13
|
+
Require the gem in your rails app
|
14
|
+
|
15
|
+
config.gem 'flixit'
|
16
|
+
|
17
|
+
The gem looks for the ssl key and certificate stored heroku-style.
|
18
|
+
|
19
|
+
ENV['SSL_KEY']
|
20
|
+
ENV['SSL_CERT']
|
21
|
+
|
22
|
+
You can always load them up from the files in an initializer.
|
23
|
+
|
24
|
+
== Usage
|
25
|
+
|
26
|
+
=== Creating Jobs
|
27
|
+
|
28
|
+
====== From the {flixcloud gem}[http://github.com/flixcloud/flix_cloud-gem] README
|
29
|
+
|
30
|
+
You can create jobs using the Job class:
|
31
|
+
|
32
|
+
job = FlixCloud::Job.new(:api_key => 'your-api-key-here',
|
33
|
+
:recipe_id => 1,
|
34
|
+
:input_url => 'http://url/to/your/input/file',
|
35
|
+
:output_url => 'ftp://url/to/your/output/file',
|
36
|
+
:output_user => 'username-for-ftp-here',
|
37
|
+
:output_password => 'password-for-ftp-here',
|
38
|
+
:watermark_url => 's3://url/to/your/watermark/file',
|
39
|
+
:thumbnails_url => 's3://url/to/your/thumbnail-out-file')
|
40
|
+
job.valid? # true or false
|
41
|
+
job.save # true or false
|
42
|
+
job.id # returns the id of the saved job, or nil if it failed to save
|
43
|
+
job.initialized_at # returns the time the job was created, or nil if it failed to save
|
44
|
+
|
45
|
+
Job is modeled after ActiveRecord, so create, create!, save, save!, etc all work.
|
46
|
+
|
47
|
+
See {this}[http://flixcloud.com/api#sending_jobs_to_flix_cloud] for more information.
|
48
|
+
|
49
|
+
=== Job Notifications
|
50
|
+
|
51
|
+
When you receive a notification from FlixCloud, you can process it using the Notification class:
|
52
|
+
|
53
|
+
job = FlixCloud::Notification.new(notification_xml_or_hash)
|
54
|
+
job.successful? # true if the state is 'successful_job', false if not
|
55
|
+
job.failed? # true if the state is 'failed_job', false if not
|
56
|
+
job.cancelled? # true if the state is 'cancelled_job', false if not
|
57
|
+
job.id # the id of the job that finished
|
58
|
+
job.finished_job_at # the time the job finished at
|
59
|
+
job.initialized_job_at # the time the job was created at
|
60
|
+
job.recipe_name # the name of the recipe used to process the job
|
61
|
+
job.recipe_id # the id of the recipe used to process the job
|
62
|
+
job.state # the state of the finished job. 'successful_job', 'failed_job', or 'cancelled_job'
|
63
|
+
job.error_message # the error message given for the job if it failed to process
|
64
|
+
job.input_media_file.url # url of the input file
|
65
|
+
job.input_media_file.width # width of the input file in pixels
|
66
|
+
job.input_media_file.height # height of the input file in pixels
|
67
|
+
job.input_media_file.size # size of the input file in bytes
|
68
|
+
job.input_media_file.duration # duration of the input file in milliseconds
|
69
|
+
job.input_media_file.cost # cost of the input file in millicents (1/1000th of a cent)
|
70
|
+
job.output_media_file.url # url of the output file
|
71
|
+
job.output_media_file.width # width of the output file in pixels
|
72
|
+
job.output_media_file.height # height of the output file in pixels
|
73
|
+
job.output_media_file.size # size of the output file in bytes
|
74
|
+
job.output_media_file.duration # duration of the output file in milliseconds
|
75
|
+
job.output_media_file.cost # cost of the output file in millicents (1/1000th of a cent)
|
76
|
+
job.watermark_file.url # url of the watermark file
|
77
|
+
job.watermark_file.size # size of the watermark file in bytes
|
78
|
+
job.watermark_file.cost # cost of the watermark file in millicents (1/1000th of a cent)
|
79
|
+
|
80
|
+
See {this}[http://flixcloud.com/api#job_notifications] for more information.
|
81
|
+
|
82
|
+
Note
|
83
|
+
----
|
84
|
+
|
85
|
+
Creating jobs sends HTTP requests to FlixCloud, which may take some time. It's
|
86
|
+
best to do this asynchronously in your application.
|
87
|
+
|
88
|
+
|
89
|
+
|
7
90
|
== Note on Patches/Pull Requests
|
8
91
|
|
9
92
|
* Fork the project.
|
@@ -16,5 +99,4 @@ I will improve tests as I go.
|
|
16
99
|
|
17
100
|
== Copyright
|
18
101
|
|
19
|
-
|
20
102
|
Copyright (c) 2010 Leandro Pedroni. See LICENSE for details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.16
|
data/lib/flixit/record.rb
CHANGED
@@ -34,6 +34,8 @@ protected
|
|
34
34
|
begin
|
35
35
|
flixcloud = RestClient::Resource.new(
|
36
36
|
"https://flixcloud.com/#{path}",
|
37
|
+
:ssl_client_cert => ENV['SSL_CERT'] ? OpenSSL::X509::Certificate.new(ENV['SSL_CERT']) : nil,
|
38
|
+
:ssl_client_key => ENV['SSL_KEY'] ? OpenSSL::PKey::RSA.new(ENV['SSL_KEY'], "") : nil,
|
37
39
|
:ssl_ca_file => Flixit::CA_FILE,
|
38
40
|
:verify_ssl => OpenSSL::SSL::VERIFY_PEER
|
39
41
|
)
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 16
|
9
|
+
version: 0.0.16
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Leandro Pedroni
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-05-
|
17
|
+
date: 2010-05-05 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|