Class: S3Relay::UploadPresigner

Inherits:
Base
  • Object
show all
Defined in:
lib/s3_relay/upload_presigner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ UploadPresigner

Returns a new instance of UploadPresigner.



6
7
8
9
# File 'lib/s3_relay/upload_presigner.rb', line 6

def initialize(options={})
  @expires = (options[:expires] || 1.minute.from_now).utc.xmlschema
  @uuid    = SecureRandom.uuid
end

Instance Attribute Details

#expiresObject (readonly)

Returns the value of attribute expires.



4
5
6
# File 'lib/s3_relay/upload_presigner.rb', line 4

def expires
  @expires
end

#uuidObject (readonly)

Returns the value of attribute uuid.



4
5
6
# File 'lib/s3_relay/upload_presigner.rb', line 4

def uuid
  @uuid
end

Instance Method Details

#form_dataObject



11
12
13
14
15
16
17
18
19
# File 'lib/s3_relay/upload_presigner.rb', line 11

def form_data
  fields.keys.inject({}) { |h,k| h[k.downcase.underscore] = fields[k]; h }
    .merge(
      "endpoint"  => endpoint,
      "policy"    => encoded_policy,
      "signature" => signature,
      "uuid"      => uuid
    )
end