Sha256: f18297669afdd4085c9fb588f1ac95ceb2309497e668ce1045cc00fe5e79672b

Contents?: true

Size: 1.96 KB

Versions: 56

Compression:

Stored size: 1.96 KB

Contents

module Fog
  module Storage
    class InternetArchive
      class Real

        # Get a hash of hidden fields for form uploading to S3, in the form {:field_name => :field_value}
        # Form should look like: <form action="http://#{bucket_name}.#{Fog::InternetArchive::API_DOMAIN_NAME}/" method="post" enctype="multipart/form-data">
        # These hidden fields should then appear, followed by a field named 'file' which is either a textarea or file input.
        #
        # @param options Hash:
        # @option options acl [String] access control list, in ['private', 'public-read', 'public-read-write', 'authenticated-read', 'bucket-owner-read', 'bucket-owner-full-control']
        # @option options Cache-Control [String] same as REST header
        # @option options Content-Type [String] same as REST header
        # @option options Content-Disposition [String] same as REST header
        # @option options Content-Encoding [String] same as REST header
        # @option options Expires same as REST header
        # @option options key key for object, set to '${filename}' to use filename provided by user
        # @option options policy security policy for upload
        # @option options success_action_redirect url to redirct to upon success
        # @option options success_action_status status code to return on success, in [200, 201, 204]
        # @option options x-amz-security token devpay security token
        # @option options x-amz-meta... meta data tags
        #
        # @see http://docs.amazonwebservices.com/AmazonS3/latest/dev/HTTPPOSTForms.html
        # 
        def post_object_hidden_fields(options = {})
          if options['policy']
            options['policy'] = Base64.encode64(Fog::JSON.encode(options['policy'])).gsub("\n", "")
            options['AWSAccessKeyId'] = @ia_access_key_id
            options['Signature'] = Base64.encode64(@hmac.sign(options['policy'])).gsub("\n", "")
          end
          options
        end

      end
    end
  end
end

Version data entries

56 entries across 56 versions & 4 rubygems

Version Path
fog-maestrodev-1.18.0.20131205181604 lib/fog/internet_archive/requests/storage/post_object_hidden_fields.rb
fog-maestrodev-1.18.0.20131127194823 lib/fog/internet_archive/requests/storage/post_object_hidden_fields.rb
fog-maestrodev-1.18.0.20131126183714 lib/fog/internet_archive/requests/storage/post_object_hidden_fields.rb
fog-maestrodev-1.18.0.20131126122111 lib/fog/internet_archive/requests/storage/post_object_hidden_fields.rb
fog-maestrodev-1.18.0.20131125111730 lib/fog/internet_archive/requests/storage/post_object_hidden_fields.rb
fog-maestrodev-1.18.0.20131125083406 lib/fog/internet_archive/requests/storage/post_object_hidden_fields.rb
fog-maestrodev-1.18.0.20131123105121 lib/fog/internet_archive/requests/storage/post_object_hidden_fields.rb
fog-maestrodev-1.18.0.20131122203507 lib/fog/internet_archive/requests/storage/post_object_hidden_fields.rb
fog-maestrodev-1.18.0.20131121075022 lib/fog/internet_archive/requests/storage/post_object_hidden_fields.rb
fog-maestrodev-1.18.0.20131118164830 lib/fog/internet_archive/requests/storage/post_object_hidden_fields.rb
fog-maestrodev-1.18.0.20131115184302 lib/fog/internet_archive/requests/storage/post_object_hidden_fields.rb
fog-maestrodev-1.18.0.20131114200144 lib/fog/internet_archive/requests/storage/post_object_hidden_fields.rb
gapinc-fog-1.12.1.2.1 lib/fog/internet_archive/requests/storage/post_object_hidden_fields.rb
fog-maestrodev-1.18.0.20131112185232 lib/fog/internet_archive/requests/storage/post_object_hidden_fields.rb
fog-maestrodev-1.18.0.20131111203459 lib/fog/internet_archive/requests/storage/post_object_hidden_fields.rb
fog-1.18.0 lib/fog/internet_archive/requests/storage/post_object_hidden_fields.rb
fog-1.17.0 lib/fog/internet_archive/requests/storage/post_object_hidden_fields.rb
fog-1.16.0 lib/fog/internet_archive/requests/storage/post_object_hidden_fields.rb
fog-maestrodev-1.15.0.20130927082724 lib/fog/internet_archive/requests/storage/post_object_hidden_fields.rb
fog-maestrodev-1.15.0.20130829165835 lib/fog/internet_archive/requests/storage/post_object_hidden_fields.rb