files.com 1.0.96 → 1.0.101
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 +4 -4
- data/_VERSION +1 -1
- data/docs/account_line_item.md +2 -2
- data/docs/action.md +1 -1
- data/docs/bandwidth_snapshot.md +45 -0
- data/docs/file_part_upload.md +1 -1
- data/docs/group.md +1 -1
- data/docs/history.md +1 -1
- data/docs/invoice.md +2 -2
- data/docs/invoice_line_item.md +1 -1
- data/docs/lock.md +1 -1
- data/docs/notification.md +2 -4
- data/docs/payment.md +2 -2
- data/docs/payment_line_item.md +1 -1
- data/docs/permission.md +17 -2
- data/docs/request.md +19 -3
- data/docs/site.md +1 -1
- data/docs/usage_snapshot.md +5 -5
- data/lib/files.com.rb +1 -0
- data/lib/files.com/api_client.rb +1 -1
- data/lib/files.com/models/bandwidth_snapshot.rb +76 -0
- data/lib/files.com/models/file.rb +2 -6
- data/lib/files.com/models/folder.rb +2 -6
- data/lib/files.com/models/group.rb +1 -1
- data/lib/files.com/models/lock.rb +2 -6
- data/lib/files.com/models/permission.rb +19 -11
- data/lib/files.com/models/request.rb +20 -12
- data/spec/models/file_spec.rb +5 -5
- data/spec/models/folder_spec.rb +3 -3
- data/test.sh +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e715ef5d2664eec58ebfa067ff3014018b9f386cfc149a8238e2e9d8bb549331
|
|
4
|
+
data.tar.gz: d135e40db26bd6c064822453b2999d4f33ea2df40c93096496acc7e4f8db2919
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5afec2ddef519a7a3c72659adf683d9a2ec227de7bfb511fbe850cda970b25c5055c661bff8ec5a0b42bef24f56a9d91224accc4c9600c885ea21542daacaaff
|
|
7
|
+
data.tar.gz: 920892400a280447dc341b269e0c48d2f15284e326869ccf4f7a2e64f0a2ed9c3c7a2db356cc40671ad3ce4b3ac0ce7272bc5f0647dffac8ea43229f5f2f0e51
|
data/_VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0.
|
|
1
|
+
1.0.101
|
data/docs/account_line_item.md
CHANGED
data/docs/action.md
CHANGED
|
@@ -0,0 +1,45 @@
|
|
|
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.
|
data/docs/file_part_upload.md
CHANGED
data/docs/group.md
CHANGED
|
@@ -44,7 +44,7 @@ Files::Group.list(
|
|
|
44
44
|
* `per_page` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
45
45
|
* `action` (string): Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
|
|
46
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 `active`, `
|
|
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 `active`, `site_id` or `name`.
|
|
48
48
|
* `filter` (object): If set, return records where the specifiied field is equal to the supplied value. Valid fields are `name`.
|
|
49
49
|
* `filter_gt` (object): If set, return records where the specifiied field is greater than the supplied value. Valid fields are `name`.
|
|
50
50
|
* `filter_gteq` (object): If set, return records where the specifiied field is greater than or equal to the supplied value. Valid fields are `name`.
|
data/docs/history.md
CHANGED
data/docs/invoice.md
CHANGED
data/docs/invoice_line_item.md
CHANGED
data/docs/lock.md
CHANGED
data/docs/notification.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
```
|
|
6
6
|
{
|
|
7
7
|
"id": 1,
|
|
8
|
-
"path": "
|
|
8
|
+
"path": "",
|
|
9
9
|
"group_id": 1,
|
|
10
10
|
"group_name": "",
|
|
11
11
|
"notify_user_actions": true,
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"unsubscribed_reason": "",
|
|
16
16
|
"user_id": 1,
|
|
17
17
|
"username": "User",
|
|
18
|
-
"suppressed_email":
|
|
18
|
+
"suppressed_email": true
|
|
19
19
|
}
|
|
20
20
|
```
|
|
21
21
|
|
|
@@ -43,7 +43,6 @@ Files::Notification.list(
|
|
|
43
43
|
page: 1,
|
|
44
44
|
per_page: 1,
|
|
45
45
|
group_id: 1,
|
|
46
|
-
path: "path",
|
|
47
46
|
include_ancestors: true
|
|
48
47
|
)
|
|
49
48
|
```
|
|
@@ -91,7 +90,6 @@ Files::Notification.create(
|
|
|
91
90
|
notify_user_actions: true,
|
|
92
91
|
send_interval: "daily",
|
|
93
92
|
group_id: 1,
|
|
94
|
-
path: "path",
|
|
95
93
|
username: "User"
|
|
96
94
|
)
|
|
97
95
|
```
|
data/docs/payment.md
CHANGED
data/docs/payment_line_item.md
CHANGED
data/docs/permission.md
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
## List Permissions
|
|
31
31
|
|
|
32
32
|
```
|
|
33
|
-
Files::Permission.list(
|
|
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(
|
|
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.
|
data/docs/request.md
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
## List Requests
|
|
29
29
|
|
|
30
30
|
```
|
|
31
|
-
Files::Request.list(
|
|
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.
|
|
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(
|
|
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.
|
data/docs/site.md
CHANGED
data/docs/usage_snapshot.md
CHANGED
|
@@ -8,15 +8,15 @@
|
|
|
8
8
|
"start_at": "2000-01-01T01:00:00Z",
|
|
9
9
|
"end_at": "2000-01-01T01:00:00Z",
|
|
10
10
|
"created_at": "2000-01-01T01:00:00Z",
|
|
11
|
-
"current_storage":
|
|
12
|
-
"high_water_storage":
|
|
11
|
+
"current_storage": 1.0,
|
|
12
|
+
"high_water_storage": 1.0,
|
|
13
13
|
"total_downloads": 1,
|
|
14
14
|
"total_uploads": 1,
|
|
15
15
|
"updated_at": "2000-01-01T01:00:00Z",
|
|
16
16
|
"usage_by_top_level_dir": "",
|
|
17
|
-
"root_storage":
|
|
18
|
-
"deleted_files_counted_in_minimum":
|
|
19
|
-
"deleted_files_storage":
|
|
17
|
+
"root_storage": 1.0,
|
|
18
|
+
"deleted_files_counted_in_minimum": 1.0,
|
|
19
|
+
"deleted_files_storage": 1.0
|
|
20
20
|
}
|
|
21
21
|
```
|
|
22
22
|
|
data/lib/files.com.rb
CHANGED
|
@@ -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"
|
data/lib/files.com/api_client.rb
CHANGED
|
@@ -169,7 +169,7 @@ module Files
|
|
|
169
169
|
end
|
|
170
170
|
|
|
171
171
|
private def api_url(url = "", base_url = nil)
|
|
172
|
-
(base_url || Files.base_url) + "/api/rest/v1" + url
|
|
172
|
+
Addressable::URI.parse((base_url || Files.base_url) + "/api/rest/v1" + url).normalize!.to_s
|
|
173
173
|
end
|
|
174
174
|
|
|
175
175
|
private def check_api_key!(api_key)
|
|
@@ -0,0 +1,76 @@
|
|
|
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
|
+
def self.list(params = {}, options = {})
|
|
62
|
+
raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
|
|
63
|
+
raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
|
|
64
|
+
raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
|
|
65
|
+
|
|
66
|
+
response, options = Api.send_request("/bandwidth_snapshots", :get, params, options)
|
|
67
|
+
response.data.map do |entity_data|
|
|
68
|
+
BandwidthSnapshot.new(entity_data, options)
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def self.all(params = {}, options = {})
|
|
73
|
+
list(params, options)
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
@@ -873,12 +873,8 @@ module Files
|
|
|
873
873
|
end
|
|
874
874
|
|
|
875
875
|
def save
|
|
876
|
-
|
|
877
|
-
|
|
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
|
|
@@ -304,12 +304,8 @@ module Files
|
|
|
304
304
|
end
|
|
305
305
|
|
|
306
306
|
def save
|
|
307
|
-
|
|
308
|
-
|
|
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:
|
|
@@ -110,7 +110,7 @@ module Files
|
|
|
110
110
|
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
111
111
|
# action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
|
|
112
112
|
# 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.
|
|
113
|
-
# 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 `active`, `
|
|
113
|
+
# 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 `active`, `site_id` or `name`.
|
|
114
114
|
# filter - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `name`.
|
|
115
115
|
# filter_gt - object - If set, return records where the specifiied field is greater than the supplied value. Valid fields are `name`.
|
|
116
116
|
# filter_gteq - object - If set, return records where the specifiied field is greater than or equal to the supplied value. Valid fields are `name`.
|
|
@@ -109,12 +109,8 @@ module Files
|
|
|
109
109
|
end
|
|
110
110
|
|
|
111
111
|
def save
|
|
112
|
-
|
|
113
|
-
|
|
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[:
|
|
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(
|
|
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(
|
|
133
|
-
list(
|
|
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(
|
|
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[:
|
|
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(
|
|
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(
|
|
117
|
-
list(
|
|
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.
|
|
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(
|
|
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
|
data/spec/models/file_spec.rb
CHANGED
|
@@ -2,20 +2,20 @@ require "spec_helper"
|
|
|
2
2
|
require "tempfile"
|
|
3
3
|
|
|
4
4
|
RSpec.describe Files::File, :with_test_folder do
|
|
5
|
-
|
|
5
|
+
xdescribe "#read" do
|
|
6
6
|
before do
|
|
7
|
-
Files::File.open(test_folder.join("
|
|
7
|
+
Files::File.open(test_folder.join("[[strange stuff]]#yes.text").to_s, 'w', options) do |f|
|
|
8
8
|
f.write("contents")
|
|
9
9
|
end
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
it "returns the body of the file" do
|
|
13
|
-
file = Files::File.find(test_folder.join("
|
|
13
|
+
file = Files::File.find(test_folder.join("[[strange stuff]]#yes.text").to_s, {}, options)
|
|
14
14
|
expect(file.read).to eq("contents")
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
|
|
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
|
-
|
|
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")
|
data/spec/models/folder_spec.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require "spec_helper"
|
|
2
2
|
|
|
3
3
|
RSpec.describe Files::Folder, :with_test_folder do
|
|
4
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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)
|
data/test.sh
CHANGED
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.
|
|
4
|
+
version: 1.0.101
|
|
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-
|
|
11
|
+
date: 2020-08-03 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
|
|
@@ -153,6 +154,7 @@ files:
|
|
|
153
154
|
- lib/files.com/models/as2_key.rb
|
|
154
155
|
- lib/files.com/models/auto.rb
|
|
155
156
|
- lib/files.com/models/automation.rb
|
|
157
|
+
- lib/files.com/models/bandwidth_snapshot.rb
|
|
156
158
|
- lib/files.com/models/behavior.rb
|
|
157
159
|
- lib/files.com/models/bundle.rb
|
|
158
160
|
- lib/files.com/models/bundle_download.rb
|
|
@@ -232,7 +234,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
232
234
|
- !ruby/object:Gem::Version
|
|
233
235
|
version: '0'
|
|
234
236
|
requirements: []
|
|
235
|
-
rubygems_version: 3.1.
|
|
237
|
+
rubygems_version: 3.1.4
|
|
236
238
|
signing_key:
|
|
237
239
|
specification_version: 4
|
|
238
240
|
summary: Files.com Ruby client.
|