files.com 1.0.99 → 1.0.104

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2d61d5f715d4e894f0102913b5180614d20c07774fd57df8cb2d93cfa4f83ad9
4
- data.tar.gz: ebde8436aa8818e3332660352998e4bc1ef57564a523a4a1614e8e085b275ae6
3
+ metadata.gz: 5f77fd18dc9c28e0fab729624b8b155a7bf6f4046c90f7404abfdcb96602d7da
4
+ data.tar.gz: a8b9c317b029edc78dccce648554398e6dd86e622c948c2574b393a43230dc8a
5
5
  SHA512:
6
- metadata.gz: 175cb4d587cb172d326a5bd3ea213e042dcd023d8816cb91da5f23510abffcd8de34083484e577d6cdef12d6b15b4f935d16c1394a80e76b7411f73ec8cc3426
7
- data.tar.gz: fe5baf51329e93cd9a6edf8e9396f764b2fb90df7781e09326441f67f3f3e2276b6aa0e4ec3ec16a17522c56d0cd4b996c4f71860b8b03e7c73c5e6f840c55e5
6
+ metadata.gz: dd72ee23eb04a85b17580d3202dc5354e228295ae490963b11d7a17540066667b5cf53227ecaa99ee8109911eddc411dcd31ef86ca0f4f78b9aa531aa80ca04c
7
+ data.tar.gz: c0042be73f96c5b7c2e495d1422c0602158ac973c8c9bd134b4d7acf42f532f903a9ac28643383efc075bbdf4b6472600b453fb0bc19b7b378c4b226aee0e76c
data/_VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.99
1
+ 1.0.104
@@ -0,0 +1,53 @@
1
+ # BandwidthSnapshot
2
+
3
+ ## Example BandwidthSnapshot Object
4
+
5
+ ```
6
+ {
7
+ "id": 1,
8
+ "bytes_received": 1.0,
9
+ "bytes_sent": 1.0,
10
+ "requests_get": 1.0,
11
+ "requests_put": 1.0,
12
+ "requests_other": 1.0,
13
+ "logged_at": "2000-01-01T01:00:00Z",
14
+ "created_at": "2000-01-01T01:00:00Z",
15
+ "updated_at": "2000-01-01T01:00:00Z"
16
+ }
17
+ ```
18
+
19
+ * `id` (int64): Site bandwidth ID
20
+ * `bytes_received` (double): Site bandwidth report bytes received
21
+ * `bytes_sent` (double): Site bandwidth report bytes sent
22
+ * `requests_get` (double): Site bandwidth report get requests
23
+ * `requests_put` (double): Site bandwidth report put requests
24
+ * `requests_other` (double): Site bandwidth report other requests
25
+ * `logged_at` (date-time): Time the site bandwidth report was logged
26
+ * `created_at` (date-time): Site bandwidth report created at date/time
27
+ * `updated_at` (date-time): The last time this site bandwidth report was updated
28
+
29
+
30
+ ---
31
+
32
+ ## List Bandwidth Snapshots
33
+
34
+ ```
35
+ Files::BandwidthSnapshot.list(
36
+ page: 1,
37
+ per_page: 1
38
+ )
39
+ ```
40
+
41
+ ### Parameters
42
+
43
+ * `page` (int64): Current page number.
44
+ * `per_page` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
45
+ * `action` (string): Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
46
+ * `cursor` (string): Send cursor to resume an existing list from the point at which you left off. Get a cursor from an existing list via the X-Files-Cursor-Next header.
47
+ * `sort_by` (object): If set, sort records by the specified field in either 'asc' or 'desc' direction (e.g. sort_by[last_login_at]=desc). Valid fields are `site_id` and `logged_at`.
48
+ * `filter` (object): If set, return records where the specifiied field is equal to the supplied value. Valid fields are `logged_at`.
49
+ * `filter_gt` (object): If set, return records where the specifiied field is greater than the supplied value. Valid fields are `logged_at`.
50
+ * `filter_gteq` (object): If set, return records where the specifiied field is greater than or equal to the supplied value. Valid fields are `logged_at`.
51
+ * `filter_like` (object): If set, return records where the specifiied field is equal to the supplied value. Valid fields are `logged_at`.
52
+ * `filter_lt` (object): If set, return records where the specifiied field is less than the supplied value. Valid fields are `logged_at`.
53
+ * `filter_lteq` (object): If set, return records where the specifiied field is less than or equal to the supplied value. Valid fields are `logged_at`.
@@ -12,6 +12,7 @@
12
12
  "headers": "",
13
13
  "http_method": "POST",
14
14
  "next_partsize": "",
15
+ "parallel_parts": true,
15
16
  "parameters": "",
16
17
  "part_number": "",
17
18
  "partsize": "",
@@ -29,6 +30,7 @@
29
30
  * `headers` (object): Additional upload headers
30
31
  * `http_method` (string): Upload method, usually POST
31
32
  * `next_partsize` (string): Currently unused
33
+ * `parallel_parts` (boolean): If true, parts may be uploaded in parallel
32
34
  * `parameters` (string): Additional upload parameters
33
35
  * `part_number` (string): Currently unused
34
36
  * `partsize` (string): Currently unused
@@ -26,7 +26,8 @@
26
26
  "query_target_user_id": 1,
27
27
  "query_target_username": "jerry",
28
28
  "query_target_platform": "windows",
