Class: Zillabyte::API::Keys

Inherits:
Base
  • Object
show all
Defined in:
lib/zillabyte/api/keys.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods included from Helpers

#app, #ask, #command, #create_git_remote, #display, #error, #extract_app_from_git_config, #extract_app_in_dir, #format_with_bang, #friendly_dir, #get_flow_ui_link, #get_info, #get_rich_info, #git, #handle_downloading_manifest, #has_git?, #longest, #read_multiline, #truncate_message, #version_okay?, #with_tty

Constructor Details

This class inherits a constructor from Zillabyte::API::Base

Instance Method Details

#add(name, key) ⇒ Object

PUT /keys/:name



14
15
16
17
18
19
20
21
22
23
# File 'lib/zillabyte/api/keys.rb', line 14

def add(name, key)
  response = request(
    body:     key,
    expects:  200,
    method:   :put,
    path:     "/keys/#{CGI.escape(name)}",
  )
  body = response.body
  body["body"]
end

#clearObject

DELETE /keys



62
63
64
65
66
67
68
69
70
# File 'lib/zillabyte/api/keys.rb', line 62

def clear()
  response = request(
    expects:  200,
    method:   :delete,
    path:     "/keys",
  )
  body = response.body
  body["body"]
end

#listObject

GET /keys



51
52
53
54
55
56
57
58
59
# File 'lib/zillabyte/api/keys.rb', line 51

def list()
  response = request(
    expects:  200,
    method:   :get,
    path:     "/keys",
  )
  body = response.body
  body
end

#remove(name, key_data) ⇒ Object

DELETE /keys/:name



37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/zillabyte/api/keys.rb', line 37

def remove(name, key_data)
  response = request(
    expects:  200,
    method:   :delete,
    path: "/keys/#{CGI.escape(name)}",
    query: {
      key_data: key_data,
    },
  )
  body = response.body
  body["body"]
end

#show(name) ⇒ Object

GET /keys/:name



26
27
28
29
30
31
32
33
34
# File 'lib/zillabyte/api/keys.rb', line 26

def show(name)
  response = request(
    expects:  200,
    method:   :get,
    path:     "/keys/#{CGI.escape(name)}",
  )
  body = response.body
  body["body"]
end