Class: DropboxApi::Endpoints::Sharing::AddFileMember

Inherits:
Rpc
  • Object
show all
Includes:
OptionsValidator
Defined in:
lib/dropbox_api/endpoints/sharing/add_file_member.rb

Constant Summary collapse

Method =
:post
Path =
"/2/sharing/add_file_member".freeze
ResultType =
DropboxApi::Results::AddFileMemberResultList
ErrorType =
DropboxApi::Errors::AddFileMemberError

Instance Method Summary collapse

Methods included from OptionsValidator

#validate_options

Methods inherited from Rpc

#build_request, #initialize, #request_body

Methods inherited from Base

add_endpoint

Constructor Details

This class inherits a constructor from DropboxApi::Endpoints::Rpc

Instance Method Details

#add_file_member(file, members, options = {}) ⇒ Object

Adds specified members to a file.

The members parameter can be an Array or a single member element. Each element is represented by either a String or a Metadata::Member object. You can identify a member using his email or a Dropbox ID.

Parameters:

  • file (String)

    File to which to add members. It can be a path or an ID such as id:3kmLmQFnf1AAAAAAAAAAAw.

  • members

    Members to add. Note that even if an email address is given, this may result in a user being directy added to the membership if that email is the user's main account email.

Options Hash (options):

  • quiet (Boolean)

    Whether added members should be notified via email and device notifications of their invite. The default for this field is false.

  • custom_message (String)

    Message to send to added members in their invitation. This field is optional.

  • access_level (AccessLevel)

    AccessLevel union object, describing what access level we want to give new members. The default for this is :viewer.

  • add_message_as_comment (String)

    Optional message to display to added members in their invitation. This field is optional.

See Also:


33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/dropbox_api/endpoints/sharing/add_file_member.rb', line 33

add_endpoint :add_file_member do |file, members, options = {}|
  validate_options([:quiet, :custom_message, :access_level, :add_message_as_comment], options)
  options[:quiet] ||= false
  options[:custom_message] ||= nil
  options[:access_level] ||= :viewer
  options[:add_message_as_comment] ||= false

  perform_request options.merge({
    :file => file,
    :members => build_members_param(members)
  })
end