Class: BrickFTP::RESTfulAPI::ListFolderBehaviors

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

Overview

List behaviors for a folder

Params

PARAMETER TYPE DESCRIPTION
recursive integer Optionally set to 1 to have response include behaviors inherited from parent folders.

Instance Method Summary collapse

Methods included from Command

included, #initialize

Instance Method Details

#call(path, recursive: false) ⇒ Array<BrickFTP::Types::Behavior>

Returns the behaviors that apply to the given path.

By default, only behaviors applied directly on the the given path will be returned. If you would also like behaviors that are inherited from parent folders to be returned, the recursive query parameter can be passed in on the URL with the value of 1.

Parameters:

  • path (String)
  • recursive (Boolean) (defaults to: false)

Returns:



31
32
33
34
35
36
37
# File 'lib/brick_ftp/restful_api/list_folder_behaviors.rb', line 31

def call(path, recursive: false)
  endpoint = "/api/rest/v1/behaviors/folders/#{ERB::Util.url_encode(path)}"
  endpoint = "#{endpoint}?recursive=1" if recursive
  res = client.get(endpoint)

  res.map { |i| BrickFTP::Types::Behavior.new(**i.symbolize_keys) }
end