elastic_transcoder 0.0.2
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/.gitignore +33 -0
- data/.project +18 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +34 -0
- data/Rakefile +2 -0
- data/elastic_transcoder.gemspec +21 -0
- data/lib/elastic_transcoder/jobs.rb +48 -0
- data/lib/elastic_transcoder/pipeline.rb +44 -0
- data/lib/elastic_transcoder/transcoder/authentication.rb +183 -0
- data/lib/elastic_transcoder/transcoder/configuration.rb +27 -0
- data/lib/elastic_transcoder/transcoder.rb +25 -0
- data/lib/elastic_transcoder/utilities.rb +35 -0
- data/lib/elastic_transcoder/version.rb +3 -0
- data/lib/elastic_transcoder.rb +14 -0
- metadata +109 -0
data/.gitignore
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
*.gem
|
|
2
|
+
*.rbc
|
|
3
|
+
.bundle
|
|
4
|
+
.config
|
|
5
|
+
.yardoc
|
|
6
|
+
Gemfile.lock
|
|
7
|
+
InstalledFiles
|
|
8
|
+
_yardoc
|
|
9
|
+
coverage
|
|
10
|
+
doc/
|
|
11
|
+
lib/bundler/man
|
|
12
|
+
pkg
|
|
13
|
+
rdoc
|
|
14
|
+
spec/reports
|
|
15
|
+
test/tmp
|
|
16
|
+
test/version_tmp
|
|
17
|
+
tmp
|
|
18
|
+
*.rbc
|
|
19
|
+
*.sassc
|
|
20
|
+
.sass-cache
|
|
21
|
+
capybara-*.html
|
|
22
|
+
.rspec
|
|
23
|
+
/.bundle
|
|
24
|
+
/vendor/bundle
|
|
25
|
+
/log/*
|
|
26
|
+
/tmp/*
|
|
27
|
+
/db/*.sqlite3
|
|
28
|
+
/public/system/*
|
|
29
|
+
/coverage/
|
|
30
|
+
/spec/tmp/*
|
|
31
|
+
**.orig
|
|
32
|
+
rerun.txt
|
|
33
|
+
pickle-email-*.html
|
data/.project
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<projectDescription>
|
|
3
|
+
<name>elastic_transcoder</name>
|
|
4
|
+
<comment></comment>
|
|
5
|
+
<projects>
|
|
6
|
+
</projects>
|
|
7
|
+
<buildSpec>
|
|
8
|
+
<buildCommand>
|
|
9
|
+
<name>com.aptana.ide.core.unifiedBuilder</name>
|
|
10
|
+
<arguments>
|
|
11
|
+
</arguments>
|
|
12
|
+
</buildCommand>
|
|
13
|
+
</buildSpec>
|
|
14
|
+
<natures>
|
|
15
|
+
<nature>org.radrails.rails.core.railsnature</nature>
|
|
16
|
+
<nature>com.aptana.ruby.core.rubynature</nature>
|
|
17
|
+
</natures>
|
|
18
|
+
</projectDescription>
|
data/Gemfile
ADDED
data/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2013 ronald05arias
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# ElasticTranscoder
|
|
2
|
+
|
|
3
|
+
TODO: Write a gem description
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
gem 'elastic_transcoder'
|
|
10
|
+
|
|
11
|
+
And then execute:
|
|
12
|
+
|
|
13
|
+
$ bundle
|
|
14
|
+
|
|
15
|
+
Or install it yourself as:
|
|
16
|
+
|
|
17
|
+
$ gem install elastic_transcoder
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
TODO: Write usage instructions here
|
|
22
|
+
|
|
23
|
+
## Contributing
|
|
24
|
+
|
|
25
|
+
1. Fork it
|
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
27
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
29
|
+
5. Create new Pull Request
|
|
30
|
+
=======
|
|
31
|
+
elastic_transcoder
|
|
32
|
+
==================
|
|
33
|
+
|
|
34
|
+
Amazon Elastic Transcoder frontend
|
data/Rakefile
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
require File.expand_path('../lib/elastic_transcoder/version', __FILE__)
|
|
3
|
+
|
|
4
|
+
Gem::Specification.new do |gem|
|
|
5
|
+
gem.authors = ["ronald05arias"]
|
|
6
|
+
gem.email = ["ronald05arias@gmail.com"]
|
|
7
|
+
gem.description = %q{This gem is intended to manage the elastic transcoder services of Amazon Web Services}
|
|
8
|
+
gem.summary = %q{Frontend for Amazon Elastic Transcoding }
|
|
9
|
+
gem.homepage = ""
|
|
10
|
+
|
|
11
|
+
gem.files = `git ls-files`.split($\)
|
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
|
14
|
+
gem.name = "elastic_transcoder"
|
|
15
|
+
gem.require_paths = ["lib"]
|
|
16
|
+
gem.version = ElasticTranscoder::VERSION
|
|
17
|
+
|
|
18
|
+
gem.add_dependency "httparty"
|
|
19
|
+
gem.add_dependency "multi_json"
|
|
20
|
+
gem.add_dependency "multi_xml"
|
|
21
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
module ElasticTranscoder
|
|
2
|
+
require "elastic_transcoder/utilities"
|
|
3
|
+
class Jobs
|
|
4
|
+
|
|
5
|
+
def initialize
|
|
6
|
+
@utilities = ElasticTranscoder::Utilities.new
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def jobs_by_pipeline pipeline_id
|
|
10
|
+
action = "jobsByPipeline/#{pipeline_id}"
|
|
11
|
+
headers = @utilities.initialize_headers action, {:method=>"GET", :payload=>""}
|
|
12
|
+
url = @utilities.build_url action
|
|
13
|
+
response = @utilities.execute_get url, headers
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
#Valid statuses [Submitted|Progressing|Complete|Canceled|Error"]
|
|
17
|
+
def jobs_by_status status
|
|
18
|
+
action = "jobsByStatus/#{status}"
|
|
19
|
+
headers = @utilities.initialize_headers action, {:method=>"GET", :payload=>""}
|
|
20
|
+
url = @utilities.build_url action
|
|
21
|
+
response = @utilities.execute_get url, headers
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def job job_id
|
|
25
|
+
action = "jobs/#{job_id}"
|
|
26
|
+
headers = @utilities.initialize_headers action, {:method=>"GET", :payload=>""}
|
|
27
|
+
url = @utilities.build_url action
|
|
28
|
+
response = @utilities.execute_get url, headers
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
#preset Generic 480p 16:9 => 1351620000000-000020
|
|
32
|
+
def create_job input_key, output_key, pipeline_id, preset_id, thumbnail_pattern
|
|
33
|
+
action = "jobs"
|
|
34
|
+
creation_params = '{"Input":{"Key":"'+input_key+'","FrameRate":"auto","Resolution":"auto","AspectRatio":"auto","Interlaced":"auto","Container":"auto"}, "Output":{"Key":"'+output_key+'","ThumbnailPattern":"'+thumbnail_pattern+'","Rotate":"0","PresetId":"'+preset_id+'"} ,"PipelineId":"'+pipeline_id+'"}'
|
|
35
|
+
headers = @utilities.initialize_headers action, {:method=>"POST", :payload=>creation_params}
|
|
36
|
+
url = @utilities.build_url action
|
|
37
|
+
response = @utilities.execute_post url, headers, creation_params
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def delete_job job_id
|
|
41
|
+
action = "jobs/#{job_id}"
|
|
42
|
+
headers = @utilities.initialize_headers action, {:method=>"DELETE", :payload=>""}
|
|
43
|
+
url = @utilities.build_url action
|
|
44
|
+
response = @utilities.execute_delete url, headers
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
module ElasticTranscoder
|
|
2
|
+
require 'elastic_transcoder/utilities.rb'
|
|
3
|
+
class Pipeline
|
|
4
|
+
|
|
5
|
+
def initialize
|
|
6
|
+
@utilities = ElasticTranscoder::Utilities.new
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def create_pipeline name, input_bucket, output_bucket, role
|
|
10
|
+
action = "pipelines"
|
|
11
|
+
creation_params = '{"Name":"'+name+'","InputBucket":"'+input_bucket+'","OutputBucket":"'+output_bucket+'","Role":"'+role+'","Notifications":{"Progressing":"","Completed":"","Warning":"","Error":"arn:aws:sns:us-east-1:111222333444:ETS_Errors"}}'
|
|
12
|
+
headers = @utilities.initialize_headers action, {:method=>"POST", :payload=>creation_params}
|
|
13
|
+
url = @utilities.build_url action
|
|
14
|
+
response = @utilities.execute_post url, headers, creation_params
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def pipeline pipeline_id
|
|
18
|
+
action = "pipelines/#{pipeline_id}"
|
|
19
|
+
headers = @utilities.initialize_headers action, {:method=>"GET", :payload=>""}
|
|
20
|
+
url = @utilities.build_url action
|
|
21
|
+
response = @utilities.execute_get url, headers
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def pipelines
|
|
25
|
+
action = "pipelines"
|
|
26
|
+
headers = @utilities.initialize_headers action, {:method=>"GET", :payload=>""}
|
|
27
|
+
url = @utilities.build_url action
|
|
28
|
+
response = @utilities.execute_get url, headers
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def delete_pipeline pipeline_id
|
|
32
|
+
action = "pipelines/#{pipeline_id}"
|
|
33
|
+
headers = @utilities.initialize_headers action, {:method=>"DELETE", :payload=>""}
|
|
34
|
+
url = @utilities.build_url action
|
|
35
|
+
response = @utilities.execute_delete url, headers
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
#pipe = ElasticTranscoder::Pipeline.new
|
|
42
|
+
#puts pipe.pipelines
|
|
43
|
+
|
|
44
|
+
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
module ElasticTranscoder
|
|
2
|
+
module Transcoder
|
|
3
|
+
require 'cgi'
|
|
4
|
+
require 'openssl'
|
|
5
|
+
require "base64"
|
|
6
|
+
require 'digest'
|
|
7
|
+
require "time"
|
|
8
|
+
module Authentication
|
|
9
|
+
@@digest1 = OpenSSL::Digest::Digest.new("sha1")
|
|
10
|
+
@@digest256 = nil
|
|
11
|
+
if OpenSSL::OPENSSL_VERSION_NUMBER > 0x00908000
|
|
12
|
+
@@digest256 = OpenSSL::Digest::Digest.new("sha256") rescue nil # Some installation may not support sha256
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Set a timestamp and a signature version
|
|
16
|
+
def self.format_service_params(service_hash, signature)
|
|
17
|
+
service_hash["Timestamp"] ||= Time.now.utc.strftime("%Y-%m-%dT%H:%M:%S.000Z") unless service_hash["Expires"]
|
|
18
|
+
service_hash["SignatureVersion"] = signature
|
|
19
|
+
service_hash
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def self.escape_val(val)
|
|
23
|
+
CGI.escape(val)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def self.amz_escape(param)
|
|
27
|
+
param = param.to_s
|
|
28
|
+
escaped = escape_val(param)
|
|
29
|
+
#escaped = escaped.gsub("~","%7E")
|
|
30
|
+
escaped = escaped.gsub("+", "%20")
|
|
31
|
+
escaped = escaped.gsub("*", "%2A")
|
|
32
|
+
escaped
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def self.full_date date
|
|
36
|
+
"Mon, 09 Sep 2011 23:36:00 GMT"
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def self.amz_date date
|
|
40
|
+
date.strftime("%Y-%m-%dT%H:%M:%SZ")
|
|
41
|
+
end
|
|
42
|
+
def self.x_amz_date date
|
|
43
|
+
date.strftime("%Y%m%dT%H%M%SZ")
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def self.normal_date date
|
|
47
|
+
date.strftime("%Y%m%d")
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def self.generate_service_hash aws_access_key, action, date, api_version, algorithm, signature
|
|
51
|
+
service_hash = {"Action" => action,
|
|
52
|
+
"AWSAccessKeyId" => aws_access_key}
|
|
53
|
+
service_hash.update("Version" => api_version) if api_version
|
|
54
|
+
service_hash.update("X-Amz-Algorithm" => algorithm)
|
|
55
|
+
service_hash.update("X-Amz-Credential" => "#{aws_access_key}/20120925/us-east-1/elastictranscoder/aws4_request")
|
|
56
|
+
service_hash.update("X-Amz-Date" => (amz_date date.iso8601))
|
|
57
|
+
service_hash.update("X-Amz-SignedHeaders" => "content-type;host;x-amz-date") # ???
|
|
58
|
+
service_hash.update("X-Amz-Signature" => signature)
|
|
59
|
+
service_hash
|
|
60
|
+
#service_hash.update(user_params)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def self.generate_canonical_string params_hash
|
|
64
|
+
canonical_string = params_hash.keys.sort.map do |key|
|
|
65
|
+
"#{amz_escape(key)}=#{amz_escape(params_hash[key])}" #unless key=="X-Amz-Signature"
|
|
66
|
+
end.join('&')
|
|
67
|
+
canonical_string
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def self.sign_request_v3 aws_secret_key, date
|
|
71
|
+
algorithm = @@digest256 ? 'HmacSHA256' : 'HmacSHA1'
|
|
72
|
+
# Select a digest
|
|
73
|
+
digest = (algorithm == 'HmacSHA256' ? @@digest256 : @@digest1)
|
|
74
|
+
signature = (Base64.encode64(OpenSSL::HMAC.digest(digest, aws_secret_key, date.httpdate)).strip)
|
|
75
|
+
return signature, algorithm
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def self.prepare_query_string host, canonical_string
|
|
79
|
+
"https://#{host}/?#{canonical_string}"
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def self.generate_signed_request aws_access_key, aws_secret_key, action, api_version, host
|
|
83
|
+
date = Time.now.getutc
|
|
84
|
+
signature, algorithm = sign_request_v3(aws_secret_key, date)
|
|
85
|
+
service_hash = generate_service_hash aws_access_key, action, date, api_version, algorithm, signature
|
|
86
|
+
canonical_string = generate_canonical_string service_hash
|
|
87
|
+
#headers = {}
|
|
88
|
+
#headers['X-Amzn-Credential'] = "AWS3-HTTPS AWSAccessKeyId=#{aws_access_key}, Algorithm=#{algorithm.upcase}, Signature=#{signature}"
|
|
89
|
+
#headers['Date'] = date.httpdate
|
|
90
|
+
prepare_query_string host, canonical_string
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
############################
|
|
94
|
+
|
|
95
|
+
def self.hash_value value
|
|
96
|
+
sha256 = Digest::SHA256.new
|
|
97
|
+
sha256.digest value
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def self.hmac key, value
|
|
101
|
+
OpenSSL::HMAC.digest(@@digest256, key, value)
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def self.hex_encode value
|
|
105
|
+
#OpenSSL::HMAC.hexdigest(@@digest256, key, value)
|
|
106
|
+
Digest.hexencode value
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def self.generate_query_string action, api_version, user_params
|
|
110
|
+
query_string = {}
|
|
111
|
+
#query_string = {"Action" => action,
|
|
112
|
+
# "Version" => api_version}
|
|
113
|
+
if user_params
|
|
114
|
+
user_params.each do |key, value|
|
|
115
|
+
query_string.update(key=>value)
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
return generate_canonical_string query_string
|
|
120
|
+
end
|
|
121
|
+
def self.generate_canonical_header host, date
|
|
122
|
+
canonical_header = "host:#{host}\nx-amz-date:#{amz_date date}"
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
def self.sign_payload payload
|
|
126
|
+
hex_encode hash_value(payload)
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
def self.generate_canonical_request aws_secret_key, method, host, uri, date, query_string, payload
|
|
130
|
+
canonical_request = "#{method}\n#{uri}\n#{query_string}\n#{generate_canonical_header host, date}\n\nhost;x-amz-date\n#{sign_payload payload}"
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
def self.credential_scope date, region
|
|
134
|
+
"#{normal_date date}/#{region}/elastictranscoder/aws4_request"
|
|
135
|
+
#"20110909/us-east-1/host/aws4_request"
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
def self.generate_string_to_sign date, canonical_request_hash, region
|
|
139
|
+
"AWS4-HMAC-SHA256\n#{x_amz_date date.gmtime}\n#{credential_scope date, region}\n#{canonical_request_hash}"
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
def self.generate_derived_signing_key aws_secret_key, date, region
|
|
143
|
+
hmac(hmac(hmac(hmac("AWS4" + aws_secret_key,(normal_date date.gmtime)),region),"elastictranscoder"),"aws4_request")
|
|
144
|
+
#hmac(hmac(hmac(hmac("AWS4" + aws_secret_key,(normal_date date)),region),"host"),"aws4_request")
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
def self.generate_signature derived_signing_key, string_to_sign
|
|
148
|
+
hex_encode(hmac(derived_signing_key, string_to_sign))
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
def self.sign_request_v4 aws_access_key, aws_secret_key, host, method, action, api_version, user_params, date, region, payload
|
|
152
|
+
#Step1
|
|
153
|
+
#query_string = "foo=Zoo&"+(generate_query_string action, api_version, user_params)
|
|
154
|
+
query_string = generate_query_string action, api_version, user_params
|
|
155
|
+
#puts "query_string: #{query_string}\n\n"
|
|
156
|
+
canonical_request = generate_canonical_request aws_secret_key, method, host, "/#{api_version}/#{action}", date, query_string, payload
|
|
157
|
+
puts "canonical_request: #{canonical_request}\n\n"
|
|
158
|
+
canonical_request_hash = hex_encode hash_value(canonical_request)
|
|
159
|
+
puts "canonical_request_hash: #{canonical_request_hash}\n\n"
|
|
160
|
+
|
|
161
|
+
#Step2
|
|
162
|
+
string_to_sign = generate_string_to_sign date, canonical_request_hash, region
|
|
163
|
+
puts "string_to_sign: #{string_to_sign}\n\n"
|
|
164
|
+
|
|
165
|
+
#Step3
|
|
166
|
+
derived_signing_key = generate_derived_signing_key aws_secret_key, date, region
|
|
167
|
+
#puts "derived_signing_key: #{derived_signing_key}\n\n"
|
|
168
|
+
signature = generate_signature derived_signing_key, string_to_sign
|
|
169
|
+
#puts "signature: #{signature}\n\n"
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
def self.build_authorization aws_access_key, aws_secret_key, host, method, action, api_version, user_params, payload
|
|
173
|
+
date = Time.now.getutc
|
|
174
|
+
region = "us-east-1"
|
|
175
|
+
signature = sign_request_v4 aws_access_key, aws_secret_key, host, method, action, api_version, user_params, date, region, payload
|
|
176
|
+
return "AWS4-HMAC-SHA256 Credential=#{aws_access_key}/#{normal_date date}/#{region}/elastictranscoder/aws4_request, SignedHeaders=host;x-amz-date, Signature=#{signature}", date.iso8601
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
#puts ElasticTranscoder::Authentication.build_authorization "access_key", "secret_key", "elastictranscoder.us-east-1.amazonaws.com", "GET", "pipelines", "2012-09-25", {}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module ElasticTranscoder
|
|
2
|
+
|
|
3
|
+
module Transcoder
|
|
4
|
+
module Configuration
|
|
5
|
+
def configure
|
|
6
|
+
yield self
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def self.amazon_credentials(value=nil)
|
|
10
|
+
@amazon_credentials = value if value
|
|
11
|
+
return @amazon_credentials
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def self.amazon_credentials=(value)
|
|
15
|
+
@amazon_credentials = value
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def amazon_credentials=(value)
|
|
19
|
+
@amazon_credentials = value
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def amazon_credentials
|
|
23
|
+
@amazon_credentials
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
require "elastic_transcoder/transcoder/configuration"
|
|
2
|
+
require "elastic_transcoder/transcoder/authentication"
|
|
3
|
+
|
|
4
|
+
module ElasticTranscoder
|
|
5
|
+
|
|
6
|
+
##
|
|
7
|
+
# See ElasticTranscoder::Transcoder::Base
|
|
8
|
+
#
|
|
9
|
+
module Transcoder
|
|
10
|
+
class Base
|
|
11
|
+
include ElasticTranscoder::Transcoder::Configuration
|
|
12
|
+
include ElasticTranscoder::Transcoder::Authentication
|
|
13
|
+
|
|
14
|
+
def self.amazon_credentials(value=nil)
|
|
15
|
+
@amazon_credentials = value if value
|
|
16
|
+
return @amazon_credentials
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def self.amazon_credentials=(value)
|
|
20
|
+
@amazon_credentials = value
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
require 'httparty'
|
|
2
|
+
require 'elastic_transcoder/transcoder/authentication'
|
|
3
|
+
require 'elastic_transcoder/transcoder'
|
|
4
|
+
module ElasticTranscoder
|
|
5
|
+
class Utilities
|
|
6
|
+
@@api_version = "2012-09-25"
|
|
7
|
+
@@host = "elastictranscoder.us-east-1.amazonaws.com"
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
#options could be [method, payload]
|
|
11
|
+
def initialize_headers action, options = {}
|
|
12
|
+
amz_credentials = ElasticTranscoder::Transcoder::Base.amazon_credentials
|
|
13
|
+
authorization, date = ElasticTranscoder::Transcoder::Authentication.build_authorization amz_credentials[:aws_access_key_id], amz_credentials[:aws_secret_access_key], @@host, options[:method], action, "2012-09-25", {}, options[:payload]
|
|
14
|
+
headers = {"Authorization"=> authorization,
|
|
15
|
+
"x-amz-date"=>date,
|
|
16
|
+
"Content-Length"=>"#{options[:payload].size}"}
|
|
17
|
+
return headers
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def build_url action
|
|
21
|
+
"https://#{@@host}/#{@@api_version}/#{action}"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def execute_get url, headers
|
|
25
|
+
HTTParty.get url, :headers=>headers
|
|
26
|
+
end
|
|
27
|
+
def execute_post url, headers, body
|
|
28
|
+
HTTParty.post url, :body=>body, :headers=>headers
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def execute_delete url, headers
|
|
32
|
+
HTTParty.delete url, :headers=>headers
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
require "elastic_transcoder/version"
|
|
2
|
+
require "elastic_transcoder/transcoder"
|
|
3
|
+
|
|
4
|
+
module ElasticTranscoder
|
|
5
|
+
|
|
6
|
+
def self.configure(&block)
|
|
7
|
+
#ElasticTranscoder::Transcoder::Base.new.configure(&block)
|
|
8
|
+
ElasticTranscoder::Transcoder::Base.amazon_credentials(&block)
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
require "elastic_transcoder/utilities"
|
|
13
|
+
require "elastic_transcoder/pipeline"
|
|
14
|
+
require "elastic_transcoder/jobs"
|
metadata
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: elastic_transcoder
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.2
|
|
5
|
+
prerelease:
|
|
6
|
+
platform: ruby
|
|
7
|
+
authors:
|
|
8
|
+
- ronald05arias
|
|
9
|
+
autorequire:
|
|
10
|
+
bindir: bin
|
|
11
|
+
cert_chain: []
|
|
12
|
+
date: 2013-04-02 00:00:00.000000000 Z
|
|
13
|
+
dependencies:
|
|
14
|
+
- !ruby/object:Gem::Dependency
|
|
15
|
+
name: httparty
|
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
|
17
|
+
none: false
|
|
18
|
+
requirements:
|
|
19
|
+
- - ! '>='
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: '0'
|
|
22
|
+
type: :runtime
|
|
23
|
+
prerelease: false
|
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
+
none: false
|
|
26
|
+
requirements:
|
|
27
|
+
- - ! '>='
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: '0'
|
|
30
|
+
- !ruby/object:Gem::Dependency
|
|
31
|
+
name: multi_json
|
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
|
33
|
+
none: false
|
|
34
|
+
requirements:
|
|
35
|
+
- - ! '>='
|
|
36
|
+
- !ruby/object:Gem::Version
|
|
37
|
+
version: '0'
|
|
38
|
+
type: :runtime
|
|
39
|
+
prerelease: false
|
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
41
|
+
none: false
|
|
42
|
+
requirements:
|
|
43
|
+
- - ! '>='
|
|
44
|
+
- !ruby/object:Gem::Version
|
|
45
|
+
version: '0'
|
|
46
|
+
- !ruby/object:Gem::Dependency
|
|
47
|
+
name: multi_xml
|
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
|
49
|
+
none: false
|
|
50
|
+
requirements:
|
|
51
|
+
- - ! '>='
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '0'
|
|
54
|
+
type: :runtime
|
|
55
|
+
prerelease: false
|
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
+
none: false
|
|
58
|
+
requirements:
|
|
59
|
+
- - ! '>='
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
description: This gem is intended to manage the elastic transcoder services of Amazon
|
|
63
|
+
Web Services
|
|
64
|
+
email:
|
|
65
|
+
- ronald05arias@gmail.com
|
|
66
|
+
executables: []
|
|
67
|
+
extensions: []
|
|
68
|
+
extra_rdoc_files: []
|
|
69
|
+
files:
|
|
70
|
+
- .gitignore
|
|
71
|
+
- .project
|
|
72
|
+
- Gemfile
|
|
73
|
+
- LICENSE
|
|
74
|
+
- README.md
|
|
75
|
+
- Rakefile
|
|
76
|
+
- elastic_transcoder.gemspec
|
|
77
|
+
- lib/elastic_transcoder.rb
|
|
78
|
+
- lib/elastic_transcoder/jobs.rb
|
|
79
|
+
- lib/elastic_transcoder/pipeline.rb
|
|
80
|
+
- lib/elastic_transcoder/transcoder.rb
|
|
81
|
+
- lib/elastic_transcoder/transcoder/authentication.rb
|
|
82
|
+
- lib/elastic_transcoder/transcoder/configuration.rb
|
|
83
|
+
- lib/elastic_transcoder/utilities.rb
|
|
84
|
+
- lib/elastic_transcoder/version.rb
|
|
85
|
+
homepage: ''
|
|
86
|
+
licenses: []
|
|
87
|
+
post_install_message:
|
|
88
|
+
rdoc_options: []
|
|
89
|
+
require_paths:
|
|
90
|
+
- lib
|
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
92
|
+
none: false
|
|
93
|
+
requirements:
|
|
94
|
+
- - ! '>='
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '0'
|
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
|
+
none: false
|
|
99
|
+
requirements:
|
|
100
|
+
- - ! '>='
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
version: '0'
|
|
103
|
+
requirements: []
|
|
104
|
+
rubyforge_project:
|
|
105
|
+
rubygems_version: 1.8.24
|
|
106
|
+
signing_key:
|
|
107
|
+
specification_version: 3
|
|
108
|
+
summary: Frontend for Amazon Elastic Transcoding
|
|
109
|
+
test_files: []
|