Module: LearnWeb::Client::SshKeys

Included in:
LearnWeb::Client
Defined in:
lib/learn_web/client/ssh_keys.rb,
lib/learn_web/client/ssh_keys/add.rb

Defined Under Namespace

Classes: Add

Instance Method Summary collapse

Instance Method Details

#add_ssh_key(key:, key_title: nil, client: nil) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/learn_web/client/ssh_keys.rb', line 10

def add_ssh_key(key:, key_title: nil, client: nil)
  response = post(
    add_ssh_key_endpoint,
    headers: { 'Authorization' => "Bearer #{token}" },
    params: { 'key' => key, key_title: key_title }.reject { |_, v| v.nil? },
    client: client
  )

  LearnWeb::Client::SshKeys::Add.new(response).parse!
end

#add_ssh_key_endpointObject



6
7
8
# File 'lib/learn_web/client/ssh_keys.rb', line 6

def add_ssh_key_endpoint
  "#{API_ROOT}/ssh_keys"
end