Sha256: f6282126363cf4c7e4bcbddaa6ff285609b035fff2f186298b375ce65423737d

Contents?: true

Size: 546 Bytes

Versions: 3

Compression:

Stored size: 546 Bytes

Contents

require 'learn_web/client/ssh_keys/add'

module LearnWeb
  class Client
    module SshKeys
      def add_ssh_key_endpoint
        "#{API_ROOT}/ssh_keys"
      end

      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
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
learn-web-1.5.5 lib/learn_web/client/ssh_keys.rb
learn-web-1.5.4 lib/learn_web/client/ssh_keys.rb
learn-web-1.5.3 lib/learn_web/client/ssh_keys.rb