files.com 1.0.90
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 +7 -0
- data/CONTRIBUTORS +4 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +82 -0
- data/LICENSE +21 -0
- data/README.md +119 -0
- data/Rakefile +12 -0
- data/SECURITY.md +24 -0
- data/_VERSION +1 -0
- data/bin/files +8 -0
- data/bin/files-console +16 -0
- data/docs/account_line_item.md +41 -0
- data/docs/action.md +37 -0
- data/docs/api_key.md +202 -0
- data/docs/app.md +57 -0
- data/docs/as2_key.md +133 -0
- data/docs/auto.md +11 -0
- data/docs/automation.md +190 -0
- data/docs/behavior.md +208 -0
- data/docs/bundle.md +252 -0
- data/docs/bundle_download.md +35 -0
- data/docs/clickwrap.md +143 -0
- data/docs/dns_record.md +35 -0
- data/docs/errors.md +17 -0
- data/docs/file.md +204 -0
- data/docs/file_action.md +126 -0
- data/docs/file_comment.md +116 -0
- data/docs/file_comment_reaction.md +62 -0
- data/docs/file_part_upload.md +37 -0
- data/docs/file_utils.md +4 -0
- data/docs/folder.md +90 -0
- data/docs/group.md +153 -0
- data/docs/group_user.md +124 -0
- data/docs/history.md +171 -0
- data/docs/history_export.md +174 -0
- data/docs/image.md +13 -0
- data/docs/invoice.md +72 -0
- data/docs/invoice_line_item.md +27 -0
- data/docs/ip_address.md +55 -0
- data/docs/lock.md +98 -0
- data/docs/message.md +147 -0
- data/docs/message_comment.md +132 -0
- data/docs/message_comment_reaction.md +94 -0
- data/docs/message_reaction.md +94 -0
- data/docs/notification.md +177 -0
- data/docs/payment.md +72 -0
- data/docs/payment_line_item.md +19 -0
- data/docs/permission.md +95 -0
- data/docs/preview.md +19 -0
- data/docs/project.md +121 -0
- data/docs/public_ip_address.md +13 -0
- data/docs/public_key.md +133 -0
- data/docs/remote_server.md +356 -0
- data/docs/request.md +100 -0
- data/docs/session.md +78 -0
- data/docs/site.md +448 -0
- data/docs/sso_strategy.md +114 -0
- data/docs/status.md +21 -0
- data/docs/style.md +93 -0
- data/docs/usage_daily_snapshot.md +45 -0
- data/docs/usage_snapshot.md +53 -0
- data/docs/user.md +535 -0
- data/docs/user_cipher_use.md +41 -0
- data/docs/user_request.md +93 -0
- data/files.com.gemspec +22 -0
- data/lib/files.com.rb +184 -0
- data/lib/files.com/api.rb +38 -0
- data/lib/files.com/api_client.rb +340 -0
- data/lib/files.com/errors.rb +41 -0
- data/lib/files.com/list.rb +95 -0
- data/lib/files.com/models/account_line_item.rb +82 -0
- data/lib/files.com/models/action.rb +77 -0
- data/lib/files.com/models/api_key.rb +270 -0
- data/lib/files.com/models/app.rb +101 -0
- data/lib/files.com/models/as2_key.rb +179 -0
- data/lib/files.com/models/auto.rb +17 -0
- data/lib/files.com/models/automation.rb +304 -0
- data/lib/files.com/models/behavior.rb +266 -0
- data/lib/files.com/models/bundle.rb +371 -0
- data/lib/files.com/models/bundle_download.rb +49 -0
- data/lib/files.com/models/clickwrap.rb +197 -0
- data/lib/files.com/models/dir.rb +3 -0
- data/lib/files.com/models/dns_record.rb +51 -0
- data/lib/files.com/models/errors.rb +22 -0
- data/lib/files.com/models/file.rb +968 -0
- data/lib/files.com/models/file_action.rb +126 -0
- data/lib/files.com/models/file_comment.rb +146 -0
- data/lib/files.com/models/file_comment_reaction.rb +100 -0
- data/lib/files.com/models/file_part_upload.rb +82 -0
- data/lib/files.com/models/file_utils.rb +118 -0
- data/lib/files.com/models/folder.rb +357 -0
- data/lib/files.com/models/group.rb +208 -0
- data/lib/files.com/models/group_user.rb +171 -0
- data/lib/files.com/models/history.rb +228 -0
- data/lib/files.com/models/history_export.rb +353 -0
- data/lib/files.com/models/image.rb +22 -0
- data/lib/files.com/models/invoice.rb +117 -0
- data/lib/files.com/models/invoice_line_item.rb +57 -0
- data/lib/files.com/models/ip_address.rb +66 -0
- data/lib/files.com/models/lock.rb +173 -0
- data/lib/files.com/models/message.rb +201 -0
- data/lib/files.com/models/message_comment.rb +165 -0
- data/lib/files.com/models/message_comment_reaction.rb +128 -0
- data/lib/files.com/models/message_reaction.rb +128 -0
- data/lib/files.com/models/notification.rb +263 -0
- data/lib/files.com/models/payment.rb +117 -0
- data/lib/files.com/models/payment_line_item.rb +37 -0
- data/lib/files.com/models/permission.rb +172 -0
- data/lib/files.com/models/preview.rb +37 -0
- data/lib/files.com/models/project.rb +140 -0
- data/lib/files.com/models/public_ip_address.rb +22 -0
- data/lib/files.com/models/public_key.rb +179 -0
- data/lib/files.com/models/remote_server.rb +680 -0
- data/lib/files.com/models/request.rb +179 -0
- data/lib/files.com/models/session.rb +247 -0
- data/lib/files.com/models/site.rb +733 -0
- data/lib/files.com/models/sso_strategy.rb +227 -0
- data/lib/files.com/models/status.rb +37 -0
- data/lib/files.com/models/style.rb +131 -0
- data/lib/files.com/models/usage_daily_snapshot.rb +66 -0
- data/lib/files.com/models/usage_snapshot.rb +96 -0
- data/lib/files.com/models/user.rb +876 -0
- data/lib/files.com/models/user_cipher_use.rb +63 -0
- data/lib/files.com/models/user_request.rb +127 -0
- data/lib/files.com/response.rb +25 -0
- data/lib/files.com/sizable_io.rb +32 -0
- data/lib/files.com/system_profiler.rb +56 -0
- data/lib/files.com/util.rb +106 -0
- data/lib/files.com/version.rb +5 -0
- data/spec/list_spec.rb +214 -0
- data/spec/models/file_spec.rb +68 -0
- data/spec/models/folder_spec.rb +40 -0
- data/spec/spec_helper.rb +36 -0
- data/test.sh +8 -0
- data/test/test.rb +75 -0
- metadata +235 -0
@@ -0,0 +1,117 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Files
|
4
|
+
class Payment
|
5
|
+
attr_reader :options, :attributes
|
6
|
+
|
7
|
+
def initialize(attributes = {}, options = {})
|
8
|
+
@attributes = attributes || {}
|
9
|
+
@options = options || {}
|
10
|
+
end
|
11
|
+
|
12
|
+
# int64 - Line item Id
|
13
|
+
def id
|
14
|
+
@attributes[:id]
|
15
|
+
end
|
16
|
+
|
17
|
+
# double - Line item amount
|
18
|
+
def amount
|
19
|
+
@attributes[:amount]
|
20
|
+
end
|
21
|
+
|
22
|
+
# double - Line item balance
|
23
|
+
def balance
|
24
|
+
@attributes[:balance]
|
25
|
+
end
|
26
|
+
|
27
|
+
# date-time - Line item created at
|
28
|
+
def created_at
|
29
|
+
@attributes[:created_at]
|
30
|
+
end
|
31
|
+
|
32
|
+
# string - Line item currency
|
33
|
+
def currency
|
34
|
+
@attributes[:currency]
|
35
|
+
end
|
36
|
+
|
37
|
+
# string - Line item download uri
|
38
|
+
def download_uri
|
39
|
+
@attributes[:download_uri]
|
40
|
+
end
|
41
|
+
|
42
|
+
# array - Associated invoice line items
|
43
|
+
def invoice_line_items
|
44
|
+
@attributes[:invoice_line_items]
|
45
|
+
end
|
46
|
+
|
47
|
+
# string - Line item payment method
|
48
|
+
def method
|
49
|
+
@attributes[:method]
|
50
|
+
end
|
51
|
+
|
52
|
+
# array - Associated payment line items
|
53
|
+
def payment_line_items
|
54
|
+
@attributes[:payment_line_items]
|
55
|
+
end
|
56
|
+
|
57
|
+
# date-time - Date/time payment was reversed if applicable
|
58
|
+
def payment_reversed_at
|
59
|
+
@attributes[:payment_reversed_at]
|
60
|
+
end
|
61
|
+
|
62
|
+
# string - Type of payment if applicable
|
63
|
+
def payment_type
|
64
|
+
@attributes[:payment_type]
|
65
|
+
end
|
66
|
+
|
67
|
+
# string - Site name this line item is for
|
68
|
+
def site_name
|
69
|
+
@attributes[:site_name]
|
70
|
+
end
|
71
|
+
|
72
|
+
# string - Type of line item, either payment or invoice
|
73
|
+
def type
|
74
|
+
@attributes[:type]
|
75
|
+
end
|
76
|
+
|
77
|
+
# date-time - Line item updated at
|
78
|
+
def updated_at
|
79
|
+
@attributes[:updated_at]
|
80
|
+
end
|
81
|
+
|
82
|
+
# Parameters:
|
83
|
+
# page - int64 - Current page number.
|
84
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
85
|
+
# action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
|
86
|
+
def self.list(params = {}, options = {})
|
87
|
+
raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
|
88
|
+
raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
|
89
|
+
raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
|
90
|
+
|
91
|
+
response, options = Api.send_request("/payments", :get, params, options)
|
92
|
+
response.data.map do |entity_data|
|
93
|
+
AccountLineItem.new(entity_data, options)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def self.all(params = {}, options = {})
|
98
|
+
list(params, options)
|
99
|
+
end
|
100
|
+
|
101
|
+
# Parameters:
|
102
|
+
# id (required) - int64 - Payment ID.
|
103
|
+
def self.find(id, params = {}, options = {})
|
104
|
+
params ||= {}
|
105
|
+
params[:id] = id
|
106
|
+
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
|
107
|
+
raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
|
108
|
+
|
109
|
+
response, options = Api.send_request("/payments/#{params[:id]}", :get, params, options)
|
110
|
+
AccountLineItem.new(response.data, options)
|
111
|
+
end
|
112
|
+
|
113
|
+
def self.get(id, params = {}, options = {})
|
114
|
+
find(id, params, options)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Files
|
4
|
+
class PaymentLineItem
|
5
|
+
attr_reader :options, :attributes
|
6
|
+
|
7
|
+
def initialize(attributes = {}, options = {})
|
8
|
+
@attributes = attributes || {}
|
9
|
+
@options = options || {}
|
10
|
+
end
|
11
|
+
|
12
|
+
# double - Payment line item amount
|
13
|
+
def amount
|
14
|
+
@attributes[:amount]
|
15
|
+
end
|
16
|
+
|
17
|
+
# date-time - Payment line item created at date/time
|
18
|
+
def created_at
|
19
|
+
@attributes[:created_at]
|
20
|
+
end
|
21
|
+
|
22
|
+
# int64 - Invoice ID
|
23
|
+
def invoice_id
|
24
|
+
@attributes[:invoice_id]
|
25
|
+
end
|
26
|
+
|
27
|
+
# int64 - Payment ID
|
28
|
+
def payment_id
|
29
|
+
@attributes[:payment_id]
|
30
|
+
end
|
31
|
+
|
32
|
+
# date-time - Payment line item updated at date/time
|
33
|
+
def updated_at
|
34
|
+
@attributes[:updated_at]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,172 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Files
|
4
|
+
class Permission
|
5
|
+
attr_reader :options, :attributes
|
6
|
+
|
7
|
+
def initialize(attributes = {}, options = {})
|
8
|
+
@attributes = attributes || {}
|
9
|
+
@options = options || {}
|
10
|
+
end
|
11
|
+
|
12
|
+
# int64 - Permission ID
|
13
|
+
def id
|
14
|
+
@attributes[:id]
|
15
|
+
end
|
16
|
+
|
17
|
+
def id=(value)
|
18
|
+
@attributes[:id] = value
|
19
|
+
end
|
20
|
+
|
21
|
+
# string - Folder path This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
|
22
|
+
def path
|
23
|
+
@attributes[:path]
|
24
|
+
end
|
25
|
+
|
26
|
+
def path=(value)
|
27
|
+
@attributes[:path] = value
|
28
|
+
end
|
29
|
+
|
30
|
+
# int64 - User ID
|
31
|
+
def user_id
|
32
|
+
@attributes[:user_id]
|
33
|
+
end
|
34
|
+
|
35
|
+
def user_id=(value)
|
36
|
+
@attributes[:user_id] = value
|
37
|
+
end
|
38
|
+
|
39
|
+
# string - User's username
|
40
|
+
def username
|
41
|
+
@attributes[:username]
|
42
|
+
end
|
43
|
+
|
44
|
+
def username=(value)
|
45
|
+
@attributes[:username] = value
|
46
|
+
end
|
47
|
+
|
48
|
+
# int64 - Group ID
|
49
|
+
def group_id
|
50
|
+
@attributes[:group_id]
|
51
|
+
end
|
52
|
+
|
53
|
+
def group_id=(value)
|
54
|
+
@attributes[:group_id] = value
|
55
|
+
end
|
56
|
+
|
57
|
+
# string - Group name if applicable
|
58
|
+
def group_name
|
59
|
+
@attributes[:group_name]
|
60
|
+
end
|
61
|
+
|
62
|
+
def group_name=(value)
|
63
|
+
@attributes[:group_name] = value
|
64
|
+
end
|
65
|
+
|
66
|
+
# string - Permission type
|
67
|
+
def permission
|
68
|
+
@attributes[:permission]
|
69
|
+
end
|
70
|
+
|
71
|
+
def permission=(value)
|
72
|
+
@attributes[:permission] = value
|
73
|
+
end
|
74
|
+
|
75
|
+
# boolean - Does this permission apply to subfolders?
|
76
|
+
def recursive
|
77
|
+
@attributes[:recursive]
|
78
|
+
end
|
79
|
+
|
80
|
+
def recursive=(value)
|
81
|
+
@attributes[:recursive] = value
|
82
|
+
end
|
83
|
+
|
84
|
+
def save
|
85
|
+
if @attributes[:path]
|
86
|
+
raise NotImplementedError.new("The Permission object doesn't support updates.")
|
87
|
+
else
|
88
|
+
new_obj = Permission.create(@attributes, @options)
|
89
|
+
@attributes = new_obj.attributes
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
# Parameters:
|
94
|
+
# page - int64 - Current page number.
|
95
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
96
|
+
# action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
|
97
|
+
# 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.
|
98
|
+
# 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 `deleted_at`, `group_id`, `path`, `user_id` or `permission`.
|
99
|
+
# filter - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `group_id`, `user_id` or `path`.
|
100
|
+
# filter_gt - object - If set, return records where the specifiied field is greater than the supplied value. Valid fields are `group_id`, `user_id` or `path`.
|
101
|
+
# filter_gteq - object - If set, return records where the specifiied field is greater than or equal to the supplied value. Valid fields are `group_id`, `user_id` or `path`.
|
102
|
+
# filter_like - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `group_id`, `user_id` or `path`.
|
103
|
+
# filter_lt - object - If set, return records where the specifiied field is less than the supplied value. Valid fields are `group_id`, `user_id` or `path`.
|
104
|
+
# filter_lteq - object - If set, return records where the specifiied field is less than or equal to the supplied value. Valid fields are `group_id`, `user_id` or `path`.
|
105
|
+
# path - string - DEPRECATED: Permission path. If provided, will scope permissions to this path. Use `filter[path]` instead.
|
106
|
+
# group_id - string - DEPRECATED: Group ID. If provided, will scope permissions to this group. Use `filter[group_id]` instead.`
|
107
|
+
# user_id - string - DEPRECATED: User ID. If provided, will scope permissions to this user. Use `filter[user_id]` instead.`
|
108
|
+
# 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
|
112
|
+
raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
|
113
|
+
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
|
+
raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
|
115
|
+
raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
|
116
|
+
raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params.dig(:sort_by) and !params.dig(:sort_by).is_a?(Hash)
|
117
|
+
raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params.dig(:filter) and !params.dig(:filter).is_a?(Hash)
|
118
|
+
raise InvalidParameterError.new("Bad parameter: filter_gt must be an Hash") if params.dig(:filter_gt) and !params.dig(:filter_gt).is_a?(Hash)
|
119
|
+
raise InvalidParameterError.new("Bad parameter: filter_gteq must be an Hash") if params.dig(:filter_gteq) and !params.dig(:filter_gteq).is_a?(Hash)
|
120
|
+
raise InvalidParameterError.new("Bad parameter: filter_like must be an Hash") if params.dig(:filter_like) and !params.dig(:filter_like).is_a?(Hash)
|
121
|
+
raise InvalidParameterError.new("Bad parameter: filter_lt must be an Hash") if params.dig(:filter_lt) and !params.dig(:filter_lt).is_a?(Hash)
|
122
|
+
raise InvalidParameterError.new("Bad parameter: filter_lteq must be an Hash") if params.dig(:filter_lteq) and !params.dig(:filter_lteq).is_a?(Hash)
|
123
|
+
raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
|
124
|
+
raise InvalidParameterError.new("Bad parameter: group_id must be an String") if params.dig(:group_id) and !params.dig(:group_id).is_a?(String)
|
125
|
+
raise InvalidParameterError.new("Bad parameter: user_id must be an String") if params.dig(:user_id) and !params.dig(:user_id).is_a?(String)
|
126
|
+
|
127
|
+
List.new(Permission, params) do
|
128
|
+
Api.send_request("/permissions", :get, params, options)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
def self.all(path, params = {}, options = {})
|
133
|
+
list(path, params, options)
|
134
|
+
end
|
135
|
+
|
136
|
+
# Parameters:
|
137
|
+
# group_id - int64 - Group ID
|
138
|
+
# path - string - Folder path
|
139
|
+
# permission - string - Permission type. Can be `admin`, `full`, `readonly`, `writeonly`, `list`, or `history`
|
140
|
+
# recursive - boolean - Apply to subfolders recursively?
|
141
|
+
# user_id - int64 - User ID. Provide `username` or `user_id`
|
142
|
+
# username - string - User username. Provide `username` or `user_id`
|
143
|
+
def self.create(path, params = {}, options = {})
|
144
|
+
params ||= {}
|
145
|
+
params[:path] = path
|
146
|
+
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
|
+
raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
|
148
|
+
raise InvalidParameterError.new("Bad parameter: permission must be an String") if params.dig(:permission) and !params.dig(:permission).is_a?(String)
|
149
|
+
raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params.dig(:user_id) and !params.dig(:user_id).is_a?(Integer)
|
150
|
+
raise InvalidParameterError.new("Bad parameter: username must be an String") if params.dig(:username) and !params.dig(:username).is_a?(String)
|
151
|
+
|
152
|
+
response, options = Api.send_request("/permissions", :post, params, options)
|
153
|
+
Permission.new(response.data, options)
|
154
|
+
end
|
155
|
+
|
156
|
+
# Parameters:
|
157
|
+
# id (required) - int64 - Permission ID.
|
158
|
+
def self.delete(id, params = {}, options = {})
|
159
|
+
params ||= {}
|
160
|
+
params[:id] = id
|
161
|
+
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
|
162
|
+
raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
|
163
|
+
|
164
|
+
response, _options = Api.send_request("/permissions/#{params[:id]}", :delete, params, options)
|
165
|
+
response.data
|
166
|
+
end
|
167
|
+
|
168
|
+
def self.destroy(id, params = {}, options = {})
|
169
|
+
delete(id, params, options)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Files
|
4
|
+
class Preview
|
5
|
+
attr_reader :options, :attributes
|
6
|
+
|
7
|
+
def initialize(attributes = {}, options = {})
|
8
|
+
@attributes = attributes || {}
|
9
|
+
@options = options || {}
|
10
|
+
end
|
11
|
+
|
12
|
+
# int64 - Preview ID
|
13
|
+
def id
|
14
|
+
@attributes[:id]
|
15
|
+
end
|
16
|
+
|
17
|
+
# string - Preview status. Can be invalid, not_generated, generating, complete, or file_too_large
|
18
|
+
def status
|
19
|
+
@attributes[:status]
|
20
|
+
end
|
21
|
+
|
22
|
+
# string - Link to download preview
|
23
|
+
def download_uri
|
24
|
+
@attributes[:download_uri]
|
25
|
+
end
|
26
|
+
|
27
|
+
# string - Preview status. Can be invalid, not_generated, generating, complete, or file_too_large
|
28
|
+
def type
|
29
|
+
@attributes[:type]
|
30
|
+
end
|
31
|
+
|
32
|
+
# int64 - Preview size
|
33
|
+
def size
|
34
|
+
@attributes[:size]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,140 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Files
|
4
|
+
class Project
|
5
|
+
attr_reader :options, :attributes
|
6
|
+
|
7
|
+
def initialize(attributes = {}, options = {})
|
8
|
+
@attributes = attributes || {}
|
9
|
+
@options = options || {}
|
10
|
+
end
|
11
|
+
|
12
|
+
# int64 - Project ID
|
13
|
+
def id
|
14
|
+
@attributes[:id]
|
15
|
+
end
|
16
|
+
|
17
|
+
def id=(value)
|
18
|
+
@attributes[:id] = value
|
19
|
+
end
|
20
|
+
|
21
|
+
# string - Global access settings
|
22
|
+
def global_access
|
23
|
+
@attributes[:global_access]
|
24
|
+
end
|
25
|
+
|
26
|
+
def global_access=(value)
|
27
|
+
@attributes[:global_access] = value
|
28
|
+
end
|
29
|
+
|
30
|
+
# Parameters:
|
31
|
+
# global_access (required) - string - Global permissions. Can be: `none`, `anyone_with_read`, `anyone_with_full`.
|
32
|
+
def update(params = {})
|
33
|
+
params ||= {}
|
34
|
+
params[:id] = @attributes[:id]
|
35
|
+
raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
|
36
|
+
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
|
37
|
+
raise InvalidParameterError.new("Bad parameter: global_access must be an String") if params.dig(:global_access) and !params.dig(:global_access).is_a?(String)
|
38
|
+
raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
|
39
|
+
raise MissingParameterError.new("Parameter missing: global_access") unless params.dig(:global_access)
|
40
|
+
|
41
|
+
Api.send_request("/projects/#{@attributes[:id]}", :patch, params, @options)
|
42
|
+
end
|
43
|
+
|
44
|
+
def delete(params = {})
|
45
|
+
params ||= {}
|
46
|
+
params[:id] = @attributes[:id]
|
47
|
+
raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
|
48
|
+
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
|
49
|
+
raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
|
50
|
+
|
51
|
+
Api.send_request("/projects/#{@attributes[:id]}", :delete, params, @options)
|
52
|
+
end
|
53
|
+
|
54
|
+
def destroy(params = {})
|
55
|
+
delete(params)
|
56
|
+
end
|
57
|
+
|
58
|
+
def save
|
59
|
+
if @attributes[:id]
|
60
|
+
update(@attributes)
|
61
|
+
else
|
62
|
+
new_obj = Project.create(@attributes, @options)
|
63
|
+
@attributes = new_obj.attributes
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# Parameters:
|
68
|
+
# page - int64 - Current page number.
|
69
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
70
|
+
# action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
|
71
|
+
def self.list(params = {}, options = {})
|
72
|
+
raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
|
73
|
+
raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
|
74
|
+
raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
|
75
|
+
|
76
|
+
response, options = Api.send_request("/projects", :get, params, options)
|
77
|
+
response.data.map do |entity_data|
|
78
|
+
Project.new(entity_data, options)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def self.all(params = {}, options = {})
|
83
|
+
list(params, options)
|
84
|
+
end
|
85
|
+
|
86
|
+
# Parameters:
|
87
|
+
# id (required) - int64 - Project ID.
|
88
|
+
def self.find(id, params = {}, options = {})
|
89
|
+
params ||= {}
|
90
|
+
params[:id] = id
|
91
|
+
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
|
92
|
+
raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
|
93
|
+
|
94
|
+
response, options = Api.send_request("/projects/#{params[:id]}", :get, params, options)
|
95
|
+
Project.new(response.data, options)
|
96
|
+
end
|
97
|
+
|
98
|
+
def self.get(id, params = {}, options = {})
|
99
|
+
find(id, params, options)
|
100
|
+
end
|
101
|
+
|
102
|
+
# Parameters:
|
103
|
+
# global_access (required) - string - Global permissions. Can be: `none`, `anyone_with_read`, `anyone_with_full`.
|
104
|
+
def self.create(params = {}, options = {})
|
105
|
+
raise InvalidParameterError.new("Bad parameter: global_access must be an String") if params.dig(:global_access) and !params.dig(:global_access).is_a?(String)
|
106
|
+
raise MissingParameterError.new("Parameter missing: global_access") unless params.dig(:global_access)
|
107
|
+
|
108
|
+
response, options = Api.send_request("/projects", :post, params, options)
|
109
|
+
Project.new(response.data, options)
|
110
|
+
end
|
111
|
+
|
112
|
+
# Parameters:
|
113
|
+
# global_access (required) - string - Global permissions. Can be: `none`, `anyone_with_read`, `anyone_with_full`.
|
114
|
+
def self.update(id, params = {}, options = {})
|
115
|
+
params ||= {}
|
116
|
+
params[:id] = id
|
117
|
+
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
|
118
|
+
raise InvalidParameterError.new("Bad parameter: global_access must be an String") if params.dig(:global_access) and !params.dig(:global_access).is_a?(String)
|
119
|
+
raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
|
120
|
+
raise MissingParameterError.new("Parameter missing: global_access") unless params.dig(:global_access)
|
121
|
+
|
122
|
+
response, options = Api.send_request("/projects/#{params[:id]}", :patch, params, options)
|
123
|
+
Project.new(response.data, options)
|
124
|
+
end
|
125
|
+
|
126
|
+
def self.delete(id, params = {}, options = {})
|
127
|
+
params ||= {}
|
128
|
+
params[:id] = id
|
129
|
+
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
|
130
|
+
raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
|
131
|
+
|
132
|
+
response, _options = Api.send_request("/projects/#{params[:id]}", :delete, params, options)
|
133
|
+
response.data
|
134
|
+
end
|
135
|
+
|
136
|
+
def self.destroy(id, params = {}, options = {})
|
137
|
+
delete(id, params, options)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|