files.com 1.0.92
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 +59 -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 +106 -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,126 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Files
|
4
|
+
class FileAction
|
5
|
+
attr_reader :options, :attributes
|
6
|
+
|
7
|
+
def initialize(attributes = {}, options = {})
|
8
|
+
@attributes = attributes || {}
|
9
|
+
@options = options || {}
|
10
|
+
end
|
11
|
+
|
12
|
+
# Copy file/folder
|
13
|
+
#
|
14
|
+
# Parameters:
|
15
|
+
# destination (required) - string - Copy destination path.
|
16
|
+
# structure - boolean - Copy structure only?
|
17
|
+
def copy(params = {})
|
18
|
+
params ||= {}
|
19
|
+
params[:path] = @attributes[:path]
|
20
|
+
raise MissingParameterError.new("Current object doesn't have a path") unless @attributes[:path]
|
21
|
+
raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
|
22
|
+
raise InvalidParameterError.new("Bad parameter: destination must be an String") if params.dig(:destination) and !params.dig(:destination).is_a?(String)
|
23
|
+
raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
|
24
|
+
raise MissingParameterError.new("Parameter missing: destination") unless params.dig(:destination)
|
25
|
+
|
26
|
+
Api.send_request("/file_actions/copy/#{@attributes[:path]}", :post, params, @options)
|
27
|
+
end
|
28
|
+
|
29
|
+
# Move file/folder
|
30
|
+
#
|
31
|
+
# Parameters:
|
32
|
+
# destination (required) - string - Move destination path.
|
33
|
+
def move(params = {})
|
34
|
+
params ||= {}
|
35
|
+
params[:path] = @attributes[:path]
|
36
|
+
raise MissingParameterError.new("Current object doesn't have a path") unless @attributes[:path]
|
37
|
+
raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
|
38
|
+
raise InvalidParameterError.new("Bad parameter: destination must be an String") if params.dig(:destination) and !params.dig(:destination).is_a?(String)
|
39
|
+
raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
|
40
|
+
raise MissingParameterError.new("Parameter missing: destination") unless params.dig(:destination)
|
41
|
+
|
42
|
+
Api.send_request("/file_actions/move/#{@attributes[:path]}", :post, params, @options)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Begin file upload
|
46
|
+
#
|
47
|
+
# Parameters:
|
48
|
+
# mkdir_parents - boolean - Create parent directories if they do not exist?
|
49
|
+
# part - int64 - Part if uploading a part.
|
50
|
+
# parts - int64 - How many parts to fetch?
|
51
|
+
# ref - string -
|
52
|
+
# restart - int64 - File byte offset to restart from.
|
53
|
+
# with_rename - boolean - Allow file rename instead of overwrite?
|
54
|
+
def begin_upload(params = {})
|
55
|
+
params ||= {}
|
56
|
+
params[:path] = @attributes[:path]
|
57
|
+
raise MissingParameterError.new("Current object doesn't have a path") unless @attributes[:path]
|
58
|
+
raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
|
59
|
+
raise InvalidParameterError.new("Bad parameter: part must be an Integer") if params.dig(:part) and !params.dig(:part).is_a?(Integer)
|
60
|
+
raise InvalidParameterError.new("Bad parameter: parts must be an Integer") if params.dig(:parts) and !params.dig(:parts).is_a?(Integer)
|
61
|
+
raise InvalidParameterError.new("Bad parameter: ref must be an String") if params.dig(:ref) and !params.dig(:ref).is_a?(String)
|
62
|
+
raise InvalidParameterError.new("Bad parameter: restart must be an Integer") if params.dig(:restart) and !params.dig(:restart).is_a?(Integer)
|
63
|
+
raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
|
64
|
+
|
65
|
+
Api.send_request("/file_actions/begin_upload/#{@attributes[:path]}", :post, params, @options)
|
66
|
+
end
|
67
|
+
|
68
|
+
# Copy file/folder
|
69
|
+
#
|
70
|
+
# Parameters:
|
71
|
+
# destination (required) - string - Copy destination path.
|
72
|
+
# structure - boolean - Copy structure only?
|
73
|
+
def self.copy(path, params = {}, options = {})
|
74
|
+
params ||= {}
|
75
|
+
params[:path] = path
|
76
|
+
raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
|
77
|
+
raise InvalidParameterError.new("Bad parameter: destination must be an String") if params.dig(:destination) and !params.dig(:destination).is_a?(String)
|
78
|
+
raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
|
79
|
+
raise MissingParameterError.new("Parameter missing: destination") unless params.dig(:destination)
|
80
|
+
|
81
|
+
response, _options = Api.send_request("/file_actions/copy/#{params[:path]}", :post, params, options)
|
82
|
+
response.data
|
83
|
+
end
|
84
|
+
|
85
|
+
# Move file/folder
|
86
|
+
#
|
87
|
+
# Parameters:
|
88
|
+
# destination (required) - string - Move destination path.
|
89
|
+
def self.move(path, params = {}, options = {})
|
90
|
+
params ||= {}
|
91
|
+
params[:path] = path
|
92
|
+
raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
|
93
|
+
raise InvalidParameterError.new("Bad parameter: destination must be an String") if params.dig(:destination) and !params.dig(:destination).is_a?(String)
|
94
|
+
raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
|
95
|
+
raise MissingParameterError.new("Parameter missing: destination") unless params.dig(:destination)
|
96
|
+
|
97
|
+
response, _options = Api.send_request("/file_actions/move/#{params[:path]}", :post, params, options)
|
98
|
+
response.data
|
99
|
+
end
|
100
|
+
|
101
|
+
# Begin file upload
|
102
|
+
#
|
103
|
+
# Parameters:
|
104
|
+
# mkdir_parents - boolean - Create parent directories if they do not exist?
|
105
|
+
# part - int64 - Part if uploading a part.
|
106
|
+
# parts - int64 - How many parts to fetch?
|
107
|
+
# ref - string -
|
108
|
+
# restart - int64 - File byte offset to restart from.
|
109
|
+
# with_rename - boolean - Allow file rename instead of overwrite?
|
110
|
+
def self.begin_upload(path, params = {}, options = {})
|
111
|
+
params ||= {}
|
112
|
+
params[:path] = path
|
113
|
+
raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
|
114
|
+
raise InvalidParameterError.new("Bad parameter: part must be an Integer") if params.dig(:part) and !params.dig(:part).is_a?(Integer)
|
115
|
+
raise InvalidParameterError.new("Bad parameter: parts must be an Integer") if params.dig(:parts) and !params.dig(:parts).is_a?(Integer)
|
116
|
+
raise InvalidParameterError.new("Bad parameter: ref must be an String") if params.dig(:ref) and !params.dig(:ref).is_a?(String)
|
117
|
+
raise InvalidParameterError.new("Bad parameter: restart must be an Integer") if params.dig(:restart) and !params.dig(:restart).is_a?(Integer)
|
118
|
+
raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
|
119
|
+
|
120
|
+
response, options = Api.send_request("/file_actions/begin_upload/#{params[:path]}", :post, params, options)
|
121
|
+
response.data.map do |entity_data|
|
122
|
+
FilePartUpload.new(entity_data, options)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
@@ -0,0 +1,146 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Files
|
4
|
+
class FileComment
|
5
|
+
attr_reader :options, :attributes
|
6
|
+
|
7
|
+
def initialize(attributes = {}, options = {})
|
8
|
+
@attributes = attributes || {}
|
9
|
+
@options = options || {}
|
10
|
+
end
|
11
|
+
|
12
|
+
# int64 - File Comment ID
|
13
|
+
def id
|
14
|
+
@attributes[:id]
|
15
|
+
end
|
16
|
+
|
17
|
+
def id=(value)
|
18
|
+
@attributes[:id] = value
|
19
|
+
end
|
20
|
+
|
21
|
+
# string - Comment body.
|
22
|
+
def body
|
23
|
+
@attributes[:body]
|
24
|
+
end
|
25
|
+
|
26
|
+
def body=(value)
|
27
|
+
@attributes[:body] = value
|
28
|
+
end
|
29
|
+
|
30
|
+
# array - Reactions to this comment.
|
31
|
+
def reactions
|
32
|
+
@attributes[:reactions]
|
33
|
+
end
|
34
|
+
|
35
|
+
def reactions=(value)
|
36
|
+
@attributes[:reactions] = value
|
37
|
+
end
|
38
|
+
|
39
|
+
# string - File path.
|
40
|
+
def path
|
41
|
+
@attributes[:path]
|
42
|
+
end
|
43
|
+
|
44
|
+
def path=(value)
|
45
|
+
@attributes[:path] = value
|
46
|
+
end
|
47
|
+
|
48
|
+
# Parameters:
|
49
|
+
# body (required) - string - Comment body.
|
50
|
+
def update(params = {})
|
51
|
+
params ||= {}
|
52
|
+
params[:id] = @attributes[:id]
|
53
|
+
raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
|
54
|
+
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
|
55
|
+
raise InvalidParameterError.new("Bad parameter: body must be an String") if params.dig(:body) and !params.dig(:body).is_a?(String)
|
56
|
+
raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
|
57
|
+
raise MissingParameterError.new("Parameter missing: body") unless params.dig(:body)
|
58
|
+
|
59
|
+
Api.send_request("/file_comments/#{@attributes[:id]}", :patch, params, @options)
|
60
|
+
end
|
61
|
+
|
62
|
+
def delete(params = {})
|
63
|
+
params ||= {}
|
64
|
+
params[:id] = @attributes[:id]
|
65
|
+
raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
|
66
|
+
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
|
67
|
+
raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
|
68
|
+
|
69
|
+
Api.send_request("/file_comments/#{@attributes[:id]}", :delete, params, @options)
|
70
|
+
end
|
71
|
+
|
72
|
+
def destroy(params = {})
|
73
|
+
delete(params)
|
74
|
+
end
|
75
|
+
|
76
|
+
def save
|
77
|
+
if @attributes[:id]
|
78
|
+
update(@attributes)
|
79
|
+
else
|
80
|
+
new_obj = FileComment.create(@attributes, @options)
|
81
|
+
@attributes = new_obj.attributes
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
# Parameters:
|
86
|
+
# page - int64 - Current page number.
|
87
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
88
|
+
# action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
|
89
|
+
# path (required) - string - Path to operate on.
|
90
|
+
def self.list_for(path, params = {}, options = {})
|
91
|
+
params ||= {}
|
92
|
+
params[:path] = path
|
93
|
+
raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
|
94
|
+
raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
|
95
|
+
raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
|
96
|
+
raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
|
97
|
+
raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
|
98
|
+
|
99
|
+
response, options = Api.send_request("/file_comments/files/#{params[:path]}", :get, params, options)
|
100
|
+
response.data.map do |entity_data|
|
101
|
+
FileComment.new(entity_data, options)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
# Parameters:
|
106
|
+
# body (required) - string - Comment body.
|
107
|
+
# path (required) - string - File path.
|
108
|
+
def self.create(params = {}, options = {})
|
109
|
+
raise InvalidParameterError.new("Bad parameter: body must be an String") if params.dig(:body) and !params.dig(:body).is_a?(String)
|
110
|
+
raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
|
111
|
+
raise MissingParameterError.new("Parameter missing: body") unless params.dig(:body)
|
112
|
+
raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
|
113
|
+
|
114
|
+
response, options = Api.send_request("/file_comments", :post, params, options)
|
115
|
+
FileComment.new(response.data, options)
|
116
|
+
end
|
117
|
+
|
118
|
+
# Parameters:
|
119
|
+
# body (required) - string - Comment body.
|
120
|
+
def self.update(id, params = {}, options = {})
|
121
|
+
params ||= {}
|
122
|
+
params[:id] = id
|
123
|
+
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
|
124
|
+
raise InvalidParameterError.new("Bad parameter: body must be an String") if params.dig(:body) and !params.dig(:body).is_a?(String)
|
125
|
+
raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
|
126
|
+
raise MissingParameterError.new("Parameter missing: body") unless params.dig(:body)
|
127
|
+
|
128
|
+
response, options = Api.send_request("/file_comments/#{params[:id]}", :patch, params, options)
|
129
|
+
FileComment.new(response.data, options)
|
130
|
+
end
|
131
|
+
|
132
|
+
def self.delete(id, params = {}, options = {})
|
133
|
+
params ||= {}
|
134
|
+
params[:id] = id
|
135
|
+
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
|
136
|
+
raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
|
137
|
+
|
138
|
+
response, _options = Api.send_request("/file_comments/#{params[:id]}", :delete, params, options)
|
139
|
+
response.data
|
140
|
+
end
|
141
|
+
|
142
|
+
def self.destroy(id, params = {}, options = {})
|
143
|
+
delete(id, params, options)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Files
|
4
|
+
class FileCommentReaction
|
5
|
+
attr_reader :options, :attributes
|
6
|
+
|
7
|
+
def initialize(attributes = {}, options = {})
|
8
|
+
@attributes = attributes || {}
|
9
|
+
@options = options || {}
|
10
|
+
end
|
11
|
+
|
12
|
+
# int64 - Reaction ID
|
13
|
+
def id
|
14
|
+
@attributes[:id]
|
15
|
+
end
|
16
|
+
|
17
|
+
def id=(value)
|
18
|
+
@attributes[:id] = value
|
19
|
+
end
|
20
|
+
|
21
|
+
# string - Emoji used in the reaction.
|
22
|
+
def emoji
|
23
|
+
@attributes[:emoji]
|
24
|
+
end
|
25
|
+
|
26
|
+
def emoji=(value)
|
27
|
+
@attributes[:emoji] = value
|
28
|
+
end
|
29
|
+
|
30
|
+
# int64 - User ID. Provide a value of `0` to operate the current session's user.
|
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
|
+
# int64 - ID of file comment to attach reaction to.
|
40
|
+
def file_comment_id
|
41
|
+
@attributes[:file_comment_id]
|
42
|
+
end
|
43
|
+
|
44
|
+
def file_comment_id=(value)
|
45
|
+
@attributes[:file_comment_id] = value
|
46
|
+
end
|
47
|
+
|
48
|
+
def delete(params = {})
|
49
|
+
params ||= {}
|
50
|
+
params[:id] = @attributes[:id]
|
51
|
+
raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
|
52
|
+
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
|
53
|
+
raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
|
54
|
+
|
55
|
+
Api.send_request("/file_comment_reactions/#{@attributes[:id]}", :delete, params, @options)
|
56
|
+
end
|
57
|
+
|
58
|
+
def destroy(params = {})
|
59
|
+
delete(params)
|
60
|
+
end
|
61
|
+
|
62
|
+
def save
|
63
|
+
if @attributes[:id]
|
64
|
+
raise NotImplementedError.new("The FileCommentReaction object doesn't support updates.")
|
65
|
+
else
|
66
|
+
new_obj = FileCommentReaction.create(@attributes, @options)
|
67
|
+
@attributes = new_obj.attributes
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# Parameters:
|
72
|
+
# user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
|
73
|
+
# file_comment_id (required) - int64 - ID of file comment to attach reaction to.
|
74
|
+
# emoji (required) - string - Emoji to react with.
|
75
|
+
def self.create(params = {}, options = {})
|
76
|
+
raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params.dig(:user_id) and !params.dig(:user_id).is_a?(Integer)
|
77
|
+
raise InvalidParameterError.new("Bad parameter: file_comment_id must be an Integer") if params.dig(:file_comment_id) and !params.dig(:file_comment_id).is_a?(Integer)
|
78
|
+
raise InvalidParameterError.new("Bad parameter: emoji must be an String") if params.dig(:emoji) and !params.dig(:emoji).is_a?(String)
|
79
|
+
raise MissingParameterError.new("Parameter missing: file_comment_id") unless params.dig(:file_comment_id)
|
80
|
+
raise MissingParameterError.new("Parameter missing: emoji") unless params.dig(:emoji)
|
81
|
+
|
82
|
+
response, options = Api.send_request("/file_comment_reactions", :post, params, options)
|
83
|
+
FileCommentReaction.new(response.data, options)
|
84
|
+
end
|
85
|
+
|
86
|
+
def self.delete(id, params = {}, options = {})
|
87
|
+
params ||= {}
|
88
|
+
params[:id] = id
|
89
|
+
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
|
90
|
+
raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
|
91
|
+
|
92
|
+
response, _options = Api.send_request("/file_comment_reactions/#{params[:id]}", :delete, params, options)
|
93
|
+
response.data
|
94
|
+
end
|
95
|
+
|
96
|
+
def self.destroy(id, params = {}, options = {})
|
97
|
+
delete(id, params, options)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Files
|
4
|
+
class FilePartUpload
|
5
|
+
attr_reader :options, :attributes
|
6
|
+
|
7
|
+
def initialize(attributes = {}, options = {})
|
8
|
+
@attributes = attributes || {}
|
9
|
+
@options = options || {}
|
10
|
+
end
|
11
|
+
|
12
|
+
# object - Content-Type and File to send
|
13
|
+
def send
|
14
|
+
@attributes[:send]
|
15
|
+
end
|
16
|
+
|
17
|
+
# string - Type of upload
|
18
|
+
def action
|
19
|
+
@attributes[:action]
|
20
|
+
end
|
21
|
+
|
22
|
+
# boolean - If false, rename conflicting files instead of asking for overwrite confirmation
|
23
|
+
def ask_about_overwrites
|
24
|
+
@attributes[:ask_about_overwrites]
|
25
|
+
end
|
26
|
+
|
27
|
+
# string - Currently unused
|
28
|
+
def available_parts
|
29
|
+
@attributes[:available_parts]
|
30
|
+
end
|
31
|
+
|
32
|
+
# string - Currently unused
|
33
|
+
def expires
|
34
|
+
@attributes[:expires]
|
35
|
+
end
|
36
|
+
|
37
|
+
# object - Additional upload headers
|
38
|
+
def headers
|
39
|
+
@attributes[:headers]
|
40
|
+
end
|
41
|
+
|
42
|
+
# string - Upload method, usually POST
|
43
|
+
def http_method
|
44
|
+
@attributes[:http_method]
|
45
|
+
end
|
46
|
+
|
47
|
+
# string - Currently unused
|
48
|
+
def next_partsize
|
49
|
+
@attributes[:next_partsize]
|
50
|
+
end
|
51
|
+
|
52
|
+
# string - Additional upload parameters
|
53
|
+
def parameters
|
54
|
+
@attributes[:parameters]
|
55
|
+
end
|
56
|
+
|
57
|
+
# string - Currently unused
|
58
|
+
def part_number
|
59
|
+
@attributes[:part_number]
|
60
|
+
end
|
61
|
+
|
62
|
+
# string - Currently unused
|
63
|
+
def partsize
|
64
|
+
@attributes[:partsize]
|
65
|
+
end
|
66
|
+
|
67
|
+
# string - Upload path This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
|
68
|
+
def path
|
69
|
+
@attributes[:path]
|
70
|
+
end
|
71
|
+
|
72
|
+
# string - Reference name for this upload part
|
73
|
+
def ref
|
74
|
+
@attributes[:ref]
|
75
|
+
end
|
76
|
+
|
77
|
+
# string - URI to upload this part to
|
78
|
+
def upload_uri
|
79
|
+
@attributes[:upload_uri]
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|