Class: S3DirectUpload
- Inherits:
-
Object
- Object
- S3DirectUpload
- Includes:
- S3SwfUpload::Signature
- Defined in:
- lib/forge/app/models/s3_direct_upload.rb,
lib/forge/spec/controllers/forge/videos_controller_spec.rb
Instance Attribute Summary collapse
-
#access_key_id ⇒ Object
Returns the value of attribute access_key_id.
-
#bucket ⇒ Object
Returns the value of attribute bucket.
-
#options ⇒ Object
Returns the value of attribute options.
-
#secret_access_key ⇒ Object
Returns the value of attribute secret_access_key.
Instance Method Summary collapse
-
#initialize ⇒ S3DirectUpload
constructor
A new instance of S3DirectUpload.
- #post_params ⇒ Object
- #upload_url ⇒ Object
Methods included from S3SwfUpload::Signature
#assert, #b64_hmac_sha1, #binb2b64, #binb2hex, #core_hmac_sha1, #core_sha1, #hex_sha1, #rol, #safe_add, #self_test, #sha1_ft, #sha1_kt, #str2binb
Constructor Details
#initialize ⇒ S3DirectUpload
Returns a new instance of S3DirectUpload.
6 7 8 9 10 11 12 13 |
# File 'lib/forge/app/models/s3_direct_upload.rb', line 6 def initialize(opts = {}) self. = .merge(opts.symbolize_keys) config = YAML.load_file([:config_file]) self.bucket = config[Rails.env]['bucket'] self.access_key_id = config[Rails.env]['access_key_id'] self.secret_access_key = config[Rails.env]['secret_access_key'] end |
Instance Attribute Details
#access_key_id ⇒ Object
Returns the value of attribute access_key_id.
4 5 6 |
# File 'lib/forge/app/models/s3_direct_upload.rb', line 4 def access_key_id @access_key_id end |
#bucket ⇒ Object
Returns the value of attribute bucket.
4 5 6 |
# File 'lib/forge/app/models/s3_direct_upload.rb', line 4 def bucket @bucket end |
#options ⇒ Object
Returns the value of attribute options.
4 5 6 |
# File 'lib/forge/app/models/s3_direct_upload.rb', line 4 def @options end |
#secret_access_key ⇒ Object
Returns the value of attribute secret_access_key.
4 5 6 |
# File 'lib/forge/app/models/s3_direct_upload.rb', line 4 def secret_access_key @secret_access_key end |
Instance Method Details
#post_params ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/forge/app/models/s3_direct_upload.rb', line 15 def post_params { "key" => "#{[:key]}/#{time}-${filename}", "AWSAccessKeyId" => "#{access_key_id}", "acl" => "#{[:acl]}", "policy" => "#{policy}", "signature" => "#{signature}", "success_action_status" => "201", "__utma" => "1", "__utmb" => "1", "__utmc" => "1", "__utmz" => "1", "auth_token" => "1" } end |
#upload_url ⇒ Object
31 32 33 |
# File 'lib/forge/app/models/s3_direct_upload.rb', line 31 def upload_url "http://#{bucket}.s3.amazonaws.com/" end |