Sha256: b6cca1e817dc60a01bf3f8bcdbd6d9076913d92f7a11353425d1fa0021e7faa1

Contents?: true

Size: 957 Bytes

Versions: 1

Compression:

Stored size: 957 Bytes

Contents

require 'aws-sdk-v1'
require 'date'
require 'pathname'
require 'uri'
require 'second_curtain/path_utils'

class Upload
  attr_reader :expected_path
  attr_reader :actual_path
  attr_accessor :uploaded_expected_url
  attr_accessor :uploaded_actual_url

  def initialize(expected_path, actual_path)
    @expected_path = expected_path
    @actual_path = actual_path
  end

  def upload(bucket, path)
    abort unless bucket
    abort unless path

    expected_filename = Pathname.new(@expected_path).basename.to_s
    expected_object = bucket.objects[PathUtils.pathWithComponents([path, expected_filename])]
    expected_object.write(:file => @expected_path)
    @uploaded_expected_url = expected_filename

    actual_filename = Pathname.new(@actual_path).basename.to_s
    actual_object = bucket.objects[PathUtils.pathWithComponents([path, actual_filename])]
    actual_object.write(:file => @actual_path)
    @uploaded_actual_url = actual_filename
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
second_curtain-0.6.0 lib/second_curtain/upload.rb