Module: Helene::S3

Defined in:
lib/helene/s3.rb,
lib/helene/s3/key.rb,
lib/helene/s3/owner.rb,
lib/helene/s3/bucket.rb

Defined Under Namespace

Classes: Bucket, Key, Owner

Class Method Summary collapse

Class Method Details

.establish_connection(aws_access_key_id = Helene.aws_access_key_id, aws_secret_access_key = Helene.aws_secret_access_key, options = {}) ⇒ Object

Raises:



8
9
10
11
12
13
14
15
# File 'lib/helene/s3.rb', line 8

def establish_connection(aws_access_key_id=Helene.aws_access_key_id, aws_secret_access_key=Helene.aws_secret_access_key, options={})
  options.to_options!
  thread[:helene_s3_interface] = RightAws::S3Interface.new(aws_access_key_id, aws_secret_access_key, options)
  raise Error, 'Connection to S3 is not established' unless thread[:helene_s3_interface]

  thread[:helene_s3_generator] = RightAws::S3Generator.new(aws_access_key_id, aws_secret_access_key)
  raise Error, 'Connection to S3 is not established' unless thread[:helene_s3_generator]
end

.interfaceObject Also known as: connection



17
18
19
20
# File 'lib/helene/s3.rb', line 17

def interface
  establish_connection unless thread[:helene_s3_interface]
  thread[:helene_s3_interface]
end

.s3gObject



23
24
25
26
# File 'lib/helene/s3.rb', line 23

def s3g
  establish_connection unless thread[:helene_s3_generator]
  thread[:helene_s3_generator]
end

.threadObject



4
5
6
# File 'lib/helene/s3.rb', line 4

def thread
  Thread.current
end