Sha256: 63c70119ec71da274fc1a1412d6296bfb660087c5dbe995abb934060444586bb

Contents?: true

Size: 888 Bytes

Versions: 4

Compression:

Stored size: 888 Bytes

Contents

require 'aws-sdk-v1'
require 'date'
require 'pathname'
require 'uri'

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[path + "/" + expected_filename]
    expected_object.write(:file => @expected_path)
    @uploaded_expected_url = expected_object.public_url

    actual_filename = Pathname.new(@actual_path).basename.to_s
    actual_object = bucket.objects[path + "/" + actual_filename]
    actual_object.write(:file => @actual_path)
    @uploaded_actual_url = actual_object.public_url
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
second_curtain-0.5.0 lib/second_curtain/upload.rb
second_curtain-0.4.0 lib/second_curtain/upload.rb
second_curtain-0.3.0 lib/second_curtain/upload.rb
second_curtain-0.2.4 lib/second_curtain/upload.rb