files.com 1.0.132 → 1.0.137
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/_VERSION +1 -1
- data/docs/bundle_recipient.md +30 -0
- data/docs/inbox_recipient.md +76 -0
- data/docs/status.md +6 -2
- data/lib/files.com.rb +1 -0
- data/lib/files.com/api_client.rb +6 -10
- data/lib/files.com/errors.rb +156 -9
- data/lib/files.com/models/bundle_recipient.rb +78 -0
- data/lib/files.com/models/inbox_recipient.rb +150 -0
- data/lib/files.com/models/status.rb +11 -1
- data/lib/files.com/uri.rb +5 -11
- data/spec/uri_spec.rb +5 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4651a8c9e40410069aefe8b9660b1d6111d94ec4b096180d2d129a673f399e2f
|
4
|
+
data.tar.gz: 45c8fc31918f48e3b6e33339cd30aeef577b1d57b24b285da2c6057da23d4859
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 569b5ec090de98ca588f13ce988bec47ef1372b2da0eedcf4debcaf446b47a57b6fda2fe6f3f0a4124215d1c1a369178029b0f901fbb7d17edd80135e843fba3
|
7
|
+
data.tar.gz: 0045eb7f270dfa3270204a5986f5ebf249d95c5eb414028a8990d41a1aeacea9fb6fab852b2c827614bc51d1d2fe48a98adc874c59b9857097ee21959a403ff1
|
data/_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.137
|
data/docs/bundle_recipient.md
CHANGED
@@ -17,6 +17,9 @@
|
|
17
17
|
* `note` (string): A note sent to the recipient with the bundle.
|
18
18
|
* `recipient` (string): The recipient's email address.
|
19
19
|
* `sent_at` (date-time): When the Bundle was shared with this recipient.
|
20
|
+
* `user_id` (int64): User ID. Provide a value of `0` to operate the current session's user.
|
21
|
+
* `bundle_id` (int64): Bundle to share.
|
22
|
+
* `share_after_create` (boolean): Set to true to share the link with the recipient upon creation.
|
20
23
|
|
21
24
|
|
22
25
|
---
|
@@ -44,3 +47,30 @@ Files::BundleRecipient.list(
|
|
44
47
|
* `filter_lt` (object): If set, return records where the specifiied field is less than the supplied value. Valid fields are `has_registrations`.
|
45
48
|
* `filter_lteq` (object): If set, return records where the specifiied field is less than or equal to the supplied value. Valid fields are `has_registrations`.
|
46
49
|
* `bundle_id` (int64): Required - List recipients for the bundle with this ID.
|
50
|
+
|
51
|
+
|
52
|
+
---
|
53
|
+
|
54
|
+
## Create Bundle Recipient
|
55
|
+
|
56
|
+
```
|
57
|
+
Files::BundleRecipient.create(
|
58
|
+
user_id: 1,
|
59
|
+
bundle_id: 1,
|
60
|
+
recipient: "johndoe@gmail.com",
|
61
|
+
name: "John Smith",
|
62
|
+
company: "Acme Ltd",
|
63
|
+
note: "Just a note.",
|
64
|
+
share_after_create: true
|
65
|
+
)
|
66
|
+
```
|
67
|
+
|
68
|
+
### Parameters
|
69
|
+
|
70
|
+
* `user_id` (int64): User ID. Provide a value of `0` to operate the current session's user.
|
71
|
+
* `bundle_id` (int64): Required - Bundle to share.
|
72
|
+
* `recipient` (string): Required - Email addresses to share this bundle with.
|
73
|
+
* `name` (string): Name of recipient.
|
74
|
+
* `company` (string): Company of recipient.
|
75
|
+
* `note` (string): Note to include in email.
|
76
|
+
* `share_after_create` (boolean): Set to true to share the link with the recipient upon creation.
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# InboxRecipient
|
2
|
+
|
3
|
+
## Example InboxRecipient Object
|
4
|
+
|
5
|
+
```
|
6
|
+
{
|
7
|
+
"company": "Acme Inc.",
|
8
|
+
"name": "John Doe",
|
9
|
+
"note": "Some note.",
|
10
|
+
"recipient": "john.doe@example.com",
|
11
|
+
"sent_at": "2000-01-01T01:00:00Z"
|
12
|
+
}
|
13
|
+
```
|
14
|
+
|
15
|
+
* `company` (string): The recipient's company.
|
16
|
+
* `name` (string): The recipient's name.
|
17
|
+
* `note` (string): A note sent to the recipient with the inbox.
|
18
|
+
* `recipient` (string): The recipient's email address.
|
19
|
+
* `sent_at` (date-time): When the Inbox was shared with this recipient.
|
20
|
+
* `user_id` (int64): User ID. Provide a value of `0` to operate the current session's user.
|
21
|
+
* `inbox_id` (int64): Inbox to share.
|
22
|
+
* `share_after_create` (boolean): Set to true to share the link with the recipient upon creation.
|
23
|
+
|
24
|
+
|
25
|
+
---
|
26
|
+
|
27
|
+
## List Inbox Recipients
|
28
|
+
|
29
|
+
```
|
30
|
+
Files::InboxRecipient.list(
|
31
|
+
user_id: 1,
|
32
|
+
per_page: 1,
|
33
|
+
inbox_id: 1
|
34
|
+
)
|
35
|
+
```
|
36
|
+
|
37
|
+
### Parameters
|
38
|
+
|
39
|
+
* `user_id` (int64): User ID. Provide a value of `0` to operate the current session's user.
|
40
|
+
* `cursor` (string): Used for pagination. Send a cursor value 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.
|
41
|
+
* `per_page` (int64): Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
42
|
+
* `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 `has_registrations`.
|
43
|
+
* `filter` (object): If set, return records where the specifiied field is equal to the supplied value. Valid fields are `has_registrations`.
|
44
|
+
* `filter_gt` (object): If set, return records where the specifiied field is greater than the supplied value. Valid fields are `has_registrations`.
|
45
|
+
* `filter_gteq` (object): If set, return records where the specifiied field is greater than or equal to the supplied value. Valid fields are `has_registrations`.
|
46
|
+
* `filter_like` (object): If set, return records where the specifiied field is equal to the supplied value. Valid fields are `has_registrations`.
|
47
|
+
* `filter_lt` (object): If set, return records where the specifiied field is less than the supplied value. Valid fields are `has_registrations`.
|
48
|
+
* `filter_lteq` (object): If set, return records where the specifiied field is less than or equal to the supplied value. Valid fields are `has_registrations`.
|
49
|
+
* `inbox_id` (int64): Required - List recipients for the inbox with this ID.
|
50
|
+
|
51
|
+
|
52
|
+
---
|
53
|
+
|
54
|
+
## Create Inbox Recipient
|
55
|
+
|
56
|
+
```
|
57
|
+
Files::InboxRecipient.create(
|
58
|
+
user_id: 1,
|
59
|
+
inbox_id: 1,
|
60
|
+
recipient: "johndoe@gmail.com",
|
61
|
+
name: "John Smith",
|
62
|
+
company: "Acme Ltd",
|
63
|
+
note: "Just a note.",
|
64
|
+
share_after_create: true
|
65
|
+
)
|
66
|
+
```
|
67
|
+
|
68
|
+
### Parameters
|
69
|
+
|
70
|
+
* `user_id` (int64): User ID. Provide a value of `0` to operate the current session's user.
|
71
|
+
* `inbox_id` (int64): Required - Inbox to share.
|
72
|
+
* `recipient` (string): Required - Email addresses to share this inbox with.
|
73
|
+
* `name` (string): Name of recipient.
|
74
|
+
* `company` (string): Company of recipient.
|
75
|
+
* `note` (string): Note to include in email.
|
76
|
+
* `share_after_create` (boolean): Set to true to share the link with the recipient upon creation.
|
data/docs/status.md
CHANGED
@@ -17,12 +17,16 @@
|
|
17
17
|
|
18
18
|
]
|
19
19
|
}
|
20
|
-
]
|
20
|
+
],
|
21
|
+
"clickwrap_id": 1,
|
22
|
+
"clickwrap_body": ""
|
21
23
|
}
|
22
24
|
```
|
23
25
|
|
24
|
-
* `code` (int64): Status
|
26
|
+
* `code` (int64): Status HTTP code
|
25
27
|
* `message` (string): Error message
|
26
28
|
* `status` (string): Status message
|
27
29
|
* `data`: Additional data
|
28
30
|
* `errors` (array): A list of api errors
|
31
|
+
* `clickwrap_id` (int64): Required Clickwrap id
|
32
|
+
* `clickwrap_body` (string): Required Clickwrap body
|
data/lib/files.com.rb
CHANGED
@@ -58,6 +58,7 @@ require "files.com/models/history"
|
|
58
58
|
require "files.com/models/history_export"
|
59
59
|
require "files.com/models/history_export_result"
|
60
60
|
require "files.com/models/image"
|
61
|
+
require "files.com/models/inbox_recipient"
|
61
62
|
require "files.com/models/inbox_registration"
|
62
63
|
require "files.com/models/inbox_upload"
|
63
64
|
require "files.com/models/invoice"
|
data/lib/files.com/api_client.rb
CHANGED
@@ -277,16 +277,12 @@ module Files
|
|
277
277
|
code: error_data[:code] || resp.http_status,
|
278
278
|
}
|
279
279
|
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
PermissionError.new(error_data[:message], opts)
|
287
|
-
when 429
|
288
|
-
RateLimitError.new(error_data[:message], opts)
|
289
|
-
else
|
280
|
+
return APIError.new(error_data[:message], opts) unless resp&.data&.dig(:type)
|
281
|
+
|
282
|
+
begin
|
283
|
+
error_class = Files.const_get(resp.data[:type].split("/").map { |piece| piece.split("-").map(&:capitalize).join('') + 'Error' }.join("::"))
|
284
|
+
error_class.new(error_data[:message], opts)
|
285
|
+
rescue NameError
|
290
286
|
APIError.new(error_data[:message], opts)
|
291
287
|
end
|
292
288
|
end
|
data/lib/files.com/errors.rb
CHANGED
@@ -26,16 +26,163 @@ module Files
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
class
|
29
|
+
class APIConnectionError < Error; end
|
30
30
|
class AuthenticationError < Error; end
|
31
|
-
class
|
32
|
-
class
|
31
|
+
class InvalidParameterError < Error; end
|
32
|
+
class MissingParameterError < Error; end
|
33
33
|
class NotImplementedError < Error; end
|
34
|
-
class PermissionError < Error; end
|
35
|
-
class RateLimitError < Error; end
|
36
|
-
class TooManyRequestsError < Error; end
|
37
|
-
class ValidationError < Error; end
|
38
34
|
|
39
|
-
class
|
40
|
-
|
35
|
+
class APIError < Error
|
36
|
+
attr_reader :detail
|
37
|
+
attr_reader :error
|
38
|
+
attr_reader :errors
|
39
|
+
attr_reader :http_code
|
40
|
+
attr_reader :instance
|
41
|
+
attr_reader :model_errors
|
42
|
+
attr_reader :title
|
43
|
+
attr_reader :type
|
44
|
+
|
45
|
+
def initialize(message = nil, **kwargs)
|
46
|
+
@detail = kwargs.dig(:json_body, 'detail')
|
47
|
+
@error = kwargs.dig(:json_body, 'error')
|
48
|
+
@errors = kwargs.dig(:json_body, 'errors')
|
49
|
+
@http_code = kwargs.dig(:json_body, 'http-code')
|
50
|
+
@instance = kwargs.dig(:json_body, 'instance')
|
51
|
+
@model_errors = kwargs.dig(:json_body, 'model_errors')
|
52
|
+
@title = kwargs.dig(:json_body, 'title')
|
53
|
+
@type = kwargs.dig(:json_body, 'type')
|
54
|
+
|
55
|
+
super(message, **kwargs)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
class ProcessingPendingError < APIError; end
|
60
|
+
|
61
|
+
class AccountInBadStandingError < APIError; end
|
62
|
+
class AccountOverdueError < AccountInBadStandingError; end
|
63
|
+
|
64
|
+
class BadRequestError < APIError; end
|
65
|
+
class AttachmentTooLargeError < BadRequestError; end
|
66
|
+
class CannotDownloadDirectoryError < BadRequestError; end
|
67
|
+
class CantMoveWithMultipleLocationsError < BadRequestError; end
|
68
|
+
class DatetimeParseError < BadRequestError; end
|
69
|
+
class DestinationSameError < BadRequestError; end
|
70
|
+
class FolderMustNotBeAFileError < BadRequestError; end
|
71
|
+
class InvalidFilterCombinationError < BadRequestError; end
|
72
|
+
class InvalidFilterFieldError < BadRequestError; end
|
73
|
+
class InvalidInputEncodingError < BadRequestError; end
|
74
|
+
class InvalidInterfaceError < BadRequestError; end
|
75
|
+
class InvalidOauthError < BadRequestError; end
|
76
|
+
class InvalidOauthProviderError < BadRequestError; end
|
77
|
+
class InvalidReturnToUrlError < BadRequestError; end
|
78
|
+
class InvalidUploadOffsetError < BadRequestError; end
|
79
|
+
class InvalidUsernameOrPasswordError < BadRequestError; end
|
80
|
+
class OperationOnNonScimResourceError < BadRequestError; end
|
81
|
+
class UnsupportedHttpResponseFormatError < BadRequestError; end
|
82
|
+
class UnsupportedMediaTypeError < BadRequestError; end
|
83
|
+
class UserIdInvalidError < BadRequestError; end
|
84
|
+
class UserIdOnUserEndpointError < BadRequestError; end
|
85
|
+
class UserRequiredError < BadRequestError; end
|
86
|
+
|
87
|
+
class InvalidParamsError < APIError; end
|
88
|
+
class InvalidCursorError < InvalidParamsError; end
|
89
|
+
class NoValidInputParamsError < InvalidParamsError; end
|
90
|
+
class ReauthenticationNeededFieldsError < InvalidParamsError; end
|
91
|
+
class RequestParamPathCannotHaveTrailingWhitespaceError < InvalidParamsError; end
|
92
|
+
class RequestParamsContainInvalidCharacterError < InvalidParamsError; end
|
93
|
+
class RequestParamsInvalidError < InvalidParamsError; end
|
94
|
+
class RequestParamsRequiredError < InvalidParamsError; end
|
95
|
+
class UnsupportedCurrencyError < InvalidParamsError; end
|
96
|
+
|
97
|
+
class LockedError < APIError; end
|
98
|
+
class FileLockedError < LockedError; end
|
99
|
+
class FolderLockedError < LockedError; end
|
100
|
+
class ResourceLockedError < LockedError; end
|
101
|
+
class SubfolderLockedError < LockedError; end
|
102
|
+
|
103
|
+
class NotAuthenticatedError < APIError; end
|
104
|
+
class OneTimePasswordIncorrectError < NotAuthenticatedError; end
|
105
|
+
class TwoFactorAuthenticationErrorError < NotAuthenticatedError; end
|
106
|
+
class TwoFactorAuthenticationRequiredError < NotAuthenticatedError; end
|
107
|
+
class TwoFactorAuthenticationSetupExpiredError < NotAuthenticatedError; end
|
108
|
+
|
109
|
+
class NotAuthorizedError < APIError; end
|
110
|
+
class ApiKeyIsDisabledError < NotAuthorizedError; end
|
111
|
+
class ApiKeyIsPathRestrictedError < NotAuthorizedError; end
|
112
|
+
class ApiKeyOnlyForDesktopAppError < NotAuthorizedError; end
|
113
|
+
class ApiKeyOnlyForOfficeIntegrationError < NotAuthorizedError; end
|
114
|
+
class AuthenticationRequiredError < NotAuthorizedError; end
|
115
|
+
class CannotLoginWhileUsingKeyError < NotAuthorizedError; end
|
116
|
+
class CantActForOtherUserError < NotAuthorizedError; end
|
117
|
+
class ContactAdminForPasswordChangeHelpError < NotAuthorizedError; end
|
118
|
+
class FolderAdminOrBillingPermissionError < NotAuthorizedError; end
|
119
|
+
class FolderAdminPermissionRequiredError < NotAuthorizedError; end
|
120
|
+
class HistoryExportNonAdminsMustQueryByFolderOrPathError < NotAuthorizedError; end
|
121
|
+
class HistoryPermissionRequiredError < NotAuthorizedError; end
|
122
|
+
class InsufficientPermissionForParamsError < NotAuthorizedError; end
|
123
|
+
class LockedOutError < NotAuthorizedError; end
|
124
|
+
class LockoutRegionMismatchError < NotAuthorizedError; end
|
125
|
+
class MustAuthenticateWithApiKeyError < NotAuthorizedError; end
|
126
|
+
class NeedAdminPermissionForInboxError < NotAuthorizedError; end
|
127
|
+
class NoBillingPermissionError < NotAuthorizedError; end
|
128
|
+
class NotAllowedToCreateBundleError < NotAuthorizedError; end
|
129
|
+
class PasswordChangeNotRequiredError < NotAuthorizedError; end
|
130
|
+
class PasswordChangeRequiredError < NotAuthorizedError; end
|
131
|
+
class ReadOnlySessionError < NotAuthorizedError; end
|
132
|
+
class ReadPermissionRequiredError < NotAuthorizedError; end
|
133
|
+
class ReauthenticationFailedError < NotAuthorizedError; end
|
134
|
+
class ReauthenticationFailedFinalError < NotAuthorizedError; end
|
135
|
+
class ReauthenticationNeededActionError < NotAuthorizedError; end
|
136
|
+
class SelfManagedRequiredError < NotAuthorizedError; end
|
137
|
+
class UnauthorizedError < NotAuthorizedError; end
|
138
|
+
class UserIdWithoutSiteAdminError < NotAuthorizedError; end
|
139
|
+
class WritePermissionRequiredError < NotAuthorizedError; end
|
140
|
+
class ZipDownloadIpMismatchError < NotAuthorizedError; end
|
141
|
+
|
142
|
+
class NotFoundError < APIError; end
|
143
|
+
class ApiKeyNotFoundError < NotFoundError; end
|
144
|
+
class BundlePathNotFoundError < NotFoundError; end
|
145
|
+
class CodeNotFoundError < NotFoundError; end
|
146
|
+
class FileNotFoundError < NotFoundError; end
|
147
|
+
class FileUploadNotFoundError < NotFoundError; end
|
148
|
+
class FolderNotFoundError < NotFoundError; end
|
149
|
+
class GroupNotFoundError < NotFoundError; end
|
150
|
+
class HistoryExportNotReadyError < NotFoundError; end
|
151
|
+
class InboxNotFoundError < NotFoundError; end
|
152
|
+
class NestedNotFoundError < NotFoundError; end
|
153
|
+
class PlanNotFoundError < NotFoundError; end
|
154
|
+
class SiteNotFoundError < NotFoundError; end
|
155
|
+
class UserNotFoundError < NotFoundError; end
|
156
|
+
|
157
|
+
class ProcessingFailureError < APIError; end
|
158
|
+
class BundleRegistrationCodeFailedError < ProcessingFailureError; end
|
159
|
+
class DestinationExistsError < ProcessingFailureError; end
|
160
|
+
class DestinationParentConflictError < ProcessingFailureError; end
|
161
|
+
class DestinationParentDoesNotExistError < ProcessingFailureError; end
|
162
|
+
class FailedToChangePasswordError < ProcessingFailureError; end
|
163
|
+
class FileNotUploadedError < ProcessingFailureError; end
|
164
|
+
class FolderNotEmptyError < ProcessingFailureError; end
|
165
|
+
class HistoryExportFailureError < ProcessingFailureError; end
|
166
|
+
class HistoryUnavailableError < ProcessingFailureError; end
|
167
|
+
class InboxRegistrationCodeFailedError < ProcessingFailureError; end
|
168
|
+
class InvalidBundleCodeError < ProcessingFailureError; end
|
169
|
+
class InvalidOrExpiredCodeError < ProcessingFailureError; end
|
170
|
+
class ModelSaveErrorError < ProcessingFailureError; end
|
171
|
+
class RemoteServerErrorError < ProcessingFailureError; end
|
172
|
+
class TwoFactorAuthenticationCodeAlreadySentError < ProcessingFailureError; end
|
173
|
+
class UnprocessableEntityError < ProcessingFailureError; end
|
174
|
+
|
175
|
+
class RateLimitedError < APIError; end
|
176
|
+
class ReauthenticationRateLimitedError < RateLimitedError; end
|
177
|
+
class TooManyLoginAttemptsError < RateLimitedError; end
|
178
|
+
class TooManyRequestsError < RateLimitedError; end
|
179
|
+
|
180
|
+
class SiteConfigurationError < APIError; end
|
181
|
+
class AccountAlreadyExistsError < SiteConfigurationError; end
|
182
|
+
class NoAccountForSiteError < SiteConfigurationError; end
|
183
|
+
class SiteAdminRequiredError < SiteConfigurationError; end
|
184
|
+
class SiteWasRemovedError < SiteConfigurationError; end
|
185
|
+
class TrialExpiredError < SiteConfigurationError; end
|
186
|
+
class TrialLockedError < SiteConfigurationError; end
|
187
|
+
class UserRequestsEnabledRequiredError < SiteConfigurationError; end
|
41
188
|
end
|
@@ -14,26 +14,82 @@ module Files
|
|
14
14
|
@attributes[:company]
|
15
15
|
end
|
16
16
|
|
17
|
+
def company=(value)
|
18
|
+
@attributes[:company] = value
|
19
|
+
end
|
20
|
+
|
17
21
|
# string - The recipient's name.
|
18
22
|
def name
|
19
23
|
@attributes[:name]
|
20
24
|
end
|
21
25
|
|
26
|
+
def name=(value)
|
27
|
+
@attributes[:name] = value
|
28
|
+
end
|
29
|
+
|
22
30
|
# string - A note sent to the recipient with the bundle.
|
23
31
|
def note
|
24
32
|
@attributes[:note]
|
25
33
|
end
|
26
34
|
|
35
|
+
def note=(value)
|
36
|
+
@attributes[:note] = value
|
37
|
+
end
|
38
|
+
|
27
39
|
# string - The recipient's email address.
|
28
40
|
def recipient
|
29
41
|
@attributes[:recipient]
|
30
42
|
end
|
31
43
|
|
44
|
+
def recipient=(value)
|
45
|
+
@attributes[:recipient] = value
|
46
|
+
end
|
47
|
+
|
32
48
|
# date-time - When the Bundle was shared with this recipient.
|
33
49
|
def sent_at
|
34
50
|
@attributes[:sent_at]
|
35
51
|
end
|
36
52
|
|
53
|
+
def sent_at=(value)
|
54
|
+
@attributes[:sent_at] = value
|
55
|
+
end
|
56
|
+
|
57
|
+
# int64 - User ID. Provide a value of `0` to operate the current session's user.
|
58
|
+
def user_id
|
59
|
+
@attributes[:user_id]
|
60
|
+
end
|
61
|
+
|
62
|
+
def user_id=(value)
|
63
|
+
@attributes[:user_id] = value
|
64
|
+
end
|
65
|
+
|
66
|
+
# int64 - Bundle to share.
|
67
|
+
def bundle_id
|
68
|
+
@attributes[:bundle_id]
|
69
|
+
end
|
70
|
+
|
71
|
+
def bundle_id=(value)
|
72
|
+
@attributes[:bundle_id] = value
|
73
|
+
end
|
74
|
+
|
75
|
+
# boolean - Set to true to share the link with the recipient upon creation.
|
76
|
+
def share_after_create
|
77
|
+
@attributes[:share_after_create]
|
78
|
+
end
|
79
|
+
|
80
|
+
def share_after_create=(value)
|
81
|
+
@attributes[:share_after_create] = value
|
82
|
+
end
|
83
|
+
|
84
|
+
def save
|
85
|
+
if @attributes[:id]
|
86
|
+
raise NotImplementedError.new("The BundleRecipient object doesn't support updates.")
|
87
|
+
else
|
88
|
+
new_obj = BundleRecipient.create(@attributes, @options)
|
89
|
+
@attributes = new_obj.attributes
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
37
93
|
# Parameters:
|
38
94
|
# user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
|
39
95
|
# cursor - string - Used for pagination. Send a cursor value 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.
|
@@ -68,5 +124,27 @@ module Files
|
|
68
124
|
def self.all(params = {}, options = {})
|
69
125
|
list(params, options)
|
70
126
|
end
|
127
|
+
|
128
|
+
# Parameters:
|
129
|
+
# user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
|
130
|
+
# bundle_id (required) - int64 - Bundle to share.
|
131
|
+
# recipient (required) - string - Email addresses to share this bundle with.
|
132
|
+
# name - string - Name of recipient.
|
133
|
+
# company - string - Company of recipient.
|
134
|
+
# note - string - Note to include in email.
|
135
|
+
# share_after_create - boolean - Set to true to share the link with the recipient upon creation.
|
136
|
+
def self.create(params = {}, options = {})
|
137
|
+
raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params.dig(:user_id) and !params.dig(:user_id).is_a?(Integer)
|
138
|
+
raise InvalidParameterError.new("Bad parameter: bundle_id must be an Integer") if params.dig(:bundle_id) and !params.dig(:bundle_id).is_a?(Integer)
|
139
|
+
raise InvalidParameterError.new("Bad parameter: recipient must be an String") if params.dig(:recipient) and !params.dig(:recipient).is_a?(String)
|
140
|
+
raise InvalidParameterError.new("Bad parameter: name must be an String") if params.dig(:name) and !params.dig(:name).is_a?(String)
|
141
|
+
raise InvalidParameterError.new("Bad parameter: company must be an String") if params.dig(:company) and !params.dig(:company).is_a?(String)
|
142
|
+
raise InvalidParameterError.new("Bad parameter: note must be an String") if params.dig(:note) and !params.dig(:note).is_a?(String)
|
143
|
+
raise MissingParameterError.new("Parameter missing: bundle_id") unless params.dig(:bundle_id)
|
144
|
+
raise MissingParameterError.new("Parameter missing: recipient") unless params.dig(:recipient)
|
145
|
+
|
146
|
+
response, options = Api.send_request("/bundle_recipients", :post, params, options)
|
147
|
+
BundleRecipient.new(response.data, options)
|
148
|
+
end
|
71
149
|
end
|
72
150
|
end
|
@@ -0,0 +1,150 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Files
|
4
|
+
class InboxRecipient
|
5
|
+
attr_reader :options, :attributes
|
6
|
+
|
7
|
+
def initialize(attributes = {}, options = {})
|
8
|
+
@attributes = attributes || {}
|
9
|
+
@options = options || {}
|
10
|
+
end
|
11
|
+
|
12
|
+
# string - The recipient's company.
|
13
|
+
def company
|
14
|
+
@attributes[:company]
|
15
|
+
end
|
16
|
+
|
17
|
+
def company=(value)
|
18
|
+
@attributes[:company] = value
|
19
|
+
end
|
20
|
+
|
21
|
+
# string - The recipient's name.
|
22
|
+
def name
|
23
|
+
@attributes[:name]
|
24
|
+
end
|
25
|
+
|
26
|
+
def name=(value)
|
27
|
+
@attributes[:name] = value
|
28
|
+
end
|
29
|
+
|
30
|
+
# string - A note sent to the recipient with the inbox.
|
31
|
+
def note
|
32
|
+
@attributes[:note]
|
33
|
+
end
|
34
|
+
|
35
|
+
def note=(value)
|
36
|
+
@attributes[:note] = value
|
37
|
+
end
|
38
|
+
|
39
|
+
# string - The recipient's email address.
|
40
|
+
def recipient
|
41
|
+
@attributes[:recipient]
|
42
|
+
end
|
43
|
+
|
44
|
+
def recipient=(value)
|
45
|
+
@attributes[:recipient] = value
|
46
|
+
end
|
47
|
+
|
48
|
+
# date-time - When the Inbox was shared with this recipient.
|
49
|
+
def sent_at
|
50
|
+
@attributes[:sent_at]
|
51
|
+
end
|
52
|
+
|
53
|
+
def sent_at=(value)
|
54
|
+
@attributes[:sent_at] = value
|
55
|
+
end
|
56
|
+
|
57
|
+
# int64 - User ID. Provide a value of `0` to operate the current session's user.
|
58
|
+
def user_id
|
59
|
+
@attributes[:user_id]
|
60
|
+
end
|
61
|
+
|
62
|
+
def user_id=(value)
|
63
|
+
@attributes[:user_id] = value
|
64
|
+
end
|
65
|
+
|
66
|
+
# int64 - Inbox to share.
|
67
|
+
def inbox_id
|
68
|
+
@attributes[:inbox_id]
|
69
|
+
end
|
70
|
+
|
71
|
+
def inbox_id=(value)
|
72
|
+
@attributes[:inbox_id] = value
|
73
|
+
end
|
74
|
+
|
75
|
+
# boolean - Set to true to share the link with the recipient upon creation.
|
76
|
+
def share_after_create
|
77
|
+
@attributes[:share_after_create]
|
78
|
+
end
|
79
|
+
|
80
|
+
def share_after_create=(value)
|
81
|
+
@attributes[:share_after_create] = value
|
82
|
+
end
|
83
|
+
|
84
|
+
def save
|
85
|
+
if @attributes[:id]
|
86
|
+
raise NotImplementedError.new("The InboxRecipient object doesn't support updates.")
|
87
|
+
else
|
88
|
+
new_obj = InboxRecipient.create(@attributes, @options)
|
89
|
+
@attributes = new_obj.attributes
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
# Parameters:
|
94
|
+
# user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
|
95
|
+
# cursor - string - Used for pagination. Send a cursor value 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.
|
96
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
97
|
+
# 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 `has_registrations`.
|
98
|
+
# filter - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `has_registrations`.
|
99
|
+
# filter_gt - object - If set, return records where the specifiied field is greater than the supplied value. Valid fields are `has_registrations`.
|
100
|
+
# filter_gteq - object - If set, return records where the specifiied field is greater than or equal to the supplied value. Valid fields are `has_registrations`.
|
101
|
+
# filter_like - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `has_registrations`.
|
102
|
+
# filter_lt - object - If set, return records where the specifiied field is less than the supplied value. Valid fields are `has_registrations`.
|
103
|
+
# filter_lteq - object - If set, return records where the specifiied field is less than or equal to the supplied value. Valid fields are `has_registrations`.
|
104
|
+
# inbox_id (required) - int64 - List recipients for the inbox with this ID.
|
105
|
+
def self.list(params = {}, options = {})
|
106
|
+
raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params.dig(:user_id) and !params.dig(:user_id).is_a?(Integer)
|
107
|
+
raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
|
108
|
+
raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
|
109
|
+
raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params.dig(:sort_by) and !params.dig(:sort_by).is_a?(Hash)
|
110
|
+
raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params.dig(:filter) and !params.dig(:filter).is_a?(Hash)
|
111
|
+
raise InvalidParameterError.new("Bad parameter: filter_gt must be an Hash") if params.dig(:filter_gt) and !params.dig(:filter_gt).is_a?(Hash)
|
112
|
+
raise InvalidParameterError.new("Bad parameter: filter_gteq must be an Hash") if params.dig(:filter_gteq) and !params.dig(:filter_gteq).is_a?(Hash)
|
113
|
+
raise InvalidParameterError.new("Bad parameter: filter_like must be an Hash") if params.dig(:filter_like) and !params.dig(:filter_like).is_a?(Hash)
|
114
|
+
raise InvalidParameterError.new("Bad parameter: filter_lt must be an Hash") if params.dig(:filter_lt) and !params.dig(:filter_lt).is_a?(Hash)
|
115
|
+
raise InvalidParameterError.new("Bad parameter: filter_lteq must be an Hash") if params.dig(:filter_lteq) and !params.dig(:filter_lteq).is_a?(Hash)
|
116
|
+
raise InvalidParameterError.new("Bad parameter: inbox_id must be an Integer") if params.dig(:inbox_id) and !params.dig(:inbox_id).is_a?(Integer)
|
117
|
+
raise MissingParameterError.new("Parameter missing: inbox_id") unless params.dig(:inbox_id)
|
118
|
+
|
119
|
+
List.new(InboxRecipient, params) do
|
120
|
+
Api.send_request("/inbox_recipients", :get, params, options)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def self.all(params = {}, options = {})
|
125
|
+
list(params, options)
|
126
|
+
end
|
127
|
+
|
128
|
+
# Parameters:
|
129
|
+
# user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
|
130
|
+
# inbox_id (required) - int64 - Inbox to share.
|
131
|
+
# recipient (required) - string - Email addresses to share this inbox with.
|
132
|
+
# name - string - Name of recipient.
|
133
|
+
# company - string - Company of recipient.
|
134
|
+
# note - string - Note to include in email.
|
135
|
+
# share_after_create - boolean - Set to true to share the link with the recipient upon creation.
|
136
|
+
def self.create(params = {}, options = {})
|
137
|
+
raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params.dig(:user_id) and !params.dig(:user_id).is_a?(Integer)
|
138
|
+
raise InvalidParameterError.new("Bad parameter: inbox_id must be an Integer") if params.dig(:inbox_id) and !params.dig(:inbox_id).is_a?(Integer)
|
139
|
+
raise InvalidParameterError.new("Bad parameter: recipient must be an String") if params.dig(:recipient) and !params.dig(:recipient).is_a?(String)
|
140
|
+
raise InvalidParameterError.new("Bad parameter: name must be an String") if params.dig(:name) and !params.dig(:name).is_a?(String)
|
141
|
+
raise InvalidParameterError.new("Bad parameter: company must be an String") if params.dig(:company) and !params.dig(:company).is_a?(String)
|
142
|
+
raise InvalidParameterError.new("Bad parameter: note must be an String") if params.dig(:note) and !params.dig(:note).is_a?(String)
|
143
|
+
raise MissingParameterError.new("Parameter missing: inbox_id") unless params.dig(:inbox_id)
|
144
|
+
raise MissingParameterError.new("Parameter missing: recipient") unless params.dig(:recipient)
|
145
|
+
|
146
|
+
response, options = Api.send_request("/inbox_recipients", :post, params, options)
|
147
|
+
InboxRecipient.new(response.data, options)
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
@@ -9,7 +9,7 @@ module Files
|
|
9
9
|
@options = options || {}
|
10
10
|
end
|
11
11
|
|
12
|
-
# int64 - Status
|
12
|
+
# int64 - Status HTTP code
|
13
13
|
def code
|
14
14
|
@attributes[:code]
|
15
15
|
end
|
@@ -33,5 +33,15 @@ module Files
|
|
33
33
|
def errors
|
34
34
|
@attributes[:errors]
|
35
35
|
end
|
36
|
+
|
37
|
+
# int64 - Required Clickwrap id
|
38
|
+
def clickwrap_id
|
39
|
+
@attributes[:clickwrap_id]
|
40
|
+
end
|
41
|
+
|
42
|
+
# string - Required Clickwrap body
|
43
|
+
def clickwrap_body
|
44
|
+
@attributes[:clickwrap_body]
|
45
|
+
end
|
36
46
|
end
|
37
47
|
end
|
data/lib/files.com/uri.rb
CHANGED
@@ -34,17 +34,11 @@ module Files
|
|
34
34
|
# here we need to, so switch to ASCII.
|
35
35
|
component = component.dup
|
36
36
|
component.force_encoding(Encoding::ASCII_8BIT)
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
character_class,
|
43
|
-
leave_encoded
|
44
|
-
)
|
45
|
-
rescue ArgumentError
|
46
|
-
encoded = encode_component(unencoded)
|
47
|
-
end
|
37
|
+
encoded = Addressable::URI.encode_component(
|
38
|
+
component,
|
39
|
+
character_class,
|
40
|
+
leave_encoded
|
41
|
+
)
|
48
42
|
encoded.force_encoding(Encoding::UTF_8)
|
49
43
|
encoded
|
50
44
|
end
|
data/spec/uri_spec.rb
CHANGED
@@ -2,10 +2,14 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
RSpec.describe Files::URI do
|
4
4
|
describe "normalized_path" do
|
5
|
-
it { expect(described_class.normalized_path("[[strange stuff]]#yes.text")).to eq("
|
5
|
+
it { expect(described_class.normalized_path("path/[[strange stuff]]#yes.text")).to eq("path/%5B%5Bstrange%20stuff%5D%5D%23yes.text") }
|
6
6
|
it { expect(Addressable::URI.unencode_component(described_class.normalized_path("[[strange stuff]]#yes.text"))).to eq("[[strange stuff]]#yes.text") }
|
7
7
|
|
8
8
|
it { expect(described_class.normalized_path("folder/AdÇe")).to eq("folder/AdC%CC%A7e") }
|
9
9
|
it { expect(Addressable::URI.unencode_component(described_class.normalized_path("AdÇe"))).to eq("AdÇe") }
|
10
|
+
|
11
|
+
it { expect(described_class.normalized_path("lorem%20ipsum.txt")).to eq("lorem%2520ipsum.txt") }
|
12
|
+
it { expect(described_class.normalized_path("lorem%ipsum.txt")).to eq("lorem%25ipsum.txt") }
|
13
|
+
it { expect(described_class.normalized_path("lorem ipsum.txt")).to eq("lorem%20ipsum.txt") }
|
10
14
|
end
|
11
15
|
end
|
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.137
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- files.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -117,6 +117,7 @@ files:
|
|
117
117
|
- docs/history_export.md
|
118
118
|
- docs/history_export_result.md
|
119
119
|
- docs/image.md
|
120
|
+
- docs/inbox_recipient.md
|
120
121
|
- docs/inbox_registration.md
|
121
122
|
- docs/inbox_upload.md
|
122
123
|
- docs/invoice.md
|
@@ -187,6 +188,7 @@ files:
|
|
187
188
|
- lib/files.com/models/history_export.rb
|
188
189
|
- lib/files.com/models/history_export_result.rb
|
189
190
|
- lib/files.com/models/image.rb
|
191
|
+
- lib/files.com/models/inbox_recipient.rb
|
190
192
|
- lib/files.com/models/inbox_registration.rb
|
191
193
|
- lib/files.com/models/inbox_upload.rb
|
192
194
|
- lib/files.com/models/invoice.rb
|