Class: Takenoko::S3::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/takenoko/s3/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(key, secret, region) ⇒ Client



5
6
7
8
9
10
11
12
# File 'lib/takenoko/s3/client.rb', line 5

def initialize(key,secret,region)
  @config = {
    provider: 'AWS',
    aws_access_key_id:     key,
    aws_secret_access_key: secret,
    region:                region
  }
end

Instance Method Details

#bucket(bucket_name, folder_path = nil) ⇒ Object



22
23
24
# File 'lib/takenoko/s3/client.rb', line 22

def bucket(bucket_name,folder_path=nil)
  session.directories.get(bucket_name, prefix:folder_path )
end

#bucketsObject



18
19
20
# File 'lib/takenoko/s3/client.rb', line 18

def buckets
  session.directories
end

#sessionObject



14
15
16
# File 'lib/takenoko/s3/client.rb', line 14

def session
  Fog::Storage.new @config
end