Class: Admincredible::Resources::Backup

Inherits:
Admincredible::Resource show all
Defined in:
lib/admincredible/resources/Backup.rb

Instance Attribute Summary

Attributes inherited from Admincredible::Resource

#client

Instance Method Summary collapse

Methods inherited from Admincredible::Resource

#config, #connection, #initialize

Constructor Details

This class inherits a constructor from Admincredible::Resource

Instance Method Details

#createObject



24
25
26
27
28
29
30
31
# File 'lib/admincredible/resources/Backup.rb', line 24

def create
  response = start
  if response['status'] == 302
    return step
  else
    return response
  end
end

#startObject



4
5
6
# File 'lib/admincredible/resources/Backup.rb', line 4

def start
  client.jget('backups', 'start')
end

#step(repeat_until_done = true) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/admincredible/resources/Backup.rb', line 8

def step(repeat_until_done=true)
  response = client.jget('backups', 'step')

  if response['status'] == 'working' && repeat_until_done
    seconds_left = config.step_after_seconds

    seconds_left.times do |i|
      sleep 1
    end

    return step
  end

  response
end