Class: BrickFTP::RESTfulAPI::CreateAPIKey

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

Overview

Create an API key

Params

PARAMETER TYPE DESCRIPTION
name string Name to identify the user API key. For your reference. Maximum of 100 characters.
permission_set string The permission set for the user API key. Can be desktop_app or full.
platform string The platform for the user API key. Can be win32, macos, linux, or none. Applies only to API keys with a permission_set of desktop_app.
expires_at datetime The date that this API key is valid through.

See Also:

Defined Under Namespace

Classes: Params

Instance Method Summary collapse

Methods included from Command

included, #initialize

Instance Method Details

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

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

Parameters:

Returns:



39
40
41
42
43
# File 'lib/brick_ftp/restful_api/create_api_key.rb', line 39

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

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