features/steps/sandbox_steps.rb
# Upload the given file to the sandbox which was created by 'when I create a
# sandbox named'
Upload the given file to the sandbox which was created by 'when I create a
sandbox named'
Upload the given file to the sandbox which was created by ' when I create a sandbox named '
def upload_to_sandbox(sandbox_filename, sandbox_file_checksum, url)
  checksum64 = Base64.encode64([sandbox_file_checksum].pack("H*")).strip
  timestamp = Time.now.utc.iso8601
  file_contents = File.read(sandbox_filename)
  sign_obj = Mixlib::Authentication::SignedHeaderAuth.signing_object(
                                                                     :http_method => :put,
                                                                     :path => URI.parse(url).path,
                                                                     :body => file_contents,
                                                                     :timestamp => timestamp,
                                                                     :user_id => rest.client_name
                                                                     )
  headers = { 
    'content-type' => 'application/x-binary', 
    'content-md5' => checksum64, 
    :accept => 'application/json'
  }
  headers.merge!(sign_obj.sign(OpenSSL::PKey::RSA.new(rest.signing_key)))
  self.inflated_response = nil
  self.exception = nil
  self.api_response = RestClient::Request.execute(
    :method => :put, 
    :url => url, 
    :headers => headers, 
    :payload => file_contents
  )
end
def upload_to_sandbox ( sandbox_filename , sandbox_file_checksum , url ) checksum64 = Base64 . encode64 ( [ sandbox_file_checksum ] . pack ( "H*" ) ) . strip timestamp = Time . now . utc . iso8601 file_contents = File . read ( sandbox_filename ) sign_obj = Mixlib :: Authentication :: SignedHeaderAuth . signing_object ( :http_method => :put , :path => URI . parse ( url ) . path , :body => file_contents , :timestamp => timestamp , :user_id => rest . client_name ) headers = { 'content-type' => 'application/x-binary' , 'content-md5' => checksum64 , :accept => 'application/json' } headers . merge! ( sign_obj . sign ( OpenSSL :: PKey :: RSA . new ( rest . signing_key ) ) ) self . inflated_response = nil self . exception = nil self . api_response = RestClient :: Request . execute ( :method => :put , :url => url , :headers => headers , :payload => file_contents ) end
Upload the given file to the sandbox which was created by 'when I create a
sandbox named'
Upload the given file to the sandbox which was created by ' when I create a sandbox named '
# TODO - 5/28/2010, cw: make signing and sending the request streaming # Don't set inflated_response as S3 (for the Platform) doesn't return JSON. # Only Open Source does.
sandbox_filename
<not_specific>
sandbox_file_checksum
<not_specific>
url
<not_specific>