Class: BrickFTP::RESTfulAPI::CreatePublicKey

Inherits:
Object
  • Object
show all
Includes:
Command
Defined in:
lib/brick_ftp/restful_api/create_public_key.rb

Overview

Create a public key

Params

PARAMETER TYPE DESCRIPTION
title string Title to identify the public key. For your reference. Maximum of 50 characters.
public_key string The public key itself. This property is write-only. It cannot be retrieved via the API.

Defined Under Namespace

Classes: Params

Instance Method Summary collapse

Methods included from Command

included, #initialize

Instance Method Details

#call(id, params) ⇒ BrickFTP::Types::UserPublicKey

Creates a new public key for a user on the current site.

Parameters:

Returns:



35
36
37
38
39
# File 'lib/brick_ftp/restful_api/create_public_key.rb', line 35

def call(id, params)
  res = client.post("/api/rest/v1/users/#{id}/public_keys.json", params.to_h.compact)

  BrickFTP::Types::UserPublicKey.new(**res.symbolize_keys)
end