Module: Restic::Service::Targets::B2

Included in:
RcloneB2, ResticB2
Defined in:
lib/restic/service/targets/b2.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.normalize_yaml(yaml) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/restic/service/targets/b2.rb', line 9

def self.normalize_yaml(yaml)
    %w{bucket path id key}.each do |required_field|
        if !yaml[required_field]
            raise Conf::InvalidConfigurationFile, "missing '#{required_field}' field in target"
        end
    end
    yaml
end

Instance Method Details

#available?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/restic/service/targets/b2.rb', line 5

def available?
    true
end

#initialize(*args) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/restic/service/targets/b2.rb', line 18

def initialize(*args)
    super

    @bucket = nil
    @path = nil
    @id = nil
    @key = nil
end

#setup_from_conf(conf, yaml) ⇒ Object



27
28
29
30
31
32
33
34
# File 'lib/restic/service/targets/b2.rb', line 27

def setup_from_conf(conf, yaml)
    super

    @bucket = yaml['bucket']
    @path   = yaml['path']
    @id     = yaml['id']
    @key    = yaml['key']
end