Class: S3::Upload
- Inherits:
-
Object
- Object
- S3::Upload
- Defined in:
- lib/s3upload.rb
Instance Attribute Summary collapse
-
#access_key_id ⇒ Object
Returns the value of attribute access_key_id.
-
#acl ⇒ Object
Returns the value of attribute acl.
-
#bucket ⇒ Object
Returns the value of attribute bucket.
-
#expires ⇒ Object
Returns the value of attribute expires.
-
#secret_key ⇒ Object
Returns the value of attribute secret_key.
Instance Method Summary collapse
-
#initialize(access_key_id, secret_key, bucket, acl = "public-read", expires = nil) ⇒ Upload
constructor
A new instance of Upload.
- #to_xml(key, content_type) ⇒ Object
Constructor Details
#initialize(access_key_id, secret_key, bucket, acl = "public-read", expires = nil) ⇒ Upload
Returns a new instance of Upload.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/s3upload.rb', line 10 def initialize( access_key_id , secret_key , bucket , acl="public-read" , expires=nil) @access_key_id = access_key_id @secret_key = secret_key @bucket = bucket @acl = acl # default to one hour from now @expires = expires || (Time.now + 3600) end |
Instance Attribute Details
#access_key_id ⇒ Object
Returns the value of attribute access_key_id.
8 9 10 |
# File 'lib/s3upload.rb', line 8 def access_key_id @access_key_id end |
#acl ⇒ Object
Returns the value of attribute acl.
8 9 10 |
# File 'lib/s3upload.rb', line 8 def acl @acl end |
#bucket ⇒ Object
Returns the value of attribute bucket.
8 9 10 |
# File 'lib/s3upload.rb', line 8 def bucket @bucket end |
#expires ⇒ Object
Returns the value of attribute expires.
8 9 10 |
# File 'lib/s3upload.rb', line 8 def expires @expires end |
#secret_key ⇒ Object
Returns the value of attribute secret_key.
8 9 10 |
# File 'lib/s3upload.rb', line 8 def secret_key @secret_key end |
Instance Method Details
#to_xml(key, content_type) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/s3upload.rb', line 21 def to_xml( key , content_type ) @key = key @content_type = content_type props = { :accessKeyId => access_key_id, :acl => acl, :bucket => bucket, :contentType => @content_type, :expires => expiration_str, :key => @key, :secure => false, :signature => signature, :policy => policy } # Create xml of the properties xml = "<s3>" props.each {|k,v| xml << "<#{k}>#{v}</#{k}>"} xml << "</s3>" end |