29
- "query_target_permission_set": "desktop_app"
29
+ "query_target_permission_set": "desktop_app",
30
+ "results_url": "https://files.com/history_results.csv"
30
31
  }
31
32
  ```
32
33
 
@@ -53,29 +54,10 @@
53
54
  * `query_target_username` (string): If searching for Histories about API keys, this parameter restricts results to API keys created by/for this username.
54
55
  * `query_target_platform` (string): If searching for Histories about API keys, this parameter restricts results to API keys associated with this platform.
55
56
  * `query_target_permission_set` (string): If searching for Histories about API keys, this parameter restricts results to API keys with this permission set.
57
+ * `results_url` (string): If `status` is `ready` and the query succeeded, this will be a URL where all the results can be downloaded at once as a CSV.
56
58
  * `user_id` (int64): User ID. Provide a value of `0` to operate the current session's user.
57
59
 
58
60
 
59
- ---
60
-
61
- ## List History Exports
62
-
63
- ```
64
- Files::HistoryExport.list(
65
- user_id: 1,
66
- page: 1,
67
- per_page: 1
68
- )
69
- ```
70
-
71
- ### Parameters
72
-
73
- * `user_id` (int64): User ID. Provide a value of `0` to operate the current session's user.
74
- * `page` (int64): Current page number.
75
- * `per_page` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
76
- * `action` (string): Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
77
-
78
-
79
61
  ---
80
62
 
81
63
  ## Show History Export
@@ -144,31 +126,3 @@ Files::HistoryExport.create(
144
126
  * `query_target_username` (string): If searching for Histories about API keys, this parameter restricts results to API keys created by/for this username.
145
127
  * `query_target_platform` (string): If searching for Histories about API keys, this parameter restricts results to API keys associated with this platform.
146
128
  * `query_target_permission_set` (string): If searching for Histories about API keys, this parameter restricts results to API keys with this permission set.
147
-
148
-
149
- ---
150
-
151
- ## Delete History Export
152
-
153
- ```
154
- Files::HistoryExport.delete(id)
155
- ```
156
-
157
- ### Parameters
158
-
159
- * `id` (int64): Required - History Export ID.
160
-
161
-
162
- ---
163
-
164
- ## Delete History Export
165
-
166
- ```
167
- history_export = Files::HistoryExport.list_for(path).first
168
-
169
- history_export.delete
170
- ```
171
-
172
- ### Parameters
173
-
174
- * `id` (int64): Required - History Export ID.
@@ -0,0 +1,80 @@
1
+ # HistoryExportResult
2
+
3
+ ## Example HistoryExportResult Object
4
+
5
+ ```
6
+ {
7
+ "id": 1,
8
+ "created_at": 1,
9
+ "user_id": 1,
10
+ "file_id": 1,
11
+ "parent_id": 1,
12
+ "path": "MyFile.txt",
13
+ "folder": "Folder",
14
+ "src": "SrcFolder",
15
+ "destination": "DestFolder",
16
+ "ip": "127.0.0.1",
17
+ "username": "jerry",
18
+ "action": "read",
19
+ "failure_type": "bad_password",
20
+ "interface": "ftp",
21
+ "target_id": 1,
22
+ "target_name": "full",
23
+ "target_permission": "full",
24
+ "target_recursive": true,
25
+ "target_expires_at": 1,
26
+ "target_permission_set": "desktop_app",
27
+ "target_platform": "windows",
28
+ "target_username": "jerry",
29
+ "target_user_id": 1
30
+ }
31
+ ```
32
+
33
+ * `id` (int64): Action ID
34
+ * `created_at` (int64): When the action happened
35
+ * `user_id` (int64): User ID
36
+ * `file_id` (int64): File ID related to the action
37
+ * `parent_id` (int64): ID of the parent folder
38
+ * `path` (string): Path of the related action This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
39
+ * `folder` (string): Folder in which the action occurred
40
+ * `src` (string): File move originated from this path
41
+ * `destination` (string): File moved to this destination folder
42
+ * `ip` (string): Client IP that performed the action
43
+ * `username` (string): Username of the user that performed the action
44
+ * `action` (string): What action was taken. Valid values: `create`, `read`, `update`, `destroy`, `move`, `login`, `failedlogin`, `copy`, `user_create`, `user_update`, `user_destroy`, `group_create`, `group_update`, `group_destroy`, `permission_create`, `permission_destroy`, `api_key_create`, `api_key_update`, `api_key_destroy`
45
+ * `failure_type` (string): The type of login failure, if applicable. Valid values: `expired_trial`, `account_overdue`, `locked_out`, `ip_mismatch`, `password_mismatch`, `site_mismatch`, `username_not_found`, `none`, `no_ftp_permission`, `no_web_permission`, `no_directory`, `errno_enoent`, `no_sftp_permission`, `no_dav_permission`, `no_restapi_permission`, `key_mismatch`, `region_mismatch`, `expired_access`, `desktop_ip_mismatch`, `desktop_api_key_not_used_quickly_enough`, `disabled`
46
+ * `interface` (string): Inteface through which the action was taken. Valid values: `web`, `ftp`, `robot`, `jsapi`, `webdesktopapi`, `sftp`, `dav`, `desktop`, `restapi`, `scim`
47
+ * `target_id` (int64): ID of the object (such as Users, or API Keys) on which the action was taken
48
+ * `target_name` (string): Name of the User, Group or other object with a name related to this action
49
+ * `target_permission` (string): Permission level of the action
50
+ * `target_recursive` (boolean): Whether or not the action was recursive
51
+ * `target_expires_at` (int64): If searching for Histories about API keys, this is when the API key will expire
52
+ * `target_permission_set` (string): If searching for Histories about API keys, this represents the permission set of the associated API key
53
+ * `target_platform` (string): If searching for Histories about API keys, this is the platform on which the action was taken
54
+ * `target_username` (string): If searching for Histories about API keys, this is the username on which the action was taken
55
+ * `target_user_id` (int64): If searching for Histories about API keys, this is the User ID on which the action was taken
56
+
57
+
58
+ ---
59
+
60
+ ## List History Export Results
61
+
62
+ ```
63
+ Files::HistoryExportResult.list(
64
+ user_id: 1,
65
+ page: 1,
66
+ per_page: 1,
67
+ action: "read",
68
+ history_export_id: 1
69
+ )
70
+ ```
71
+
72
+ ### Parameters
73
+
74
+ * `user_id` (int64): User ID. Provide a value of `0` to operate the current session's user.
75
+ * `page` (int64): Current page number.
76
+ * `per_page` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
77
+ * `action` (string): Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
78
+ * `cursor` (string): Send cursor to resume an existing list from the point at which you left off. Get a cursor from an existing list via the X-Files-Cursor-Next header.
79
+ * `sort_by` (object): If set, sort records by the specified field in either 'asc' or 'desc' direction (e.g. sort_by[last_login_at]=desc). Valid fields are `created_at`.
80
+ * `history_export_id` (int64): Required - ID of the associated history export.
@@ -30,7 +30,7 @@
30
30
  ## List Permissions
31
31
 
32
32
  ```
