brick_ftp 0.8.4 → 1.0.0.beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +0 -5
  3. data/.rubocop.yml +2 -1
  4. data/.yardopts +1 -0
  5. data/CHANGELOG.md +16 -12
  6. data/Gemfile +2 -0
  7. data/README.md +24 -43
  8. data/Rakefile +2 -0
  9. data/bin/console +1 -0
  10. data/brick_ftp.gemspec +10 -9
  11. data/exe/brick_ftp +1 -0
  12. data/lib/brick_ftp.rb +5 -78
  13. data/lib/brick_ftp/client.rb +35 -411
  14. data/lib/brick_ftp/core_ext.rb +8 -0
  15. data/lib/brick_ftp/core_ext/hash.rb +13 -0
  16. data/lib/brick_ftp/core_ext/hash/compact.rb +13 -0
  17. data/lib/brick_ftp/core_ext/struct.rb +13 -0
  18. data/lib/brick_ftp/core_ext/struct/new.rb +16 -0
  19. data/lib/brick_ftp/restful_api.rb +82 -0
  20. data/lib/brick_ftp/restful_api/add_group_member.rb +44 -0
  21. data/lib/brick_ftp/restful_api/client.rb +179 -0
  22. data/lib/brick_ftp/restful_api/command.rb +21 -0
  23. data/lib/brick_ftp/restful_api/complete_upload.rb +46 -0
  24. data/lib/brick_ftp/restful_api/continue_upload.rb +50 -0
  25. data/lib/brick_ftp/restful_api/copy_folder.rb +46 -0
  26. data/lib/brick_ftp/restful_api/count_folder_contents.rb +36 -0
  27. data/lib/brick_ftp/restful_api/count_users.rb +22 -0
  28. data/lib/brick_ftp/restful_api/create_api_key.rb +46 -0
  29. data/lib/brick_ftp/restful_api/create_behavior.rb +42 -0
  30. data/lib/brick_ftp/restful_api/create_bundle.rb +40 -0
  31. data/lib/brick_ftp/restful_api/create_folder.rb +25 -0
  32. data/lib/brick_ftp/restful_api/create_group.rb +42 -0
  33. data/lib/brick_ftp/restful_api/create_notification.rb +44 -0
  34. data/lib/brick_ftp/restful_api/create_permission.rb +48 -0
  35. data/lib/brick_ftp/restful_api/create_public_key.rb +42 -0
  36. data/lib/brick_ftp/restful_api/create_user.rb +90 -0
  37. data/lib/brick_ftp/restful_api/create_user_in_group.rb +60 -0
  38. data/lib/brick_ftp/restful_api/delete_api_key.rb +23 -0
  39. data/lib/brick_ftp/restful_api/delete_behavior.rb +22 -0
  40. data/lib/brick_ftp/restful_api/delete_bundle.rb +22 -0
  41. data/lib/brick_ftp/restful_api/delete_folder.rb +32 -0
  42. data/lib/brick_ftp/restful_api/delete_group.rb +23 -0
  43. data/lib/brick_ftp/restful_api/delete_notification.rb +23 -0
  44. data/lib/brick_ftp/restful_api/delete_permission.rb +23 -0
  45. data/lib/brick_ftp/restful_api/delete_public_key.rb +23 -0
  46. data/lib/brick_ftp/restful_api/delete_user.rb +25 -0
  47. data/lib/brick_ftp/restful_api/download_file.rb +44 -0
  48. data/lib/brick_ftp/restful_api/get_api_key.rb +25 -0
  49. data/lib/brick_ftp/restful_api/get_behavior.rb +25 -0
  50. data/lib/brick_ftp/restful_api/get_bundle.rb +25 -0
  51. data/lib/brick_ftp/restful_api/get_bundle_zip.rb +48 -0
  52. data/lib/brick_ftp/restful_api/get_file_in_bundle.rb +49 -0
  53. data/lib/brick_ftp/restful_api/get_folder_size.rb +25 -0
  54. data/lib/brick_ftp/restful_api/get_group.rb +26 -0
  55. data/lib/brick_ftp/restful_api/get_public_key.rb +25 -0
  56. data/lib/brick_ftp/restful_api/get_site_usage.rb +19 -0
  57. data/lib/brick_ftp/restful_api/get_user.rb +26 -0
  58. data/lib/brick_ftp/restful_api/list_api_keys.rb +25 -0
  59. data/lib/brick_ftp/restful_api/list_behaviors.rb +23 -0
  60. data/lib/brick_ftp/restful_api/list_bundle_contents.rb +58 -0
  61. data/lib/brick_ftp/restful_api/list_bundles.rb +23 -0
  62. data/lib/brick_ftp/restful_api/list_folder_behaviors.rb +39 -0
  63. data/lib/brick_ftp/restful_api/list_folders.rb +108 -0
  64. data/lib/brick_ftp/restful_api/list_groups.rb +23 -0
  65. data/lib/brick_ftp/restful_api/list_notifications.rb +23 -0
  66. data/lib/brick_ftp/restful_api/list_permissions.rb +41 -0
  67. data/lib/brick_ftp/restful_api/list_public_keys.rb +25 -0
  68. data/lib/brick_ftp/restful_api/list_users.rb +60 -0
  69. data/lib/brick_ftp/restful_api/move_folder.rb +41 -0
  70. data/lib/brick_ftp/restful_api/remove_group_member.rb +23 -0
  71. data/lib/brick_ftp/restful_api/retrieve_file_history.rb +41 -0
  72. data/lib/brick_ftp/restful_api/retrieve_folder_history.rb +41 -0
  73. data/lib/brick_ftp/restful_api/retrieve_history.rb +54 -0
  74. data/lib/brick_ftp/restful_api/retrieve_login_history.rb +38 -0
  75. data/lib/brick_ftp/restful_api/retrieve_site_history.rb +38 -0
  76. data/lib/brick_ftp/restful_api/retrieve_user_history.rb +40 -0
  77. data/lib/brick_ftp/restful_api/search_user.rb +28 -0
  78. data/lib/brick_ftp/restful_api/start_upload.rb +27 -0
  79. data/lib/brick_ftp/restful_api/unlock_user.rb +25 -0
  80. data/lib/brick_ftp/restful_api/update_behavior.rb +39 -0
  81. data/lib/brick_ftp/restful_api/update_group.rb +44 -0
  82. data/lib/brick_ftp/restful_api/update_group_member.rb +40 -0
  83. data/lib/brick_ftp/restful_api/update_user.rb +101 -0
  84. data/lib/brick_ftp/restful_api/upload_file.rb +65 -0
  85. data/lib/brick_ftp/types.rb +23 -0
  86. data/lib/brick_ftp/types/behavior.rb +27 -0
  87. data/lib/brick_ftp/types/bundle.rb +34 -0
  88. data/lib/brick_ftp/types/bundle_content.rb +25 -0
  89. data/lib/brick_ftp/types/bundle_zip.rb +19 -0
  90. data/lib/brick_ftp/types/file.rb +45 -0
  91. data/lib/brick_ftp/types/file_in_bundle.rb +25 -0
  92. data/lib/brick_ftp/types/folder_contents_count.rb +24 -0
  93. data/lib/brick_ftp/types/group.rb +31 -0
  94. data/lib/brick_ftp/types/group_membership.rb +27 -0
  95. data/lib/brick_ftp/types/history.rb +43 -0
  96. data/lib/brick_ftp/types/notification.rb +31 -0
  97. data/lib/brick_ftp/types/permission.rb +35 -0
  98. data/lib/brick_ftp/types/site_usage.rb +23 -0
  99. data/lib/brick_ftp/types/upload.rb +45 -0
  100. data/lib/brick_ftp/types/user.rb +79 -0
  101. data/lib/brick_ftp/types/user_api_key.rb +33 -0
  102. data/lib/brick_ftp/types/user_public_key.rb +28 -0
  103. data/lib/brick_ftp/utils.rb +2 -0
  104. data/lib/brick_ftp/utils/chunk_io.rb +5 -4
  105. data/lib/brick_ftp/version.rb +3 -1
  106. metadata +123 -86
  107. data/lib/brick_ftp/api.rb +0 -9
  108. data/lib/brick_ftp/api/authentication.rb +0 -28
  109. data/lib/brick_ftp/api/authentication/session.rb +0 -25
  110. data/lib/brick_ftp/api/base.rb +0 -119
  111. data/lib/brick_ftp/api/behavior.rb +0 -19
  112. data/lib/brick_ftp/api/bundle.rb +0 -17
  113. data/lib/brick_ftp/api/bundle_content.rb +0 -18
  114. data/lib/brick_ftp/api/bundle_download.rb +0 -18
  115. data/lib/brick_ftp/api/file.rb +0 -20
  116. data/lib/brick_ftp/api/file_operation.rb +0 -6
  117. data/lib/brick_ftp/api/file_operation/copy.rb +0 -10
  118. data/lib/brick_ftp/api/file_operation/move.rb +0 -10
  119. data/lib/brick_ftp/api/file_operation/upload.rb +0 -66
  120. data/lib/brick_ftp/api/file_operation/uploading_result.rb +0 -22
  121. data/lib/brick_ftp/api/file_operation/uploading_session.rb +0 -95
  122. data/lib/brick_ftp/api/folder.rb +0 -22
  123. data/lib/brick_ftp/api/folder_behavior.rb +0 -12
  124. data/lib/brick_ftp/api/group.rb +0 -16
  125. data/lib/brick_ftp/api/history.rb +0 -6
  126. data/lib/brick_ftp/api/history/file.rb +0 -23
  127. data/lib/brick_ftp/api/history/folder.rb +0 -23
  128. data/lib/brick_ftp/api/history/login.rb +0 -23
  129. data/lib/brick_ftp/api/history/site.rb +0 -23
  130. data/lib/brick_ftp/api/history/user.rb +0 -23
  131. data/lib/brick_ftp/api/notification.rb +0 -14
  132. data/lib/brick_ftp/api/permission.rb +0 -17
  133. data/lib/brick_ftp/api/public_key.rb +0 -15
  134. data/lib/brick_ftp/api/site_usage.rb +0 -21
  135. data/lib/brick_ftp/api/user.rb +0 -36
  136. data/lib/brick_ftp/api_component.rb +0 -81
  137. data/lib/brick_ftp/api_definition.rb +0 -65
  138. data/lib/brick_ftp/cli.rb +0 -7
  139. data/lib/brick_ftp/cli/config.rb +0 -20
  140. data/lib/brick_ftp/cli/main.rb +0 -26
  141. data/lib/brick_ftp/cli/site.rb +0 -10
  142. data/lib/brick_ftp/configuration.rb +0 -121
  143. data/lib/brick_ftp/http_client.rb +0 -130
  144. data/lib/brick_ftp/log_formatter.rb +0 -15
  145. data/lib/brick_ftp/webhook.rb +0 -4
  146. data/lib/brick_ftp/webhook/request.rb +0 -28
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'uri'
4
+
5
+ module BrickFTP
6
+ module RESTfulAPI
7
+ # Overview of uploading
8
+ #
9
+ # @see https://developers.brickftp.com/#overview-of-uploading Overview of uploading
10
+ #
11
+ # ### Uploading files using the REST API is done in 3 stages:
12
+ #
13
+ # 1. {https://developers.brickftp.com/#starting-a-new-upload Start a new upload} by sending a request to REST API to indicate intent to upload a file.
14
+ # 2. {https://developers.brickftp.com/#uploading-the-file-or-file-parts Upload the file} to the URL(s) provided by the REST API, possibly in parts via multiple uploads.
15
+ # 3. {https://developers.brickftp.com/#completing-an-upload Complete the upload} by notifying the REST API that the file upload has completed.
16
+ #
17
+ class UploadFile
18
+ include Command
19
+
20
+ CHUNK_SIZE_RANGE = 5_242_880..5_368_709_120
21
+
22
+ # At this point, you are to send a PUT request to the returned upload_uri with the file data,
23
+ # along with the headers and parameters provided to you from BrickFTP.
24
+ #
25
+ # The upload_uri link is signed by BrickFTP and must be used within 15 minutes.
26
+ # You will receive an HTTP 200 response with no body upon successful upload.
27
+ #
28
+ # Should you wish to upload the file in multiple parts (required if the file size exceeds 5 GB)
29
+ # you will need to request an additional upload URL for the next part.
30
+ #
31
+ # @param [String] path Full path of the file or folder. Maximum of 550 characters.
32
+ # @param [IO] data
33
+ # @param [Integer, nil] chunk_size the chunk sizes are required to be between 5 MB and 5 GB
34
+ # @return [BrickFTP::Types::File] File object
35
+ #
36
+ def call(path, data, chunk_size: nil)
37
+ chunk_size = adjust_chunk_size(data, chunk_size)
38
+ validate_range_of_chunk_size!(chunk_size)
39
+
40
+ upload = StartUpload.new(client).call(path)
41
+ chunk_io = BrickFTP::Utils::ChunkIO.new(data, chunk_size: chunk_size)
42
+
43
+ rest = data.size
44
+ chunk_io.each do |chunk|
45
+ rest -= client.upload_file(upload.http_method, upload.upload_uri, chunk)
46
+ break if !chunk_size || rest <= 0
47
+
48
+ upload = ContinueUpload.new(client).call(path, ref: upload.ref, part: upload.part_number + 1)
49
+ end
50
+ CompleteUpload.new(client).call(path, ref: upload.ref)
51
+ end
52
+
53
+ private
54
+
55
+ # To single uploading if chunk_size less than equals data size.
56
+ def adjust_chunk_size(data, chunk_size)
57
+ chunk_size && chunk_size >= data.size ? nil : chunk_size
58
+ end
59
+
60
+ def validate_range_of_chunk_size!(chunk_size)
61
+ raise ArgumentError, 'chunk_size must be between 5MB and 5GB' if chunk_size && !CHUNK_SIZE_RANGE.cover?(chunk_size)
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrickFTP
4
+ module Types
5
+ autoload :User, 'brick_ftp/types/user'
6
+ autoload :UserAPIKey, 'brick_ftp/types/user_api_key'
7
+ autoload :UserPublicKey, 'brick_ftp/types/user_public_key'
8
+ autoload :Group, 'brick_ftp/types/group'
9
+ autoload :GroupMembership, 'brick_ftp/types/group_membership'
10
+ autoload :Permission, 'brick_ftp/types/permission'
11
+ autoload :Notification, 'brick_ftp/types/notification'
12
+ autoload :History, 'brick_ftp/types/history'
13
+ autoload :Bundle, 'brick_ftp/types/bundle'
14
+ autoload :BundleContent, 'brick_ftp/types/bundle_content'
15
+ autoload :FileInBundle, 'brick_ftp/types/file_in_bundle'
16
+ autoload :BundleZip, 'brick_ftp/types/bundle_zip'
17
+ autoload :Behavior, 'brick_ftp/types/behavior'
18
+ autoload :File, 'brick_ftp/types/file'
19
+ autoload :FolderContentsCount, 'brick_ftp/types/folder_contents_count'
20
+ autoload :Upload, 'brick_ftp/types/upload'
21
+ autoload :SiteUsage, 'brick_ftp/types/site_usage'
22
+ end
23
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrickFTP
4
+ module Types
5
+ using BrickFTP::CoreExt::Struct
6
+
7
+ # ## The behavior object
8
+ #
9
+ # @see https://developers.brickftp.com/#the-behavior-object The behavior object
10
+ #
11
+ # ATTRIBUTE | TYPE | DESCRIPTION
12
+ # ---------- | -------- | -----------
13
+ # id | integer | Globally unique identifier of each behavior.
14
+ # path | string | Folder path for behaviors. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
15
+ # behavior | string | The behavior type. Can be one of the following: webhook, file_expiration, auto_encrypt, lock_subfolders.
16
+ # value | array | Array of values associated with the behavior.
17
+ #
18
+ Behavior = Struct.new(
19
+ 'Behavior',
20
+ :id,
21
+ :path,
22
+ :behavior,
23
+ :value,
24
+ keyword_init: true
25
+ )
26
+ end
27
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrickFTP
4
+ module Types
5
+ using BrickFTP::CoreExt::Struct
6
+
7
+ # The bundle object
8
+ #
9
+ # @see https://developers.brickftp.com/#the-bundle-object The bundle object
10
+ #
11
+ # ATTRIBUTE | TYPE | DESCRIPTION
12
+ # ---------- | -------- | -----------
13
+ # id | integer | Globally unique identifier of each bundle.
14
+ # code | string | Unique code string identifier for the bundle.
15
+ # url | string | Public sharing URL for the bundle.
16
+ # user_id | integer | ID of the user that created the bundle.
17
+ # created_at | datetime | Creation date of the bundle.
18
+ # paths | array | List of the paths associated with the bundle.
19
+ # password | string | Optional password to password-protect the bundle. This property is write-only. It cannot be retrieved via the API.
20
+ #
21
+ Bundle = Struct.new(
22
+ 'Bundle',
23
+ :id,
24
+ :code,
25
+ :url,
26
+ :user_id,
27
+ :created_at,
28
+ :paths,
29
+ :expires_at,
30
+ :username,
31
+ keyword_init: true
32
+ )
33
+ end
34
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrickFTP
4
+ module Types
5
+ using BrickFTP::CoreExt::Struct
6
+
7
+ # An element of bundle contents
8
+ #
9
+ # @see https://developers.brickftp.com/#list-bundle-contents List bundle contents
10
+ #
11
+ # ATTRIBUTE | TYPE | DESCRIPTION
12
+ # --------- | ------- | -----------
13
+ # path | string | undocumented
14
+ # type | string | undocumented
15
+ # size | integer | undocumented
16
+ #
17
+ BundleContent = Struct.new(
18
+ 'BundleContent',
19
+ :path,
20
+ :type,
21
+ :size,
22
+ keyword_init: true
23
+ )
24
+ end
25
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrickFTP
4
+ module Types
5
+ using BrickFTP::CoreExt::Struct
6
+
7
+ # @see https://developers.brickftp.com/#download-entire-bundle-as-zip Download entire bundle as ZIP
8
+ #
9
+ # ATTRIBUTE | TYPE | DESCRIPTION
10
+ # ------------ | -------- | -----------
11
+ # download_uri | string | undocumented
12
+ #
13
+ BundleZip = Struct.new(
14
+ 'BundleZip',
15
+ :download_uri,
16
+ keyword_init: true
17
+ )
18
+ end
19
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrickFTP
4
+ module Types
5
+ using BrickFTP::CoreExt::Struct
6
+
7
+ # The file/folder object
8
+ #
9
+ # @see https://developers.brickftp.com/#the-file-folder-object The file/folder object
10
+ #
11
+ # ATTRIBUTE | TYPE | DESCRIPTION
12
+ # ------------------ | -------- | -----------
13
+ # id | integer | Globally unique identifier of each file.
14
+ # path | string | Full path of the file or folder. Maximum of 550 characters.
15
+ # display_name | string | Name of the file or folder without path.
16
+ # type | enum | Either `file` or `directory` (meaning folder).
17
+ # size | integer | Size of the file in bytes. Will be 0 for a folder.
18
+ # mtime | datetime | Date of the file/folder's last modification.
19
+ # provided_mtime | datetime | Client-provided date of the file/folder's last modification.
20
+ # crc32 | string | CRC32 for the file, if available.
21
+ # md5 | string | MD5 hash for the file, if available.
22
+ # region | string | The geographic region that a file is stored in.
23
+ # permissions | string | Your permissions on the file/folder. Will be one of the following:<br>`p` (list/preview only), `r` (read-only), `w` (write-only), `rw` (read/write), `rwd` (read/write/delete).
24
+ # download_uri | string | URL to download the file, if requested.
25
+ # subfolders_locked? | integer | A value of `1` indicates that the Lock-subfolders setting is enabled on a folder.
26
+ #
27
+ File = Struct.new(
28
+ 'File',
29
+ :id,
30
+ :path,
31
+ :display_name,
32
+ :type,
33
+ :size,
34
+ :mtime,
35
+ :provided_mtime,
36
+ :crc32,
37
+ :md5,
38
+ :region,
39
+ :permissions,
40
+ :download_uri,
41
+ :subfolders_locked?,
42
+ keyword_init: true
43
+ )
44
+ end
45
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrickFTP
4
+ module Types
5
+ using BrickFTP::CoreExt::Struct
6
+
7
+ # @see https://developers.brickftp.com/#download-one-file-in-a-bundle Download one file in a bundle
8
+ #
9
+ # ATTRIBUTE | TYPE | DESCRIPTION
10
+ # ------------ | -------- | -----------
11
+ # path | string | undocumented
12
+ # type | string | undocumented
13
+ # size | integer | undocumented
14
+ # download_uri | string | undocumented
15
+ #
16
+ FileInBundle = Struct.new(
17
+ 'FileInBundle',
18
+ :path,
19
+ :type,
20
+ :size,
21
+ :download_uri,
22
+ keyword_init: true
23
+ )
24
+ end
25
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrickFTP
4
+ module Types
5
+ using BrickFTP::CoreExt::Struct
6
+
7
+ # @see https://developers.brickftp.com/#count-folder-contents-recursively Count folder contents recursively
8
+ # @see https://developers.brickftp.com/#count-folder-contents-non-recursively Count folder contents non-recursively
9
+ #
10
+ # ATTRIBUTE | TYPE | DESCRIPTION
11
+ # ---------- | ------- | -----------
12
+ # total | integer | undocumented
13
+ # files | integer | undocumented
14
+ # folders | integer | undocumented
15
+ #
16
+ FolderContentsCount = Struct.new(
17
+ 'FolderContentsCount',
18
+ :total,
19
+ :files,
20
+ :folders,
21
+ keyword_init: true
22
+ )
23
+ end
24
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrickFTP
4
+ module Types
5
+ using BrickFTP::CoreExt::Struct
6
+
7
+ # The group object
8
+ #
9
+ # @see https://developers.brickftp.com/#the-group-object The group object
10
+ #
11
+ # ATTRIBUTE | TYPE | DESCRIPTION
12
+ # --------- | ------------------------ | -----------
13
+ # id | integer | Globally unique identifier of each group. Each group is given an ID automatically upon creation.
14
+ # name | string | Name of the group. This is how the group will be displayed on the site. Maximum of 50 characters.
15
+ # notes | text | You may use this property to store any additional information you require. There are no restrictions on its formatting.
16
+ # user_ids | comma-separated integers | IDs of the users that are in this group.
17
+ # usernames | string | Usernames of the users that are in this group.
18
+ # admin_ids | comma-separated integers | IDs of the users that are in this group and are administrators of this group.
19
+ #
20
+ Group = Struct.new(
21
+ 'Group',
22
+ :id,
23
+ :name,
24
+ :notes,
25
+ :user_ids,
26
+ :usernames,
27
+ :admin_ids,
28
+ keyword_init: true
29
+ )
30
+ end
31
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrickFTP
4
+ module Types
5
+ using BrickFTP::CoreExt::Struct
6
+
7
+ # membership object
8
+ #
9
+ # @see https://developers.brickftp.com/#add-a-member membership object
10
+ #
11
+ # ATTRIBUTE | TYPE | DESCRIPTION
12
+ # --------- | ------- | -----------
13
+ # id | integer | Globally unique identifier for the membership.
14
+ # group_id | integer | ID of the group the membership is associated with.
15
+ # user_id | integer | ID of the user the membership is associated with.
16
+ # admin | boolean | Indicates whether the user is an administrator of the group.
17
+ #
18
+ GroupMembership = Struct.new(
19
+ 'GroupMembership',
20
+ :id,
21
+ :group_id,
22
+ :user_id,
23
+ :admin,
24
+ keyword_init: true
25
+ )
26
+ end
27
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrickFTP
4
+ module Types
5
+ using BrickFTP::CoreExt::Struct
6
+
7
+ # The notification object
8
+ #
9
+ # @see https://developers.brickftp.com/#the-notification-object The notification object
10
+ #
11
+ # ATTRIBUTE | TYPE | DESCRIPTION
12
+ # ------------- | -------- | -----------
13
+ # id | integer | Globally unique identifier of each history entry.
14
+ # when | datetime | Date of the history entry.
15
+ # user_id | integer | ID of the user associated with the history entry.
16
+ # username | string | Username of the user associated with the history entry.
17
+ # action | string | Type of action that occurred. Will be one of the following: <br>`create`, `read`, `update`, `destroy`, `move`, `login`, `failedlogin`, `copy`, `user_create`, `user_destroy`, `group_create`, `group_destroy`, `permission_create`, `permission_destroy`.
18
+ # failure_type | string | Type of failure that occurred, if any.
19
+ # path | string | Path of the file or folder associated with the history entry.
20
+ # source | string | Source path associated with the history entry.
21
+ # destination | string | Destination path associated with the history entry.
22
+ # targets | object | Object containing the target object(s) for `user_create`, `user_destroy`, `group_create`, `group_destroy`, `permission_create`, and `permission_destroy` actions. <br>A `user` target will include an `id` and `username`. A `group` target will include an `id` and `name`. A `permission` target will include an `id`, `permission`, and a `recursive` parameter.
23
+ # ip | string | IP address associated with the history entry.
24
+ # interface | string | Interface associated with the history entry. Will be one of the following: web, ftp, robot, jsapi, restapi, sftp, dav.
25
+ #
26
+ History = Struct.new(
27
+ 'History',
28
+ :id,
29
+ :when,
30
+ :user_id,
31
+ :username,
32
+ :action,
33
+ :failure_type,
34
+ :path,
35
+ :source,
36
+ :destination,
37
+ :targets,
38
+ :ip,
39
+ :interface,
40
+ keyword_init: true
41
+ )
42
+ end
43
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrickFTP
4
+ module Types
5
+ using BrickFTP::CoreExt::Struct
6
+
7
+ # The notification object
8
+ #
9
+ # @see https://developers.brickftp.com/#the-notification-object The notification object
10
+ #
11
+ # ATTRIBUTE | TYPE | DESCRIPTION
12
+ # ------------- | ------- | -----------
13
+ # id | integer | Globally unique identifier of each notification. Each notification is given an ID automatically upon creation.
14
+ # path | string | Folder path for notifications. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
15
+ # user_id | integer | Unique identifier for the user being notified. Each user is given an ID automatically upon creation. You can look up user IDs by using the User resource of this REST API.
16
+ # username | string | Username for the user given by user_id. If this value is set during creation and user_id is not set, the user_id is looked up from the username and set. Maximum of 50 characters.
17
+ # send_interval | string | The send interval for notifications. Can be one of the following: five_minutes (default), fifteen_minutes, hourly, daily.
18
+ # unsubscribed | boolean | If true, the user has unsubscribed from receiving this notification. This property is read-only.
19
+ #
20
+ Notification = Struct.new(
21
+ 'Notification',
22
+ :id,
23
+ :path,
24
+ :user_id,
25
+ :username,
26
+ :send_interval,
27
+ :unsubscribed,
28
+ keyword_init: true
29
+ )
30
+ end
31
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BrickFTP
4
+ module Types
5
+ using BrickFTP::CoreExt::Struct
6
+
7
+ # The permission object
8
+ #
9
+ # @see https://developers.brickftp.com/#the-permission-object The permission object
10
+ #
11
+ # ATTRIBUTE | TYPE | DESCRIPTION
12
+ # ---------- | ------- | -----------
13
+ # id | integer | Globally unique identifier of each permission. Each permission is given an ID automatically upon creation.
14
+ # user_id | integer | Unique identifier for the user being granted a permission. Each user is given an ID automatically upon creation. The user_id and group_id fields cannot both be set.
15
+ # username | string | Username for the user, if user_id is set. If this value is set during creation and user_id is not set, the user_id is looked up from the username and set. Maximum of 50 characters.
16
+ # group_id | integer | Unique identifier for the group being granted a permission. Each group is given an ID automatically upon creation. The user_id and group_id fields cannot both be set.
17
+ # group_name | string | Name of the group, if group_id is set. This property is read-only.
18
+ # path | string | Folder path for the permission to apply to. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
19
+ # permission | enum | Value must be set to full, readonly, writeonly, previewonly, or history, depending on the type of access to be granted by the Permission.
20
+ # recursive | boolean | If set to false, the permission will be non-recursive, and will not apply to subfolders of the folder specified by the path property. Default is true.
21
+ #
22
+ Permission = Struct.new(
23
+ 'Permission',
24
+ :id,
25
+ :user_id,
26
+ :username,
27
+ :group_id,
28
+ :group_name,
29
+ :path,
30
+ :permission,
31
+ :recursive,
32
+ keyword_init: true
33
+ )
34
+ end
35
+ end