Class: DoSnapshot::Adapter::Abstract

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/do_snapshot/adapter/abstract.rb

Overview

API for CLI commands Operating with Digital Ocean.

Direct Known Subclasses

DigitaloceanV2

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#logger, #mailer

Constructor Details

#initialize(options = {}) ⇒ Abstract

Returns a new instance of Abstract.



14
15
16
17
18
19
20
# File 'lib/do_snapshot/adapter/abstract.rb', line 14

def initialize(options = {})
  check_keys
  set_id
  options.each_pair do |key, option|
    send("#{key}=", option)
  end
end

Instance Attribute Details

#delayObject

Returns the value of attribute delay.



11
12
13
# File 'lib/do_snapshot/adapter/abstract.rb', line 11

def delay
  @delay
end

#stop_by=(value) ⇒ Object

Sets the attribute stop_by

Parameters:

  • value

    the value to set the attribute stop_by to.



12
13
14
# File 'lib/do_snapshot/adapter/abstract.rb', line 12

def stop_by=(value)
  @stop_by = value
end

#timeoutObject

Returns the value of attribute timeout.



11
12
13
# File 'lib/do_snapshot/adapter/abstract.rb', line 11

def timeout
  @timeout
end

Instance Method Details

#start_droplet(id) ⇒ Object

Power On request for Droplet



24
25
26
27
28
29
30
31
# File 'lib/do_snapshot/adapter/abstract.rb', line 24

def start_droplet(id)
  # noinspection RubyResolve
  instance = droplet(id)

  return power_on(id) unless instance.status.include?('active')

  logger.error "Droplet #{id} is still running. Skipping."
end