Class: CloudSync::Media::S3

Inherits:
Base
  • Object
show all
Defined in:
lib/cloud_sync/media/s3.rb

Instance Method Summary collapse

Constructor Details

#initializeS3

Returns a new instance of S3.



5
6
7
8
9
10
11
12
13
# File 'lib/cloud_sync/media/s3.rb', line 5

def initialize
  raise "s3_access_key not set" unless Configuration.s3_access_key
  raise "s3_secret_key not set" unless Configuration.s3_secret_key
  
  AWS::S3::Base.establish_connection!({
    :access_key_id     => Configuration.s3_access_key, 
    :secret_access_key => Configuration.s3_secret_key
  })
end

Instance Method Details

#exists?(path) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
18
# File 'lib/cloud_sync/media/s3.rb', line 15

def exists? path
  bucket, object = parse path
  object_exists?(bucket, object)
end

#reader(path) ⇒ Object



20
21
22
23
# File 'lib/cloud_sync/media/s3.rb', line 20

def reader path
  bucket, object = parse path
  get_object(bucket, object)
end

#writer(path) ⇒ Object



25
26
27
28
# File 'lib/cloud_sync/media/s3.rb', line 25

def writer path
  bucket, object = parse path
  get_object(bucket, object)
end