33
- Files::Permission.list(path,
33
+ Files::Permission.list(
34
34
  page: 1,
35
35
  per_page: 1,
36
36
  group_id: 1,
@@ -63,7 +63,7 @@ Files::Permission.list(path,
63
63
  ## Create Permission
64
64
 
65
65
  ```
66
- Files::Permission.create(path,
66
+ Files::Permission.create(
67
67
  group_id: 1,
68
68
  permission: "full",
69
69
  recursive: true,
@@ -93,3 +93,18 @@ Files::Permission.delete(id)
93
93
  ### Parameters
94
94
 
95
95
  * `id` (int64): Required - Permission ID.
96
+
97
+
98
+ ---
99
+
100
+ ## Delete Permission
101
+
102
+ ```
103
+ permission = Files::Permission.list_for(path).first
104
+
105
+ permission.delete
106
+ ```
107
+
108
+ ### Parameters
109
+
110
+ * `id` (int64): Required - Permission ID.
@@ -28,7 +28,7 @@
28
28
  ## List Requests
29
29
 
30
30
  ```
31
- Files::Request.list(path,
31
+ Files::Request.list(
32
32
  page: 1,
33
33
  per_page: 1,
34
34
  mine: true
@@ -51,7 +51,7 @@ Files::Request.list(path,
51
51
  ## List Requests
52
52
 
53
53
  ```
54
- Files::Request.find_folder(path,
54
+ Files::Request.get_folder(path,
55
55
  page: 1,
56
56
  per_page: 1,
57
57
  mine: true
@@ -74,7 +74,8 @@ Files::Request.find_folder(path,
74
74
  ## Create Request
75
75
 
76
76
  ```
77
- Files::Request.create(path,
77
+ Files::Request.create(
78
+ path: "path",
78
79
  destination: "destination"
79
80
  )
80
81
  ```
@@ -98,3 +99,18 @@ Files::Request.delete(id)
98
99
  ### Parameters
99
100
 
100
101
  * `id` (int64): Required - Request ID.
102
+
103
+
104
+ ---
105
+
106
+ ## Delete Request
107
+
108
+ ```
109
+ request = Files::Request.list_for(path).first
110
+
111
+ request.delete
112
+ ```
113
+
114
+ ### Parameters
115
+
116
+ * `id` (int64): Required - Request ID.
@@ -4,12 +4,14 @@
4
4
 
5
5
  ```
6
6
  {
7
+ "id": 1,
7
8
  "name": "John Doe",
8
9
  "email": "john.doe@files.com",
9
10
  "details": "Changed Departments"
10
11
  }
11
12
  ```
12
13
 
14
+ * `id` (int64): ID
13
15
  * `name` (string): User's full name
14
16
  * `email` (email): User email address
15
17
  * `details` (string): Details of the user's request
@@ -33,6 +33,7 @@ require "files.com/models/app"
33
33
  require "files.com/models/as2_key"
34
34
  require "files.com/models/auto"
35
35
  require "files.com/models/automation"
36
+ require "files.com/models/bandwidth_snapshot"
36
37
  require "files.com/models/behavior"
37
38
  require "files.com/models/bundle"
38
39
  require "files.com/models/bundle_download"
@@ -50,6 +51,7 @@ require "files.com/models/group"
50
51
  require "files.com/models/group_user"
51
52
  require "files.com/models/history"
52
53
  require "files.com/models/history_export"
54
+ require "files.com/models/history_export_result"
53
55
  require "files.com/models/image"
54
56
  require "files.com/models/invoice"
55
57
  require "files.com/models/invoice_line_item"
@@ -145,11 +145,12 @@ module Files
145
145
  end
146
146
  end
147
147
 
148
- def stream_download(uri, io)
148
+ def stream_download(uri, io, range)
149
149
  if conn.adapter == Faraday::Adapter::NetHttp
150
150
  uri = URI(uri)
151
151
  Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http|
152
152
  request = Net::HTTP::Get.new uri
153
+ request["RANGE"] = "bytes=#{range[0]}-#{range[1]}" if range
153
154
  http.request request do |response|
154
155
  io.fulfill_content_length(response.content_length) if io.respond_to?(:fulfill_content_length)
155
156
  response.read_body do |chunk|
@@ -0,0 +1,91 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Files
4
+ class BandwidthSnapshot
5
+ attr_reader :options, :attributes
6
+
7
+ def initialize(attributes = {}, options = {})
8
+ @attributes = attributes || {}
9
+ @options = options || {}
10
+ end
11
+
12
+ # int64 - Site bandwidth ID
13
+ def id
14
+ @attributes[:id]
15
+ end
16
+
17
+ # double - Site bandwidth report bytes received
18
+ def bytes_received
19
+ @attributes[:bytes_received]
20
+ end
21
+
22
+ # double - Site bandwidth report bytes sent
23
+ def bytes_sent
24
+ @attributes[:bytes_sent]
25
+ end
26
+
27
+ # double - Site bandwidth report get requests
28
+ def requests_get
29
+ @attributes[:requests_get]
30
+ end
31
+
32
+ # double - Site bandwidth report put requests
33
+ def requests_put
34
+ @attributes[:requests_put]
35
+ end
36
+
37
+ # double - Site bandwidth report other requests
38
+ def requests_other
39
+ @attributes[:requests_other]
40
+ end
41
+
42
+ # date-time - Time the site bandwidth report was logged
43
+ def logged_at
44
+ @attributes[:logged_at]
45
+ end
46
+
47
+ # date-time - Site bandwidth report created at date/time
48
+ def created_at
49
+ @attributes[:created_at]
50
+ end
51
+
52
+ # date-time - The last time this site bandwidth report was updated
53
+ def updated_at
54
+ @attributes[:updated_at]
55
+ end
56
+
57
+ # Parameters:
58
+ # page - int64 - Current page number.
59
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
60
+ # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
61
+ # cursor - string - Send cursor to resume an existing list from the point at which you left off. Get a cursor from an existing list via the X-Files-Cursor-Next header.
62
+ # sort_by - object - If set, sort records by the specified field in either 'asc' or 'desc' direction (e.g. sort_by[last_login_at]=desc). Valid fields are `site_id` and `logged_at`.
63
+ # filter - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `logged_at`.
64
+ # filter_gt - object - If set, return records where the specifiied field is greater than the supplied value. Valid fields are `logged_at`.
65
+ # filter_gteq - object - If set, return records where the specifiied field is greater than or equal to the supplied value. Valid fields are `logged_at`.
66
+ # filter_like - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `logged_at`.
67
+ # filter_lt - object - If set, return records where the specifiied field is less than the supplied value. Valid fields are `logged_at`.
68
+ # filter_lteq - object - If set, return records where the specifiied field is less than or equal to the supplied value. Valid fields are `logged_at`.
69
+ def self.list(params = {}, options = {})
70
+ raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
71
+ raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
72
+ raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
73
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
74
+ raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params.dig(:sort_by) and !params.dig(:sort_by).is_a?(Hash)
75
+ raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params.dig(:filter) and !params.dig(:filter).is_a?(Hash)
76
+ raise InvalidParameterError.new("Bad parameter: filter_gt must be an Hash") if params.dig(:filter_gt) and !params.dig(:filter_gt).is_a?(Hash)
77
+ raise InvalidParameterError.new("Bad parameter: filter_gteq must be an Hash") if params.dig(:filter_gteq) and !params.dig(:filter_gteq).is_a?(Hash)
78
+ raise InvalidParameterError.new("Bad parameter: filter_like must be an Hash") if params.dig(:filter_like) and !params.dig(:filter_like).is_a?(Hash)
79
+ raise InvalidParameterError.new("Bad parameter: filter_lt must be an Hash") if params.dig(:filter_lt) and !params.dig(:filter_lt).is_a?(Hash)
80
+ raise InvalidParameterError.new("Bad parameter: filter_lteq must be an Hash") if params.dig(:filter_lteq) and !params.dig(:filter_lteq).is_a?(Hash)
81
+
82
+ List.new(BandwidthSnapshot, params) do
83
+ Api.send_request("/bandwidth_snapshots", :get, params, options)
84
+ end
85
+ end
86
+
87
+ def self.all(params = {}, options = {})
88
+ list(params, options)
89
+ end
90
+ end
91
+ end
@@ -305,8 +305,8 @@ module Files
305
305
  end
306
306
  end
307
307
 
308
- def download_content(io)
309
- Files::ApiClient.download_client.stream_download(download_uri_with_load, io)
308
+ def download_content(io, range: [])
309
+ Files::ApiClient.download_client.stream_download(download_uri_with_load, io, range)
310
310
  end
311
311
 
312
312
  def each(*args, &block)
@@ -388,11 +388,11 @@ module Files
388
388
  read_io.gets *args
389
389
  end
390
390
 
391
- def read_io
391
+ def read_io(**options)
392
392
  @read_io ||= begin
393
393
  r, w = SizableIO.pipe
394
394
  Thread.new do
395
- download_content(w)
395
+ download_content(w, **options)
396
396
  ensure
397
397
  w.close
398
398
  end
@@ -873,12 +873,8 @@ module Files
873
873
  end
874
874
 
875
875
  def save
876
- if @attributes[:path]
877
- update(@attributes)
878
- else
879
- new_obj = File.create(@attributes, @options)
880
- @attributes = new_obj.attributes
881
- end
876
+ new_obj = File.create(path, @attributes, @options)
877
+ @attributes = new_obj.attributes
882
878
  end
883
879
 
884
880
  # Download file
@@ -49,6 +49,11 @@ module Files
49
49
  @attributes[:next_partsize]
50
50
  end
51
51
 
52
+ # boolean - If true, parts may be uploaded in parallel
53
+ def parallel_parts
54
+ @attributes[:parallel_parts]
55
+ end
56
+
52
57
  # string - Additional upload parameters
53
58
  def parameters
54
59
  @attributes[:parameters]
@@ -304,12 +304,8 @@ module Files
304
304
  end
305
305
 
306
306
  def save
307
- if @attributes[:path]
308
- raise NotImplementedError.new("The Folder object doesn't support updates.")
309
- else
310
- new_obj = Folder.create(@attributes, @options)
311
- @attributes = new_obj.attributes
312
- end
307
+ new_obj = Folder.create(path, @attributes, @options)
308
+ @attributes = new_obj.attributes
313
309
  end
314
310
 
315
311
  # Parameters:
@@ -216,6 +216,15 @@ module Files
216
216
  @attributes[:query_target_permission_set] = value
217
217
  end
218
218
 
219
+ # string - If `status` is `ready` and the query succeeded, this will be a URL where all the results can be downloaded at once as a CSV.
220
+ def results_url
221
+ @attributes[:results_url]
222
+ end
223
+
224
+ def results_url=(value)
225
+ @attributes[:results_url] = value
226
+ end
227
+
219
228
  # int64 - User ID. Provide a value of `0` to operate the current session's user.
220
229
  def user_id
221
230
  @attributes[:user_id]
@@ -225,20 +234,6 @@ module Files
225
234
  @attributes[:user_id] = value
226
235
  end
227
236
 
228
- def delete(params = {})
229
- params ||= {}
230
- params[:id] = @attributes[:id]
231
- raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
232
- raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
233
- raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
234
-
235
- Api.send_request("/history_exports/#{@attributes[:id]}", :delete, params, @options)
236
- end
237
-
238
- def destroy(params = {})
239
- delete(params)
240
- end
241
-
242
237
  def save
243
238
  if @attributes[:id]
244
239
  raise NotImplementedError.new("The HistoryExport object doesn't support updates.")
@@ -248,27 +243,6 @@ module Files
248
243
  end
249
244
  end
250
245
 
251
- # Parameters:
252
- # user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
253
- # page - int64 - Current page number.
254
- # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
255
- # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
256
- def self.list(params = {}, options = {})
257
- raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params.dig(:user_id) and !params.dig(:user_id).is_a?(Integer)
258
- raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
259
- raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
260
- raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
261
-
262
- response, options = Api.send_request("/history_exports", :get, params, options)
263
- response.data.map do |entity_data|
264
- HistoryExport.new(entity_data, options)
265
- end
266
- end
267
-
268
- def self.all(params = {}, options = {})
269
- list(params, options)
270
- end
271
-
272
246
  # Parameters:
273
247
  # id (required) - int64 - History Export ID.
274
248
  def self.find(id, params = {}, options = {})
@@ -335,19 +309,5 @@ module Files
335
309
  response, options = Api.send_request("/history_exports", :post, params, options)
336
310
  HistoryExport.new(response.data, options)
337
311
  end
338
-
339
- def self.delete(id, params = {}, options = {})
340
- params ||= {}
341
- params[:id] = id
342
- raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
343
- raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
344
-
345
- response, _options = Api.send_request("/history_exports/#{params[:id]}", :delete, params, options)
346
- response.data
347
- end
348
-
349
- def self.destroy(id, params = {}, options = {})
350
- delete(id, params, options)
351
- end
352
312
  end
353
313
  end
@@ -0,0 +1,154 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Files
4
+ class HistoryExportResult
5
+ attr_reader :options, :attributes
6
+
7
+ def initialize(attributes = {}, options = {})
8
+ @attributes = attributes || {}
9
+ @options = options || {}
10
+ end
11
+
12
+ # int64 - Action ID
13
+ def id
14
+ @attributes[:id]
15
+ end
16
+
17
+ # int64 - When the action happened
18
+ def created_at
19
+ @attributes[:created_at]
20
+ end
21
+
22
+ # int64 - User ID
23
+ def user_id
24
+ @attributes[:user_id]
25
+ end
26
+
27
+ # int64 - File ID related to the action
28
+ def file_id
29
+ @attributes[:file_id]
30
+ end
31
+
32
+ # int64 - ID of the parent folder
33
+ def parent_id
34
+ @attributes[:parent_id]
35
+ end
36
+
37
+ # string - Path of the related action This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
38
+ def path
39
+ @attributes[:path]
40
+ end
41
+
42
+ # string - Folder in which the action occurred
43
+ def folder
44
+ @attributes[:folder]
45
+ end
46
+
47
+ # string - File move originated from this path
48
+ def src
49
+ @attributes[:src]
50
+ end
51
+
52
+ # string - File moved to this destination folder
53
+ def destination
54
+ @attributes[:destination]
55
+ end
56
+
57
+ # string - Client IP that performed the action
58
+ def ip
59
+ @attributes[:ip]
60
+ end
61
+
62
+ # string - Username of the user that performed the action
63
+ def username
64
+ @attributes[:username]
65
+ end
66
+
67
+ # string - What action was taken. Valid values: `create`, `read`, `update`, `destroy`, `move`, `login`, `failedlogin`, `copy`, `user_create`, `user_update`, `user_destroy`, `group_create`, `group_update`, `group_destroy`, `permission_create`, `permission_destroy`, `api_key_create`, `api_key_update`, `api_key_destroy`
68
+ def action
69
+ @attributes[:action]
70
+ end
71
+
72
+ # string - The type of login failure, if applicable. Valid values: `expired_trial`, `account_overdue`, `locked_out`, `ip_mismatch`, `password_mismatch`, `site_mismatch`, `username_not_found`, `none`, `no_ftp_permission`, `no_web_permission`, `no_directory`, `errno_enoent`, `no_sftp_permission`, `no_dav_permission`, `no_restapi_permission`, `key_mismatch`, `region_mismatch`, `expired_access`, `desktop_ip_mismatch`, `desktop_api_key_not_used_quickly_enough`, `disabled`
73
+ def failure_type
74
+ @attributes[:failure_type]
75
+ end
76
+
77
+ # string - Inteface through which the action was taken. Valid values: `web`, `ftp`, `robot`, `jsapi`, `webdesktopapi`, `sftp`, `dav`, `desktop`, `restapi`, `scim`
78
+ def interface
79
+ @attributes[:interface]
80
+ end
81
+
82
+ # int64 - ID of the object (such as Users, or API Keys) on which the action was taken
83
+ def target_id
84
+ @attributes[:target_id]
85
+ end
86
+
87
+ # string - Name of the User, Group or other object with a name related to this action
88
+ def target_name
89
+ @attributes[:target_name]
90
+ end
91
+
92
+ # string - Permission level of the action
93
+ def target_permission
94
+ @attributes[:target_permission]
95
+ end
96
+
97
+ # boolean - Whether or not the action was recursive
98
+ def target_recursive
99
+ @attributes[:target_recursive]
100
+ end
101
+
102
+ # int64 - If searching for Histories about API keys, this is when the API key will expire
103
+ def target_expires_at
104
+ @attributes[:target_expires_at]
105
+ end
106
+
107
+ # string - If searching for Histories about API keys, this represents the permission set of the associated API key
108
+ def target_permission_set
109
+ @attributes[:target_permission_set]
110
+ end
111
+
112
+ # string - If searching for Histories about API keys, this is the platform on which the action was taken
113
+ def target_platform
114
+ @attributes[:target_platform]
115
+ end
116
+
117
+ # string - If searching for Histories about API keys, this is the username on which the action was taken
118
+ def target_username
119
+ @attributes[:target_username]
120
+ end
121
+
122
+ # int64 - If searching for Histories about API keys, this is the User ID on which the action was taken
123
+ def target_user_id
124
+ @attributes[:target_user_id]
125
+ end
126
+
127
+ # Parameters:
128
+ # user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
129
+ # page - int64 - Current page number.
130
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
131
+ # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
132
+ # cursor - string - Send cursor to resume an existing list from the point at which you left off. Get a cursor from an existing list via the X-Files-Cursor-Next header.
133
+ # sort_by - object - If set, sort records by the specified field in either 'asc' or 'desc' direction (e.g. sort_by[last_login_at]=desc). Valid fields are `created_at`.
134
+ # history_export_id (required) - int64 - ID of the associated history export.
135
+ def self.list(params = {}, options = {})
136
+ raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params.dig(:user_id) and !params.dig(:user_id).is_a?(Integer)
137
+ raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
138
+ raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
139
+ raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
140
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
141
+ raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params.dig(:sort_by) and !params.dig(:sort_by).is_a?(Hash)
142
+ raise InvalidParameterError.new("Bad parameter: history_export_id must be an Integer") if params.dig(:history_export_id) and !params.dig(:history_export_id).is_a?(Integer)
143
+ raise MissingParameterError.new("Parameter missing: history_export_id") unless params.dig(:history_export_id)
144
+
145
+ List.new(HistoryExportResult, params) do
146
+ Api.send_request("/history_export_results", :get, params, options)
147
+ end
148
+ end
149
+
150
+ def self.all(params = {}, options = {})
151
+ list(params, options)
152
+ end
153
+ end
154
+ end
@@ -109,12 +109,8 @@ module Files
109
109
  end
110
110
 
111
111
  def save
112
- if @attributes[:path]
113
- raise NotImplementedError.new("The Lock object doesn't support updates.")
114
- else
115
- new_obj = Lock.create(@attributes, @options)
116
- @attributes = new_obj.attributes
117
- end
112
+ new_obj = Lock.create(path, @attributes, @options)
113
+ @attributes = new_obj.attributes
118
114
  end
119
115
 
120
116
  # Parameters:
@@ -81,8 +81,22 @@ module Files
81
81
  @attributes[:recursive] = value
82
82
  end
83
83
 
84
+ def delete(params = {})
85
+ params ||= {}
86
+ params[:id] = @attributes[:id]
87
+ raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
88
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
89
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
90
+
91
+ Api.send_request("/permissions/#{@attributes[:id]}", :delete, params, @options)
92
+ end
93
+
94
+ def destroy(params = {})
95
+ delete(params)
96
+ end
97
+
84
98
  def save
85
- if @attributes[:path]
99
+ if @attributes[:id]
86
100
  raise NotImplementedError.new("The Permission object doesn't support updates.")
87
101
  else
88
102
  new_obj = Permission.create(@attributes, @options)
@@ -106,9 +120,7 @@ module Files
106
120
  # group_id - string - DEPRECATED: Group ID. If provided, will scope permissions to this group. Use `filter[group_id]` instead.`
107
121
  # user_id - string - DEPRECATED: User ID. If provided, will scope permissions to this user. Use `filter[user_id]` instead.`
108
122
  # include_groups - boolean - If searching by user or group, also include user's permissions that are inherited from its groups?
109
- def self.list(path, params = {}, options = {})
110
- params ||= {}
111
- params[:path] = path
123
+ def self.list(params = {}, options = {})
112
124
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
113
125
  raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
114
126
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
@@ -129,8 +141,8 @@ module Files
129
141
  end
130
142
  end
131
143
 
132
- def self.all(path, params = {}, options = {})
133
- list(path, params, options)
144
+ def self.all(params = {}, options = {})
145
+ list(params, options)
134
146
  end
135
147
 
136
148
  # Parameters:
@@ -140,9 +152,7 @@ module Files
140
152
  # recursive - boolean - Apply to subfolders recursively?
141
153
  # user_id - int64 - User ID. Provide `username` or `user_id`
142
154
  # username - string - User username. Provide `username` or `user_id`
143
- def self.create(path, params = {}, options = {})
144
- params ||= {}
145
- params[:path] = path
155
+ def self.create(params = {}, options = {})
146
156
  raise InvalidParameterError.new("Bad parameter: group_id must be an Integer") if params.dig(:group_id) and !params.dig(:group_id).is_a?(Integer)
147
157
  raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
148
158
  raise InvalidParameterError.new("Bad parameter: permission must be an String") if params.dig(:permission) and !params.dig(:permission).is_a?(String)
@@ -153,8 +163,6 @@ module Files
153
163
  Permission.new(response.data, options)
154
164
  end
155
165
 
156
- # Parameters:
157
- # id (required) - int64 - Permission ID.
158
166
  def self.delete(id, params = {}, options = {})
159
167
  params ||= {}
160
168
  params[:id] = id
@@ -81,8 +81,22 @@ module Files
81
81
  @attributes[:group_ids] = value
82
82
  end
83
83
 
84
+ def delete(params = {})
85
+ params ||= {}
86
+ params[:id] = @attributes[:id]
87
+ raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
88
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
89
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
90
+
91
+ Api.send_request("/requests/#{@attributes[:id]}", :delete, params, @options)
92
+ end
93
+
94
+ def destroy(params = {})
95
+ delete(params)
96
+ end
97
+
84
98
  def save
85
- if @attributes[:path]
99
+ if @attributes[:id]
86
100
  raise NotImplementedError.new("The Request object doesn't support updates.")
87
101
  else
88
102
  new_obj = Request.create(@attributes, @options)
@@ -98,9 +112,7 @@ module Files
98
112
  # sort_by - object - If set, sort records by the specified field in either 'asc' or 'desc' direction (e.g. sort_by[last_login_at]=desc). Valid fields are `site_id`, `folder_id` or `destination`.
99
113
  # mine - boolean - Only show requests of the current user? (Defaults to true if current user is not a site admin.)
100
114
  # path - string - Path to show requests for. If omitted, shows all paths. Send `/` to represent the root directory.
101
- def self.list(path, params = {}, options = {})
102
- params ||= {}
103
- params[:path] = path
115
+ def self.list(params = {}, options = {})
104
116
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
105
117
  raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
106
118
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
@@ -113,8 +125,8 @@ module Files
113
125
  end
114
126
  end
115
127
 
116
- def self.all(path, params = {}, options = {})
117
- list(path, params, options)
128
+ def self.all(params = {}, options = {})
129
+ list(params, options)
118
130
  end
119
131
 
120
132
  # Parameters:
@@ -125,7 +137,7 @@ module Files
125
137
  # sort_by - object - If set, sort records by the specified field in either 'asc' or 'desc' direction (e.g. sort_by[last_login_at]=desc). Valid fields are `site_id`, `folder_id` or `destination`.
126
138
  # mine - boolean - Only show requests of the current user? (Defaults to true if current user is not a site admin.)
127
139
  # path (required) - string - Path to show requests for. If omitted, shows all paths. Send `/` to represent the root directory.
128
- def self.find_folder(path, params = {}, options = {})
140
+ def self.get_folder(path, params = {}, options = {})
129
141
  params ||= {}
130
142
  params[:path] = path
131
143
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
@@ -146,9 +158,7 @@ module Files
146
158
  # destination (required) - string - Destination filename (without extension) to request.
147
159
  # user_ids - string - A list of user IDs to request the file from. If sent as a string, it should be comma-delimited.
148
160
  # group_ids - string - A list of group IDs to request the file from. If sent as a string, it should be comma-delimited.
149
- def self.create(path, params = {}, options = {})
150
- params ||= {}
151
- params[:path] = path
161
+ def self.create(params = {}, options = {})
152
162
  raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
153
163
  raise InvalidParameterError.new("Bad parameter: destination must be an String") if params.dig(:destination) and !params.dig(:destination).is_a?(String)
154
164
  raise InvalidParameterError.new("Bad parameter: user_ids must be an String") if params.dig(:user_ids) and !params.dig(:user_ids).is_a?(String)
@@ -160,8 +170,6 @@ module Files
160
170
  Request.new(response.data, options)
161
171
  end
162
172
 
163
- # Parameters:
164
- # id (required) - int64 - Request ID.
165
173
  def self.delete(id, params = {}, options = {})
166
174
  params ||= {}
167
175
  params[:id] = id
@@ -9,6 +9,15 @@ module Files
9
9
  @options = options || {}
10
10
  end
11
11
 
12
+ # int64 - ID
13
+ def id
14
+ @attributes[:id]
15
+ end
16
+
17
+ def id=(value)
18
+ @attributes[:id] = value
19
+ end
20
+
12
21
  # string - User's full name
13
22
  def name
14
23
  @attributes[:name]
@@ -2,7 +2,7 @@ require "spec_helper"
2
2
  require "tempfile"
3
3
 
4
4
  RSpec.describe Files::File, :with_test_folder do
5
- describe "#read" do
5
+ xdescribe "#read" do
6
6
  before do
7
7
  Files::File.open(test_folder.join("[[strange stuff]]#yes.text").to_s, 'w', options) do |f|
8
8
  f.write("contents")
@@ -15,7 +15,7 @@ RSpec.describe Files::File, :with_test_folder do
15
15
  end
16
16
  end
17
17
 
18
- describe "#read_io" do
18
+ xdescribe "#read_io" do
19
19
  before do
20
20
  Files::File.open(test_folder.join("read.txt").to_s, 'w', options) do |f|
21
21
  f.write("contents")
@@ -30,7 +30,7 @@ RSpec.describe Files::File, :with_test_folder do
30
30
  end
31
31
  end
32
32
 
33
- describe "#write" do
33
+ xdescribe "#write" do
34
34
  it "can take string" do
35
35
  Files::File.open(test_folder.join("write-as-string.txt").to_s, 'w', options) do |f|
36
36
  f.write("I am a string")
@@ -1,7 +1,7 @@
1
1
  require "spec_helper"
2
2
 
3
3
  RSpec.describe Files::Folder, :with_test_folder do
4
- describe "#list_for" do
4
+ xdescribe "#list_for" do
5
5
  before do
6
6
  Files::File.open(test_folder.join("example.txt").to_s, 'w', options) do |f|
7
7
  f.write("my text")
@@ -22,7 +22,7 @@ RSpec.describe Files::Folder, :with_test_folder do
22
22
  end
23
23
  end
24
24
 
25
- describe "#delete" do
25
+ xdescribe "#delete" do
26
26
  it "deletes a folder" do
27
27
  Files::Folder.mkdir(test_folder.join("my-new-folder").to_s, {}, options)
28
28
  Files::Folder.delete(test_folder.join("my-new-folder").to_s, {}, options)
@@ -31,7 +31,7 @@ RSpec.describe Files::Folder, :with_test_folder do
31
31
  end
32
32
  end
33
33
 
34
- describe "mkdir" do
34
+ xdescribe "mkdir" do
35
35
  it "makes a new folder" do
36
36
  Files::Folder.mkdir(test_folder.join("my-new-folder").to_s, {}, options)
37
37
  expect(Files::Folder.exist?(test_folder.join("my-new-folder").to_s, options)).to eq(true)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: files.com
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.99
4
+ version: 1.0.104
5
5
  platform: ruby
6
6
  authors:
7
7
  - files.com
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-31 00:00:00.000000000 Z
11
+ date: 2020-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -92,6 +92,7 @@ files:
92
92
  - docs/as2_key.md
93
93
  - docs/auto.md
94
94
  - docs/automation.md
95
+ - docs/bandwidth_snapshot.md
95
96
  - docs/behavior.md
96
97
  - docs/bundle.md
97
98
  - docs/bundle_download.md
@@ -110,6 +111,7 @@ files:
110
111
  - docs/group_user.md
111
112
  - docs/history.md
112
113
  - docs/history_export.md
114
+ - docs/history_export_result.md
113
115
  - docs/image.md
114
116
  - docs/invoice.md
115
117
  - docs/invoice_line_item.md
@@ -153,6 +155,7 @@ files:
153
155
  - lib/files.com/models/as2_key.rb
154
156
  - lib/files.com/models/auto.rb
155
157
  - lib/files.com/models/automation.rb
158
+ - lib/files.com/models/bandwidth_snapshot.rb
156
159
  - lib/files.com/models/behavior.rb
157
160
  - lib/files.com/models/bundle.rb
158
161
  - lib/files.com/models/bundle_download.rb
@@ -172,6 +175,7 @@ files:
172
175
  - lib/files.com/models/group_user.rb
173
176
  - lib/files.com/models/history.rb
174
177
  - lib/files.com/models/history_export.rb
178
+ - lib/files.com/models/history_export_result.rb
175
179
  - lib/files.com/models/image.rb
176
180
  - lib/files.com/models/invoice.rb
177
181
  - lib/files.com/models/invoice_line_item.rb