files.com 1.1.110 → 1.1.111
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +438 -63
- data/_VERSION +1 -1
- data/lib/files.com/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99beea965d4c6448002096eda9b41b4874a167e51d5eb6e356776b37e9b9ad39
|
4
|
+
data.tar.gz: 87e628927f868e366b00a6fef4ae445d44db8accd55897552c586e2fee312b00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4acdd42c64d1e51c3dc3370649afc62e19e12d69f3a1b5d035f4f05d6a0aef82049eb0e079a6e73598ee0cf49d38718758c8711d688bade34048c2d4ee06c4a8
|
7
|
+
data.tar.gz: a3e6bef77c115538988d1652503fa4a9f0ecf386d45e8fbf53fb0338b0eac87decd566fe4ebb379b4e2e07e49367b3568cf3fb41f8d30473d517f5eea69bf099
|
data/README.md
CHANGED
@@ -1,18 +1,24 @@
|
|
1
1
|
# Files.com Ruby Client
|
2
2
|
|
3
|
-
The
|
3
|
+
The content included here should be enough to get started, but please visit our
|
4
|
+
[Developer Documentation Website](https://developers.files.com/ruby/) for the complete documentation.
|
5
|
+
|
6
|
+
## Introduction
|
4
7
|
|
8
|
+
The Files.com Ruby client library provides convenient access to the Files.com API from applications written in the Ruby language.
|
5
9
|
|
6
|
-
|
10
|
+
### Installation
|
7
11
|
|
8
12
|
To install the package:
|
9
13
|
|
10
|
-
|
11
|
-
|
14
|
+
```bash
|
15
|
+
gem install files.com
|
16
|
+
````
|
12
17
|
Or add this to your app's Gemfile:
|
13
18
|
|
14
|
-
|
15
|
-
|
19
|
+
```ruby
|
20
|
+
gem 'files.com', '~> 1.0'
|
21
|
+
````
|
16
22
|
|
17
23
|
### Requirements
|
18
24
|
|
@@ -20,107 +26,476 @@ Or add this to your app's Gemfile:
|
|
20
26
|
|
21
27
|
Ruby 2.x is now considered end-of-life by the Ruby project. As a policy, Files.com does not support integrations which are considered end-of-life by their vendor.
|
22
28
|
|
29
|
+
<Note title="Repository">
|
30
|
+
Explore the [files-sdk-ruby](https://github.com/Files-com/files-sdk-ruby) code on GitHub.
|
31
|
+
</Note>
|
23
32
|
|
24
|
-
|
33
|
+
### Getting Support
|
25
34
|
|
26
|
-
|
35
|
+
The Files.com team is happy to help with any SDK Integration challenges you
|
36
|
+
may face.
|
27
37
|
|
28
|
-
|
38
|
+
Just email support@files.com and we'll get the process started.
|
29
39
|
|
40
|
+
## Authentication
|
30
41
|
|
31
|
-
|
42
|
+
### Authenticate with an API Key
|
32
43
|
|
33
|
-
|
44
|
+
Authenticating with an API key is the recommended authentication method for most scenarios, and is
|
45
|
+
the method used in the examples on this site.
|
34
46
|
|
35
|
-
|
47
|
+
To use the API or SDKs with an API Key, first generate an API key from the [web
|
48
|
+
interface](https://www.files.com/docs/sdk-and-apis/api-keys) or [via the API or an
|
49
|
+
SDK](/ruby/resources/developers/api-keys).
|
36
50
|
|
51
|
+
Note that when using a user-specific API key, if the user is an administrator, you will have full
|
52
|
+
access to the entire API. If the user is not an administrator, you will only be able to access files
|
53
|
+
that user can access, and no access will be granted to site administration functions in the API.
|
37
54
|
|
38
|
-
|
55
|
+
```ruby title="Example Request"
|
56
|
+
Files.api_key = 'YOUR_API_KEY'
|
39
57
|
|
40
|
-
|
41
|
-
|
58
|
+
## Alternatively, you can specify the API key on a per-request basis in the final parameter to any method or initializer.
|
59
|
+
Files::User.new(params, api_key: 'YOUR_API_KEY')
|
60
|
+
```
|
42
61
|
|
43
|
-
|
62
|
+
<Note>
|
63
|
+
Don't forget to replace the placeholder, `YOUR_API_KEY`, with your actual API key.
|
64
|
+
</Note>
|
44
65
|
|
45
|
-
|
46
|
-
on models returned from the API.
|
66
|
+
### Authenticate with a Session
|
47
67
|
|
68
|
+
You can also authenticate to the REST API or SDKs by creating a user session using the username and
|
69
|
+
password of an active user. If the user is an administrator, the session will have full access to
|
70
|
+
the entire API. Sessions created from regular user accounts will only be able to access files that
|
71
|
+
user can access, and no access will be granted to site administration functions.
|
48
72
|
|
49
|
-
|
73
|
+
API sessions use the exact same session timeout settings as web interface sessions. When an API
|
74
|
+
session times out, simply create a new session and resume where you left off. This process is not
|
75
|
+
automatically handled by SDKs because we do not want to store password information in memory without
|
76
|
+
your explicit consent.
|
50
77
|
|
51
|
-
|
78
|
+
#### Logging in
|
52
79
|
|
53
|
-
|
80
|
+
To create a session, the `create` method is called on the `Files::Session` object with the user's username and
|
81
|
+
password.
|
54
82
|
|
55
|
-
|
83
|
+
This returns a session object that can be used to authenticate SDK method calls.
|
56
84
|
|
57
|
-
|
85
|
+
```ruby title="Example Request"
|
86
|
+
session = Files::Session.create(username: "username", password: "password")
|
87
|
+
```
|
58
88
|
|
59
|
-
|
89
|
+
#### Using a session
|
60
90
|
|
61
|
-
|
91
|
+
Once a session has been created, you can store the session globally, use the session per object, or use the session per request to authenticate SDK operations.
|
62
92
|
|
93
|
+
```ruby title="Example Requests"
|
94
|
+
## You may set the returned session to be used by default for subsequent requests.
|
95
|
+
Files.session = Files::Session.create(username: "username", password: "password")
|
63
96
|
|
64
|
-
|
97
|
+
## Alternatively, you can specify the session ID on a per-object basis in the second parameter to a model constructor.
|
98
|
+
user = Files::User.new(params, session_id: session.id)
|
65
99
|
|
66
|
-
You
|
100
|
+
## You may also specify the session ID on a per-request basis in the final parameter to static methods.
|
101
|
+
Files::Group.list({}, session_id: session.id)
|
67
102
|
|
68
|
-
|
69
|
-
* `Files.open_timeout` - open timeout in seconds (default: 30)
|
70
|
-
* `Files.read_timeout` - read timeout in seconds (default: 80)
|
71
|
-
* `Files.initial_network_retry_delay` - initial retry delay in seconds (default: 0.5)
|
72
|
-
* `Files.max_network_retries` - max retries (default: 3)
|
73
|
-
* `Files.max_network_retry_delay` - max retry delay in seconds (default: 2)
|
74
|
-
* `Files.base_url` - Set client to use your site subdomain if your site is configured to disable global acceleration.
|
75
|
-
Otherwise, don't change this setting for production. For dev/CI, you can point this to the mock server.
|
76
|
-
* `Files.proxy` - proxy configuration (uses Faraday format)
|
103
|
+
````
|
77
104
|
|
105
|
+
#### Logging out
|
78
106
|
|
79
|
-
|
107
|
+
User sessions can be ended calling the `destroy` method on the `session` object.
|
80
108
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
Files::Folder).
|
109
|
+
```ruby title="Example Request"
|
110
|
+
session.destroy()
|
111
|
+
```
|
85
112
|
|
113
|
+
## Configuration
|
86
114
|
|
87
|
-
|
115
|
+
### Configuration options
|
88
116
|
|
89
|
-
|
90
|
-
puts file.path
|
91
|
-
end
|
117
|
+
#### Base URL
|
92
118
|
|
119
|
+
Setting the base URL for the API is required if your site is configured to disable global acceleration.
|
120
|
+
This can also be set to use a mock server in development or CI.
|
93
121
|
|
94
|
-
|
122
|
+
```ruby title="Example setting"
|
123
|
+
Files.base_url = "https://SUBDOMAIN.files.com"
|
124
|
+
```
|
95
125
|
|
96
|
-
|
126
|
+
#### Log level
|
97
127
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
end
|
128
|
+
Supported values:
|
129
|
+
* `nil`
|
130
|
+
* "info"
|
131
|
+
* "debug"
|
103
132
|
|
133
|
+
```ruby title="Example setting"
|
134
|
+
Files.log_level = 'info'
|
135
|
+
```
|
104
136
|
|
105
|
-
####
|
137
|
+
#### Proxy
|
106
138
|
|
107
|
-
|
139
|
+
Proxy configuration in Faraday format.
|
108
140
|
|
141
|
+
```ruby title="Example setting"
|
142
|
+
Files.proxy = {
|
143
|
+
uri: 'https://proxy.example.com',
|
144
|
+
user: 'proxy_me',
|
145
|
+
password: 'my_password',
|
146
|
+
}
|
147
|
+
```
|
109
148
|
|
110
|
-
|
149
|
+
#### Open timeout
|
111
150
|
|
112
|
-
|
113
|
-
in the `docs/` subdirectory of this directory.
|
151
|
+
Open timeout in seconds. The default value is 30.
|
114
152
|
|
153
|
+
```ruby title="Example setting"
|
154
|
+
Files.open_timeout = 60
|
155
|
+
```
|
115
156
|
|
116
|
-
|
157
|
+
#### Read timeout
|
117
158
|
|
118
|
-
|
159
|
+
Read timeout in seconds. The default value is 80.
|
119
160
|
|
161
|
+
```ruby title="Example setting"
|
162
|
+
Files.read_timeout = 90
|
163
|
+
```
|
120
164
|
|
121
|
-
|
165
|
+
#### Initial network retry delay
|
122
166
|
|
123
|
-
|
124
|
-
may face.
|
167
|
+
Initial retry delay in seconds. The default value is 0.5.
|
125
168
|
|
126
|
-
|
169
|
+
```ruby title="Example setting"
|
170
|
+
Files.initial_network_retry_delay = 1
|
171
|
+
```
|
172
|
+
|
173
|
+
#### Maximum retry delay
|
174
|
+
|
175
|
+
Maximum network retry delay in seconds. The default value is 2.
|
176
|
+
|
177
|
+
```ruby title="Example setting"
|
178
|
+
Files.max_network_retry_delay = 5
|
179
|
+
```
|
180
|
+
|
181
|
+
#### Maximum network retries
|
182
|
+
|
183
|
+
Maximum number of retries. The default value is 3.
|
184
|
+
|
185
|
+
```ruby title="Example setting"
|
186
|
+
Files.max_network_retries = 5
|
187
|
+
```
|
188
|
+
|
189
|
+
### Logging
|
190
|
+
|
191
|
+
The Files.com SDK is compatible with the standard log4j logging scheme.
|
192
|
+
|
193
|
+
Add `com.files` logger to your `Loggers` root in the `log4j2.xml` file.
|
194
|
+
|
195
|
+
```xml title="log4j2.xml"
|
196
|
+
<Loggers>
|
197
|
+
<!-- set preferred level -->
|
198
|
+
<Logger name="com.files" level="TRACE" />
|
199
|
+
<!-- to enable network request -->
|
200
|
+
<Logger name="okhttp3.logging.wire" level="INFO"/>
|
201
|
+
</Loggers>
|
202
|
+
```
|
203
|
+
|
204
|
+
Create a `resources/log4j2.xml` file.
|
205
|
+
|
206
|
+
```xml title="resources/log4j2.xml"
|
207
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
208
|
+
<Configuration>
|
209
|
+
<Appenders>
|
210
|
+
<Console name="Console" target="SYSTEM_OUT">
|
211
|
+
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
|
212
|
+
</Console>
|
213
|
+
</Appenders>
|
214
|
+
<Loggers>
|
215
|
+
<!-- set preferred level -->
|
216
|
+
<Logger name="com.files" level="TRACE"/>
|
217
|
+
<!-- to enable network request -->
|
218
|
+
<Logger name="okhttp3.logging.wire" level="INFO"/>
|
219
|
+
</Loggers>
|
220
|
+
</Configuration>
|
221
|
+
```
|
222
|
+
|
223
|
+
You can read more about [log4j2 configuration](https://logging.apache.org/log4j/2.x/manual/configuration.html).
|
224
|
+
|
225
|
+
## Errors
|
226
|
+
|
227
|
+
The Files.com Ruby SDK will return errors by raising exceptions. There are many exception classes defined in the Files SDK that correspond
|
228
|
+
to specific errors.
|
229
|
+
|
230
|
+
The raised exceptions come from two categories:
|
231
|
+
|
232
|
+
1. SDK Exceptions - errors that originate within the SDK
|
233
|
+
2. API Exceptions - errors that occur due to the response from the Files.com API. These errors are grouped into common error types.
|
234
|
+
|
235
|
+
There are several types of exceptions within each category. Exception classes indicate different types of errors and are named in a
|
236
|
+
fashion that describe the general premise of the originating error. More details can be found in the `message` attribute of
|
237
|
+
the capture exception object.
|
238
|
+
|
239
|
+
Use standard Ruby exception handling to detect and deal with errors. It is generally recommended to rescue for specific errors first, then
|
240
|
+
rescue for general `Files::Error` as a catch-all.
|
241
|
+
|
242
|
+
```ruby title="Example Error Handling"
|
243
|
+
begin
|
244
|
+
session = Files::Session.create(username: "USERNAME", password: "BADPASSWORD")
|
245
|
+
rescue Files::NotAuthenticatedError => e
|
246
|
+
puts "An Authentication Error has occured (#{e.class.to_s}): " + e.message
|
247
|
+
rescue Files::Error => e
|
248
|
+
puts "An Unknown Error has occured (#{e.class.to_s}): " + e.message
|
249
|
+
end
|
250
|
+
```
|
251
|
+
|
252
|
+
### Error Types
|
253
|
+
|
254
|
+
#### SDK Errors
|
255
|
+
|
256
|
+
SDK errors are general errors that occure within the SDK code. Each exception class inherits from a standard `Error` base class.
|
257
|
+
|
258
|
+
```ruby title="Example SDK Exception Class Inheritance Structure"
|
259
|
+
Files::APIConnectionError -> Files::Error -> StandardError
|
260
|
+
```
|
261
|
+
##### SDK Exception Classes
|
262
|
+
|
263
|
+
| Error Class Name| Description |
|
264
|
+
| --------------- | ------------ |
|
265
|
+
| `APIConnectionError`| The Files.com API cannot be reached |
|
266
|
+
| `AuthenticationError`| Not enough authentication information has been provided |
|
267
|
+
| `InvalidParameterError`| A passed in parameter is invalid |
|
268
|
+
| `MissingParameterError`| A method parameter is missing |
|
269
|
+
| `NotImplementedError`| The called method has not be implemented by the SDK |
|
270
|
+
|
271
|
+
#### API Errors
|
272
|
+
|
273
|
+
API errors are errors returned by the Files.com API. Each exception class inherits from an error group base class.
|
274
|
+
The error group base class indicates a particular type of error.
|
275
|
+
|
276
|
+
```ruby title="Example API Exception Class Inheritance Structure"
|
277
|
+
Files::FolderAdminPermissionRequiredError -> Files::NotAuthorizedError -> Files::Error -> StandardError
|
278
|
+
```
|
279
|
+
##### API Exception Classes
|
280
|
+
|
281
|
+
| Error Class Name | Error Group |
|
282
|
+
| --------- | --------- |
|
283
|
+
|`AgentUpgradeRequiredError`| `BadRequestError` |
|
284
|
+
|`AttachmentTooLargeError`| `BadRequestError` |
|
285
|
+
|`CannotDownloadDirectoryError`| `BadRequestError` |
|
286
|
+
|`CantMoveWithMultipleLocationsError`| `BadRequestError` |
|
287
|
+
|`DatetimeParseError`| `BadRequestError` |
|
288
|
+
|`DestinationSameError`| `BadRequestError` |
|
289
|
+
|`FolderMustNotBeAFileError`| `BadRequestError` |
|
290
|
+
|`InvalidBodyError`| `BadRequestError` |
|
291
|
+
|`InvalidCursorError`| `BadRequestError` |
|
292
|
+
|`InvalidCursorTypeForSortError`| `BadRequestError` |
|
293
|
+
|`InvalidEtagsError`| `BadRequestError` |
|
294
|
+
|`InvalidFilterAliasCombinationError`| `BadRequestError` |
|
295
|
+
|`InvalidFilterCombinationError`| `BadRequestError` |
|
296
|
+
|`InvalidFilterFieldError`| `BadRequestError` |
|
297
|
+
|`InvalidFilterParamError`| `BadRequestError` |
|
298
|
+
|`InvalidFilterParamValueError`| `BadRequestError` |
|
299
|
+
|`InvalidInputEncodingError`| `BadRequestError` |
|
300
|
+
|`InvalidInterfaceError`| `BadRequestError` |
|
301
|
+
|`InvalidOauthProviderError`| `BadRequestError` |
|
302
|
+
|`InvalidPathError`| `BadRequestError` |
|
303
|
+
|`InvalidReturnToUrlError`| `BadRequestError` |
|
304
|
+
|`InvalidUploadOffsetError`| `BadRequestError` |
|
305
|
+
|`InvalidUploadPartGapError`| `BadRequestError` |
|
306
|
+
|`InvalidUploadPartSizeError`| `BadRequestError` |
|
307
|
+
|`MethodNotAllowedError`| `BadRequestError` |
|
308
|
+
|`NoValidInputParamsError`| `BadRequestError` |
|
309
|
+
|`PartNumberTooLargeError`| `BadRequestError` |
|
310
|
+
|`PathCannotHaveTrailingWhitespaceError`| `BadRequestError` |
|
311
|
+
|`ReauthenticationNeededFieldsError`| `BadRequestError` |
|
312
|
+
|`RequestParamsContainInvalidCharacterError`| `BadRequestError` |
|
313
|
+
|`RequestParamsInvalidError`| `BadRequestError` |
|
314
|
+
|`RequestParamsRequiredError`| `BadRequestError` |
|
315
|
+
|`SearchAllOnChildPathError`| `BadRequestError` |
|
316
|
+
|`UnsupportedCurrencyError`| `BadRequestError` |
|
317
|
+
|`UnsupportedHttpResponseFormatError`| `BadRequestError` |
|
318
|
+
|`UnsupportedMediaTypeError`| `BadRequestError` |
|
319
|
+
|`UserIdInvalidError`| `BadRequestError` |
|
320
|
+
|`UserIdOnUserEndpointError`| `BadRequestError` |
|
321
|
+
|`UserRequiredError`| `BadRequestError` |
|
322
|
+
|`AdditionalAuthenticationRequiredError`| `NotAuthenticatedError` |
|
323
|
+
|`AuthenticationRequiredError`| `NotAuthenticatedError` |
|
324
|
+
|`BundleRegistrationCodeFailedError`| `NotAuthenticatedError` |
|
325
|
+
|`FilesAgentTokenFailedError`| `NotAuthenticatedError` |
|
326
|
+
|`InboxRegistrationCodeFailedError`| `NotAuthenticatedError` |
|
327
|
+
|`InvalidCredentialsError`| `NotAuthenticatedError` |
|
328
|
+
|`InvalidOauthError`| `NotAuthenticatedError` |
|
329
|
+
|`InvalidOrExpiredCodeError`| `NotAuthenticatedError` |
|
330
|
+
|`InvalidSessionError`| `NotAuthenticatedError` |
|
331
|
+
|`InvalidUsernameOrPasswordError`| `NotAuthenticatedError` |
|
332
|
+
|`LockedOutError`| `NotAuthenticatedError` |
|
333
|
+
|`LockoutRegionMismatchError`| `NotAuthenticatedError` |
|
334
|
+
|`OneTimePasswordIncorrectError`| `NotAuthenticatedError` |
|
335
|
+
|`TwoFactorAuthenticationErrorError`| `NotAuthenticatedError` |
|
336
|
+
|`TwoFactorAuthenticationSetupExpiredError`| `NotAuthenticatedError` |
|
337
|
+
|`ApiKeyIsDisabledError`| `NotAuthorizedError` |
|
338
|
+
|`ApiKeyIsPathRestrictedError`| `NotAuthorizedError` |
|
339
|
+
|`ApiKeyOnlyForDesktopAppError`| `NotAuthorizedError` |
|
340
|
+
|`ApiKeyOnlyForMobileAppError`| `NotAuthorizedError` |
|
341
|
+
|`ApiKeyOnlyForOfficeIntegrationError`| `NotAuthorizedError` |
|
342
|
+
|`BillingPermissionRequiredError`| `NotAuthorizedError` |
|
343
|
+
|`BundleMaximumUsesReachedError`| `NotAuthorizedError` |
|
344
|
+
|`CannotLoginWhileUsingKeyError`| `NotAuthorizedError` |
|
345
|
+
|`CantActForOtherUserError`| `NotAuthorizedError` |
|
346
|
+
|`ContactAdminForPasswordChangeHelpError`| `NotAuthorizedError` |
|
347
|
+
|`FilesAgentFailedAuthorizationError`| `NotAuthorizedError` |
|
348
|
+
|`FolderAdminOrBillingPermissionRequiredError`| `NotAuthorizedError` |
|
349
|
+
|`FolderAdminPermissionRequiredError`| `NotAuthorizedError` |
|
350
|
+
|`FullPermissionRequiredError`| `NotAuthorizedError` |
|
351
|
+
|`HistoryPermissionRequiredError`| `NotAuthorizedError` |
|
352
|
+
|`InsufficientPermissionForParamsError`| `NotAuthorizedError` |
|
353
|
+
|`InsufficientPermissionForSiteError`| `NotAuthorizedError` |
|
354
|
+
|`MustAuthenticateWithApiKeyError`| `NotAuthorizedError` |
|
355
|
+
|`NeedAdminPermissionForInboxError`| `NotAuthorizedError` |
|
356
|
+
|`NonAdminsMustQueryByFolderOrPathError`| `NotAuthorizedError` |
|
357
|
+
|`NotAllowedToCreateBundleError`| `NotAuthorizedError` |
|
358
|
+
|`PasswordChangeNotRequiredError`| `NotAuthorizedError` |
|
359
|
+
|`PasswordChangeRequiredError`| `NotAuthorizedError` |
|
360
|
+
|`ReadOnlySessionError`| `NotAuthorizedError` |
|
361
|
+
|`ReadPermissionRequiredError`| `NotAuthorizedError` |
|
362
|
+
|`ReauthenticationFailedError`| `NotAuthorizedError` |
|
363
|
+
|`ReauthenticationFailedFinalError`| `NotAuthorizedError` |
|
364
|
+
|`ReauthenticationNeededActionError`| `NotAuthorizedError` |
|
365
|
+
|`RecaptchaFailedError`| `NotAuthorizedError` |
|
366
|
+
|`SelfManagedRequiredError`| `NotAuthorizedError` |
|
367
|
+
|`SiteAdminRequiredError`| `NotAuthorizedError` |
|
368
|
+
|`SiteFilesAreImmutableError`| `NotAuthorizedError` |
|
369
|
+
|`TwoFactorAuthenticationRequiredError`| `NotAuthorizedError` |
|
370
|
+
|`UserIdWithoutSiteAdminError`| `NotAuthorizedError` |
|
371
|
+
|`WriteAndBundlePermissionRequiredError`| `NotAuthorizedError` |
|
372
|
+
|`WritePermissionRequiredError`| `NotAuthorizedError` |
|
373
|
+
|`ZipDownloadIpMismatchError`| `NotAuthorizedError` |
|
374
|
+
|`ApiKeyNotFoundError`| `NotFoundError` |
|
375
|
+
|`BundlePathNotFoundError`| `NotFoundError` |
|
376
|
+
|`BundleRegistrationNotFoundError`| `NotFoundError` |
|
377
|
+
|`CodeNotFoundError`| `NotFoundError` |
|
378
|
+
|`FileNotFoundError`| `NotFoundError` |
|
379
|
+
|`FileUploadNotFoundError`| `NotFoundError` |
|
380
|
+
|`FolderNotFoundError`| `NotFoundError` |
|
381
|
+
|`GroupNotFoundError`| `NotFoundError` |
|
382
|
+
|`InboxNotFoundError`| `NotFoundError` |
|
383
|
+
|`NestedNotFoundError`| `NotFoundError` |
|
384
|
+
|`PlanNotFoundError`| `NotFoundError` |
|
385
|
+
|`SiteNotFoundError`| `NotFoundError` |
|
386
|
+
|`UserNotFoundError`| `NotFoundError` |
|
387
|
+
|`AlreadyCompletedError`| `ProcessingFailureError` |
|
388
|
+
|`AutomationCannotBeRunManuallyError`| `ProcessingFailureError` |
|
389
|
+
|`BehaviorNotAllowedOnRemoteServerError`| `ProcessingFailureError` |
|
390
|
+
|`BundleOnlyAllowsPreviewsError`| `ProcessingFailureError` |
|
391
|
+
|`BundleOperationRequiresSubfolderError`| `ProcessingFailureError` |
|
392
|
+
|`CouldNotCreateParentError`| `ProcessingFailureError` |
|
393
|
+
|`DestinationExistsError`| `ProcessingFailureError` |
|
394
|
+
|`DestinationFolderLimitedError`| `ProcessingFailureError` |
|
395
|
+
|`DestinationParentConflictError`| `ProcessingFailureError` |
|
396
|
+
|`DestinationParentDoesNotExistError`| `ProcessingFailureError` |
|
397
|
+
|`ExpiredPrivateKeyError`| `ProcessingFailureError` |
|
398
|
+
|`ExpiredPublicKeyError`| `ProcessingFailureError` |
|
399
|
+
|`ExportFailureError`| `ProcessingFailureError` |
|
400
|
+
|`ExportNotReadyError`| `ProcessingFailureError` |
|
401
|
+
|`FailedToChangePasswordError`| `ProcessingFailureError` |
|
402
|
+
|`FileLockedError`| `ProcessingFailureError` |
|
403
|
+
|`FileNotUploadedError`| `ProcessingFailureError` |
|
404
|
+
|`FilePendingProcessingError`| `ProcessingFailureError` |
|
405
|
+
|`FileProcessingErrorError`| `ProcessingFailureError` |
|
406
|
+
|`FileTooBigToDecryptError`| `ProcessingFailureError` |
|
407
|
+
|`FileTooBigToEncryptError`| `ProcessingFailureError` |
|
408
|
+
|`FileUploadedToWrongRegionError`| `ProcessingFailureError` |
|
409
|
+
|`FilenameTooLongError`| `ProcessingFailureError` |
|
410
|
+
|`FolderLockedError`| `ProcessingFailureError` |
|
411
|
+
|`FolderNotEmptyError`| `ProcessingFailureError` |
|
412
|
+
|`HistoryUnavailableError`| `ProcessingFailureError` |
|
413
|
+
|`InvalidBundleCodeError`| `ProcessingFailureError` |
|
414
|
+
|`InvalidFileTypeError`| `ProcessingFailureError` |
|
415
|
+
|`InvalidFilenameError`| `ProcessingFailureError` |
|
416
|
+
|`InvalidPriorityColorError`| `ProcessingFailureError` |
|
417
|
+
|`InvalidRangeError`| `ProcessingFailureError` |
|
418
|
+
|`ModelSaveErrorError`| `ProcessingFailureError` |
|
419
|
+
|`MultipleProcessingErrorsError`| `ProcessingFailureError` |
|
420
|
+
|`PathTooLongError`| `ProcessingFailureError` |
|
421
|
+
|`RecipientAlreadySharedError`| `ProcessingFailureError` |
|
422
|
+
|`RemoteServerErrorError`| `ProcessingFailureError` |
|
423
|
+
|`ResourceLockedError`| `ProcessingFailureError` |
|
424
|
+
|`SubfolderLockedError`| `ProcessingFailureError` |
|
425
|
+
|`TwoFactorAuthenticationCodeAlreadySentError`| `ProcessingFailureError` |
|
426
|
+
|`TwoFactorAuthenticationCountryBlacklistedError`| `ProcessingFailureError` |
|
427
|
+
|`TwoFactorAuthenticationGeneralErrorError`| `ProcessingFailureError` |
|
428
|
+
|`TwoFactorAuthenticationUnsubscribedRecipientError`| `ProcessingFailureError` |
|
429
|
+
|`UpdatesNotAllowedForRemotesError`| `ProcessingFailureError` |
|
430
|
+
|`DuplicateShareRecipientError`| `RateLimitedError` |
|
431
|
+
|`ReauthenticationRateLimitedError`| `RateLimitedError` |
|
432
|
+
|`TooManyConcurrentLoginsError`| `RateLimitedError` |
|
433
|
+
|`TooManyConcurrentRequestsError`| `RateLimitedError` |
|
434
|
+
|`TooManyLoginAttemptsError`| `RateLimitedError` |
|
435
|
+
|`TooManyRequestsError`| `RateLimitedError` |
|
436
|
+
|`TooManySharesError`| `RateLimitedError` |
|
437
|
+
|`AgentUnavailableError`| `ServiceUnavailableError` |
|
438
|
+
|`AutomationsUnavailableError`| `ServiceUnavailableError` |
|
439
|
+
|`MigrationInProgressError`| `ServiceUnavailableError` |
|
440
|
+
|`SiteDisabledError`| `ServiceUnavailableError` |
|
441
|
+
|`UploadsUnavailableError`| `ServiceUnavailableError` |
|
442
|
+
|`AccountAlreadyExistsError`| `SiteConfigurationError` |
|
443
|
+
|`AccountOverdueError`| `SiteConfigurationError` |
|
444
|
+
|`NoAccountForSiteError`| `SiteConfigurationError` |
|
445
|
+
|`SiteWasRemovedError`| `SiteConfigurationError` |
|
446
|
+
|`TrialExpiredError`| `SiteConfigurationError` |
|
447
|
+
|`TrialLockedError`| `SiteConfigurationError` |
|
448
|
+
|`UserRequestsEnabledRequiredError`| `SiteConfigurationError` |
|
449
|
+
|
450
|
+
## Examples
|
451
|
+
|
452
|
+
### File Operations
|
453
|
+
|
454
|
+
The Files::File and Files::Dir models implement the standard Ruby API
|
455
|
+
for File and Dir, respectively. (Note that the Files.com SDK uses the
|
456
|
+
word Folder, not Dir, and Files::Dir is simply an alias for
|
457
|
+
Files::Folder).
|
458
|
+
|
459
|
+
#### List root folder
|
460
|
+
|
461
|
+
```ruby
|
462
|
+
Files::Folder.list_for("/").each do |file|
|
463
|
+
puts file.path
|
464
|
+
end
|
465
|
+
```
|
466
|
+
|
467
|
+
#### Writing a file
|
468
|
+
|
469
|
+
```ruby
|
470
|
+
Files::upload_file("local.txt", "/remote.txt")
|
471
|
+
|
472
|
+
File.open("local.txt") do |local_file|
|
473
|
+
Files::File.open("remote.txt", "w") do |remote_file|
|
474
|
+
remote_file.write(local_file.read)
|
475
|
+
end
|
476
|
+
end
|
477
|
+
```
|
478
|
+
|
479
|
+
#### Reading a file
|
480
|
+
|
481
|
+
```ruby
|
482
|
+
Files::File.find("foo.txt").read
|
483
|
+
```
|
484
|
+
|
485
|
+
## Mock Server
|
486
|
+
|
487
|
+
Files.com publishes a Files.com API server, which is useful for testing your use of the Files.com
|
488
|
+
SDKs and other direct integrations against the Files.com API in an integration test environment.
|
489
|
+
|
490
|
+
It is a Ruby app that operates as a minimal server for the purpose of testing basic network
|
491
|
+
operations and JSON encoding for your SDK or API client. It does not maintain state and it does not
|
492
|
+
deeply inspect your submissions for correctness.
|
493
|
+
|
494
|
+
Eventually we will add more features intended for integration testing, such as the ability to
|
495
|
+
intentionally provoke errors.
|
496
|
+
|
497
|
+
Download the server as a Docker image via [Docker Hub](https://hub.docker.com/r/filescom/files-mock-server).
|
498
|
+
|
499
|
+
The Source Code is also available on [GitHub](https://github.com/Files-com/files-mock-server).
|
500
|
+
|
501
|
+
A README is available on the GitHub link.
|
data/_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.111
|
data/lib/files.com/version.rb
CHANGED