Class: ElasticTranscoder::Utilities
- Inherits:
-
Object
- Object
- ElasticTranscoder::Utilities
- Defined in:
- lib/elastic_transcoder/utilities.rb
Constant Summary collapse
- @@api_version =
"2012-09-25"
- @@host =
"elastictranscoder.us-east-1.amazonaws.com"
Instance Method Summary collapse
- #build_url(action) ⇒ Object
- #execute_delete(url, headers) ⇒ Object
- #execute_get(url, headers) ⇒ Object
- #execute_post(url, headers, body) ⇒ Object
-
#initialize_headers(action, options = {}) ⇒ Object
options could be [method, payload].
Instance Method Details
#build_url(action) ⇒ Object
20 21 22 |
# File 'lib/elastic_transcoder/utilities.rb', line 20 def build_url action "https://#{@@host}/#{@@api_version}/#{action}" end |
#execute_delete(url, headers) ⇒ Object
31 32 33 |
# File 'lib/elastic_transcoder/utilities.rb', line 31 def execute_delete url, headers HTTParty.delete url, :headers=>headers end |
#execute_get(url, headers) ⇒ Object
24 25 26 |
# File 'lib/elastic_transcoder/utilities.rb', line 24 def execute_get url, headers HTTParty.get url, :headers=>headers end |
#execute_post(url, headers, body) ⇒ Object
27 28 29 |
# File 'lib/elastic_transcoder/utilities.rb', line 27 def execute_post url, headers, body HTTParty.post url, :body=>body, :headers=>headers end |
#initialize_headers(action, options = {}) ⇒ Object
options could be [method, payload]
11 12 13 14 15 16 17 18 |
# File 'lib/elastic_transcoder/utilities.rb', line 11 def initialize_headers action, = {} amz_credentials = ElasticTranscoder::Transcoder::Base.amazon_credentials , date = ElasticTranscoder::Transcoder::Authentication. amz_credentials[:aws_access_key_id], amz_credentials[:aws_secret_access_key], @@host, [:method], action, "2012-09-25", {}, [:payload] headers = {"Authorization"=> , "x-amz-date"=>date, "Content-Length"=>"#{[:payload].size}"} return headers end |