Class: BrickFTP::RESTfulAPI::AddGroupMember

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

Overview

Add a member

Params

PARAMETER TYPE DESCRIPTION
admin boolean Indicates whether the user is an administrator of the group.

See Also:

Defined Under Namespace

Classes: Params

Instance Method Summary collapse

Methods included from Command

included, #initialize

Instance Method Details

#call(group_id, user_id, params) ⇒ BrickFTP::Types::GroupMembership

Adds a user to a group.

  • By default, the member will not be an admin.
  • If the user is already a member of the group, their attributes will be updated to match the request.

Parameters:

Returns:

Raises:

  • (BrickFTP::RESTfulAPI::Error)

    exception



37
38
39
40
41
# File 'lib/brick_ftp/restful_api/add_group_member.rb', line 37

def call(group_id, user_id, params)
  res = client.put("/api/rest/v1/groups/#{group_id}/memberships/#{user_id}.json", membership: params.to_h.compact)

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