Class: Apitool::Client::Backup

Inherits:
ApitoolClient show all
Defined in:
lib/apitool/client/backup.rb

Instance Method Summary collapse

Methods inherited from ApitoolClient

#errors, #initialize, #request, #response, #result

Constructor Details

This class inherits a constructor from Apitool::Client::ApitoolClient

Instance Method Details

#create(options = {}) ⇒ Object

uuid: "some unique identifier",
b64_path: "some_path_encrypted_in_b64"



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/apitool/client/backup.rb', line 31

def create(options = {})
  parameters = {
    backup: options
  }
  post("/backups", parameters) do |response|
    if response.code == 200
      parse(response)
    else
      nil
    end
  end
end

#destroy(uuid) ⇒ Object



44
45
46
47
48
49
50
51
52
# File 'lib/apitool/client/backup.rb', line 44

def destroy(uuid)
  delete("/backups/#{uuid}") do |response|
    if response.code == 200
      parse(response)
    else
      nil
    end
  end
end

#indexObject



7
8
9
10
11
12
13
14
15
# File 'lib/apitool/client/backup.rb', line 7

def index
  get('/backups') do |response, request, result|
    if response.code == 200
      parse(response)
    else
      nil
    end
  end
end

#path_to_b64_path(path) ⇒ Object



3
4
5
# File 'lib/apitool/client/backup.rb', line 3

def path_to_b64_path(path)
  Base64.strict_encode64(path)
end

#show(uuid) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/apitool/client/backup.rb', line 17

def show(uuid)
  get("/backups/#{uuid}") do |response|
    if response.code == 200
      parse(response)
    else
      nil
    end
  end
end