Class: BrickFTP::Client
- Inherits:
-
Object
- Object
- BrickFTP::Client
- Defined in:
- lib/brick_ftp/client.rb
Instance Method Summary collapse
-
#copy_file(path:, copy_destination:) ⇒ BrickFTP::API::FileCopy
Copy a file or folder to the destination provided in the copy_destination parameter.
-
#create_behavior(attributes) ⇒ Object
Create a new behavior on the current site.
-
#create_bundle(attributes) ⇒ Object
Create a new bundle on the current site.
-
#create_folder(path:) ⇒ BrickFTP::API::Folder
Create a folder.
-
#create_group(attributes) ⇒ Object
Create a new group on the current site.
-
#create_notification(attributes) ⇒ Object
Create a new notification on the current site.
-
#create_permission(attributes) ⇒ Object
Create a new permission on the current site.
-
#create_user(attributes) ⇒ Object
Create a new user on the current site.
-
#delete_behavior(behavior) ⇒ Boolean
Delete a behavior.
-
#delete_bundle(bundle) ⇒ Boolean
Delete a bundle.
-
#delete_file(file) ⇒ Boolean
Delete a file.
-
#delete_group(group) ⇒ Boolean
Delete a group.
-
#delete_notification(notification) ⇒ Boolean
Delete a notification.
-
#delete_permission(permission) ⇒ Boolean
Delete a permission.
-
#delete_user(user) ⇒ Boolean
Delete a user.
-
#list_behaviors ⇒ Array
List all behaviors on the current site.
-
#list_bundle_contents(path: nil, code:, host:) ⇒ Array
List the contents of a bundle.
-
#list_bundle_downloads(code:, host:, paths: []) ⇒ Array
Provides download URLs that will enable you to download the files in a bundle.
-
#list_bundles ⇒ Array
List all bundles on the current site.
-
#list_file_history(path:, page: nil, per_page: nil, start_at: nil) ⇒ Array
Show all history for a specific file.
-
#list_folder_behaviors(path:) ⇒ Array
shows the behaviors that apply to the given path.
-
#list_folder_history(path:, page: nil, per_page: nil, start_at: nil) ⇒ Array
Show all history for a specific folder.
-
#list_folders(path:, page: nil, per_page: nil, search: nil, sort_by_path: nil, sort_by_size: nil, sort_by_modified_at_datetime: nil) ⇒ Array
Lists the contents of the folder provided in the URL.
-
#list_groups ⇒ Object
List all groups on the current site.
-
#list_login_history(page: nil, per_page: nil, start_at: nil) ⇒ Array
Show login history only.
-
#list_notifications ⇒ Object
List all notifications on the current site.
-
#list_permissions ⇒ Object
List all permissions on the current site.
-
#list_site_history(page: nil, per_page: nil, start_at: nil) ⇒ Array
Show the entire history for the current site.
-
#list_user_history(page: nil, per_page: nil, start_at: nil) ⇒ Array
Show all history for a specific user.
-
#list_users ⇒ Array
List all users on the current site.
-
#login(username, password) ⇒ Object
Login and store authentication session.
-
#logout ⇒ Object
Logout and discard authentication session.
-
#move_file(path:, move_destination:) ⇒ BrickFTP::API::FileMove
Move or renames a file or folder to the destination provided in the move_destination parameter.
-
#show_behavior(id) ⇒ BrickFTP::API::Behavior
Show a single behavior.
-
#show_bundle(id) ⇒ BrickFTP::API::Bundle
Show a single bundle.
-
#show_file(id) ⇒ BrickFTP::API::File
provides a download URL that will enable you to download a file.
-
#show_group(id) ⇒ BrickFTP::API::Group
Show a single group.
-
#show_user(id) ⇒ BrickFTP::API::User
Show a single user.
-
#update_behavior(behavior, attributes) ⇒ BrickFTP::API::Behavior
Update an existing behavior.
-
#update_group(group, attributes) ⇒ BrickFTP::API::Group
Update an existing group.
-
#update_user(user, attributes) ⇒ BrickFTP::API::User
Update an existing user.
-
#upload_file(path:, source:) ⇒ BrickFTP::API::FileUpload
Upload file.
Instance Method Details
#copy_file(path:, copy_destination:) ⇒ BrickFTP::API::FileCopy
Copy a file or folder to the destination provided in the copy_destination parameter.
337 338 339 |
# File 'lib/brick_ftp/client.rb', line 337 def copy_file(path:, copy_destination:) BrickFTP::API::FileCopy.create(path: path, copy_destination: copy_destination) end |
#create_behavior(attributes) ⇒ Object
Create a new behavior on the current site.
261 262 263 |
# File 'lib/brick_ftp/client.rb', line 261 def create_behavior(attributes) BrickFTP::API::Behavior.create(attributes) end |
#create_bundle(attributes) ⇒ Object
Create a new bundle on the current site.
211 212 213 |
# File 'lib/brick_ftp/client.rb', line 211 def create_bundle(attributes) BrickFTP::API::Bundle.create(attributes) end |
#create_folder(path:) ⇒ BrickFTP::API::Folder
Create a folder.
311 312 313 |
# File 'lib/brick_ftp/client.rb', line 311 def create_folder(path:) BrickFTP::API::Folder.create(path: path) end |
#create_group(attributes) ⇒ Object
Create a new group on the current site.
73 74 75 |
# File 'lib/brick_ftp/client.rb', line 73 def create_group(attributes) BrickFTP::API::Group.create(attributes) end |
#create_notification(attributes) ⇒ Object
Create a new notification on the current site.
124 125 126 |
# File 'lib/brick_ftp/client.rb', line 124 def create_notification(attributes) BrickFTP::API::Notification.create(attributes) end |
#create_permission(attributes) ⇒ Object
Create a new permission on the current site.
103 104 105 |
# File 'lib/brick_ftp/client.rb', line 103 def (attributes) BrickFTP::API::Permission.create(attributes) end |
#create_user(attributes) ⇒ Object
Create a new user on the current site.
35 36 37 |
# File 'lib/brick_ftp/client.rb', line 35 def create_user(attributes) BrickFTP::API::User.create(attributes) end |
#delete_behavior(behavior) ⇒ Boolean
Delete a behavior.
278 279 280 |
# File 'lib/brick_ftp/client.rb', line 278 def delete_behavior(behavior) behavior.destroy end |
#delete_bundle(bundle) ⇒ Boolean
Delete a bundle.
219 220 221 |
# File 'lib/brick_ftp/client.rb', line 219 def delete_bundle(bundle) bundle.destroy end |
#delete_file(file) ⇒ Boolean
Delete a file.
345 346 347 |
# File 'lib/brick_ftp/client.rb', line 345 def delete_file(file) file.destroy end |
#delete_group(group) ⇒ Boolean
Delete a group.
90 91 92 |
# File 'lib/brick_ftp/client.rb', line 90 def delete_group(group) group.destroy end |
#delete_notification(notification) ⇒ Boolean
Delete a notification.
132 133 134 |
# File 'lib/brick_ftp/client.rb', line 132 def delete_notification(notification) notification.destroy end |
#delete_permission(permission) ⇒ Boolean
Delete a permission.
111 112 113 |
# File 'lib/brick_ftp/client.rb', line 111 def () .destroy end |
#delete_user(user) ⇒ Boolean
Delete a user.
52 53 54 |
# File 'lib/brick_ftp/client.rb', line 52 def delete_user(user) user.destroy end |
#list_behaviors ⇒ Array
List all behaviors on the current site.
246 247 248 |
# File 'lib/brick_ftp/client.rb', line 246 def list_behaviors BrickFTP::API::Behavior.all end |
#list_bundle_contents(path: nil, code:, host:) ⇒ Array
List the contents of a bundle.
229 230 231 |
# File 'lib/brick_ftp/client.rb', line 229 def list_bundle_contents(path: nil, code:, host:) BrickFTP::API::BundleContent.all(path: path, code: code, host: host) end |
#list_bundle_downloads(code:, host:, paths: []) ⇒ Array
Provides download URLs that will enable you to download the files in a bundle.
239 240 241 |
# File 'lib/brick_ftp/client.rb', line 239 def list_bundle_downloads(code:, host:, paths: []) BrickFTP::API::BundleDownload.all(code: code, host: host, paths: paths) end |
#list_bundles ⇒ Array
List all bundles on the current site.
196 197 198 |
# File 'lib/brick_ftp/client.rb', line 196 def list_bundles BrickFTP::API::Bundle.all end |
#list_file_history(path:, page: nil, per_page: nil, start_at: nil) ⇒ Array
Show all history for a specific file.
188 189 190 191 |
# File 'lib/brick_ftp/client.rb', line 188 def list_file_history(path:, page: nil, per_page: nil, start_at: nil) query = { path: path, page: page, per_page: per_page, start_at: start_at }.reject { |_, v| v.nil? } BrickFTP::API::History::File.all(query) end |
#list_folder_behaviors(path:) ⇒ Array
shows the behaviors that apply to the given path.
285 286 287 |
# File 'lib/brick_ftp/client.rb', line 285 def list_folder_behaviors(path:) BrickFTP::API::BehaviorFolder.all(path: path) end |
#list_folder_history(path:, page: nil, per_page: nil, start_at: nil) ⇒ Array
Show all history for a specific folder.
176 177 178 179 |
# File 'lib/brick_ftp/client.rb', line 176 def list_folder_history(path:, page: nil, per_page: nil, start_at: nil) query = { path: path, page: page, per_page: per_page, start_at: start_at }.reject { |_, v| v.nil? } BrickFTP::API::History::Folder.all(query) end |
#list_folders(path:, page: nil, per_page: nil, search: nil, sort_by_path: nil, sort_by_size: nil, sort_by_modified_at_datetime: nil) ⇒ Array
Lists the contents of the folder provided in the URL.
299 300 301 302 303 304 305 |
# File 'lib/brick_ftp/client.rb', line 299 def list_folders(path:, page: nil, per_page: nil, search: nil, sort_by_path: nil, sort_by_size: nil, sort_by_modified_at_datetime: nil) query = { path: path, page: page, per_page: per_page, search: search }.reject { |_, v| v.nil? } query[:'sort_by[path]'] = sort_by_path if sort_by_path query[:'sort_by[size]'] = sort_by_size if sort_by_size query[:'sort_by[modified_at_datetime]'] = sort_by_modified_at_datetime if sort_by_modified_at_datetime BrickFTP::API::Folder.all(query) end |
#list_groups ⇒ Object
List all groups on the current site.
58 59 60 |
# File 'lib/brick_ftp/client.rb', line 58 def list_groups BrickFTP::API::Group.all end |
#list_login_history(page: nil, per_page: nil, start_at: nil) ⇒ Array
Show login history only.
153 154 155 156 |
# File 'lib/brick_ftp/client.rb', line 153 def list_login_history(page: nil, per_page: nil, start_at: nil) query = { page: page, per_page: per_page, start_at: start_at }.reject { |_, v| v.nil? } BrickFTP::API::History::Login.all(query) end |
#list_notifications ⇒ Object
List all notifications on the current site.
117 118 119 |
# File 'lib/brick_ftp/client.rb', line 117 def list_notifications BrickFTP::API::Notification.all end |
#list_permissions ⇒ Object
List all permissions on the current site.
96 97 98 |
# File 'lib/brick_ftp/client.rb', line 96 def BrickFTP::API::Permission.all end |
#list_site_history(page: nil, per_page: nil, start_at: nil) ⇒ Array
Show the entire history for the current site.
142 143 144 145 |
# File 'lib/brick_ftp/client.rb', line 142 def list_site_history(page: nil, per_page: nil, start_at: nil) query = { page: page, per_page: per_page, start_at: start_at }.reject { |_, v| v.nil? } BrickFTP::API::History::Site.all(query) end |
#list_user_history(page: nil, per_page: nil, start_at: nil) ⇒ Array
Show all history for a specific user.
164 165 166 167 |
# File 'lib/brick_ftp/client.rb', line 164 def list_user_history(page: nil, per_page: nil, start_at: nil) query = { page: page, per_page: per_page, start_at: start_at }.reject { |_, v| v.nil? } BrickFTP::API::History::User.all(query) end |
#list_users ⇒ Array
List all users on the current site.
20 21 22 |
# File 'lib/brick_ftp/client.rb', line 20 def list_users BrickFTP::API::User.all end |
#login(username, password) ⇒ Object
Login and store authentication session.
7 8 9 |
# File 'lib/brick_ftp/client.rb', line 7 def login(username, password) BrickFTP::API::Authentication.login(username, password) end |
#logout ⇒ Object
Logout and discard authentication session.
13 14 15 |
# File 'lib/brick_ftp/client.rb', line 13 def logout BrickFTP::API::Authentication.logout end |
#move_file(path:, move_destination:) ⇒ BrickFTP::API::FileMove
Move or renames a file or folder to the destination provided in the move_destination parameter.
328 329 330 |
# File 'lib/brick_ftp/client.rb', line 328 def move_file(path:, move_destination:) BrickFTP::API::FileMove.create(path: path, move_destination: move_destination) end |
#show_behavior(id) ⇒ BrickFTP::API::Behavior
Show a single behavior.
254 255 256 |
# File 'lib/brick_ftp/client.rb', line 254 def show_behavior(id) BrickFTP::API::Behavior.find(id) end |
#show_bundle(id) ⇒ BrickFTP::API::Bundle
Show a single bundle.
204 205 206 |
# File 'lib/brick_ftp/client.rb', line 204 def show_bundle(id) BrickFTP::API::Bundle.find(id) end |
#show_file(id) ⇒ BrickFTP::API::File
provides a download URL that will enable you to download a file.
319 320 321 |
# File 'lib/brick_ftp/client.rb', line 319 def show_file(id) BrickFTP::API::File.find(id) end |
#show_group(id) ⇒ BrickFTP::API::Group
Show a single group.
66 67 68 |
# File 'lib/brick_ftp/client.rb', line 66 def show_group(id) BrickFTP::API::Group.find(id) end |
#show_user(id) ⇒ BrickFTP::API::User
Show a single user.
28 29 30 |
# File 'lib/brick_ftp/client.rb', line 28 def show_user(id) BrickFTP::API::User.find(id) end |
#update_behavior(behavior, attributes) ⇒ BrickFTP::API::Behavior
Update an existing behavior.
270 271 272 |
# File 'lib/brick_ftp/client.rb', line 270 def update_behavior(behavior, attributes) behavior.update(attributes) end |
#update_group(group, attributes) ⇒ BrickFTP::API::Group
Update an existing group.
82 83 84 |
# File 'lib/brick_ftp/client.rb', line 82 def update_group(group, attributes) group.update(attributes) end |
#update_user(user, attributes) ⇒ BrickFTP::API::User
Update an existing user.
44 45 46 |
# File 'lib/brick_ftp/client.rb', line 44 def update_user(user, attributes) user.update(attributes) end |
#upload_file(path:, source:) ⇒ BrickFTP::API::FileUpload
Upload file.
354 355 356 |
# File 'lib/brick_ftp/client.rb', line 354 def upload_file(path:, source:) BrickFTP::API::FileUpload.create(path: path, source: source) end |