Class: S3rbsync::Synchronizer

Inherits:
Object
  • Object
show all
Defined in:
lib/s3rbsync/synchronizer.rb

Instance Method Summary collapse

Constructor Details

#initialize(configure) ⇒ Synchronizer

Returns a new instance of Synchronizer.



6
7
8
9
10
11
12
13
# File 'lib/s3rbsync/synchronizer.rb', line 6

def initialize(configure)
  @configure = configure
  @s3= Fog::Storage.new(:provider              => 'AWS',
                        :aws_access_key_id     => @configure.access_key,
                        :aws_secret_access_key => @configure.secret_key,
                        :region                => (@configure.region || 'ap-northeast-1'),
                        :persistent            => false )
end

Instance Method Details

#connected?Boolean

Returns:

  • (Boolean)


15
16
17
18
19
20
21
# File 'lib/s3rbsync/synchronizer.rb', line 15

def connected?
  @s3.get_bucket(@configure.bucket_name)
rescue
  false
else
  true
end