files.com 1.0.72 → 1.0.77

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.
@@ -10,11 +10,11 @@ Gem::Specification.new do |s|
10
10
  s.summary = "Files.com Ruby client."
11
11
  s.description = "The Files.com Ruby client."
12
12
  s.license = "MIT"
13
- s.required_ruby_version = ">= 2.3"
14
- s.add_dependency 'faraday', ">= 1.0.1"
15
- s.add_dependency 'net-http-persistent'
13
+ s.required_ruby_version = ">= 2.5"
16
14
  s.add_dependency 'addressable', ">= 2.7.0"
17
15
  s.add_dependency 'concurrent-ruby', ">= 1.1.3"
16
+ s.add_dependency 'faraday', ">= 1.0.1"
17
+ s.add_dependency 'net-http-persistent'
18
18
 
19
19
  s.files = `find *`.split("\n").uniq.sort.reject(&:empty?)
20
20
  s.executables = [ "files", "files-console" ]
@@ -34,6 +34,8 @@ require "files.com/models/auto"
34
34
  require "files.com/models/automation"
35
35
  require "files.com/models/behavior"
36
36
  require "files.com/models/bundle"
37
+ require "files.com/models/bundle_download"
38
+ require "files.com/models/clickwrap"
37
39
  require "files.com/models/dns_record"
38
40
  require "files.com/models/errors"
39
41
  require "files.com/models/file"
@@ -94,7 +96,7 @@ module Files
94
96
  @read_timeout = 80
95
97
 
96
98
  class << self
97
- attr_accessor :api_key, :base_url, :initial_network_retry_delay, :max_network_retries, :max_network_retry_delay, :open_timeout, :read_timeout, :proxy, :session_id
99
+ attr_accessor :api_key, :base_url, :initial_network_retry_delay, :max_network_retry_delay, :open_timeout, :read_timeout, :proxy, :session_id
98
100
  end
99
101
 
100
102
  # map to the same values as the standard library's logger
@@ -77,7 +77,7 @@ module Files
77
77
  end
78
78
 
79
79
  def set_cursor
80
- params[:cursor] ||= @current_options[:client].cursor
80
+ params[:cursor] = @current_options[:client].cursor
81
81
  end
82
82
 
83
83
  def cursor
@@ -201,9 +201,9 @@ module Files
201
201
  def self.update(id, params = {}, options = {})
202
202
  params ||= {}
203
203
  params[:id] = id
204
- raise InvalidParameterError.new("Bad parameter: id must be one of String, Integer, Hash") if params.dig(:id) and [String, Integer, Hash].none? { |klass| params.dig(:id).is_a?(klass) }
204
+ raise InvalidParameterError.new("Bad parameter: id must be one of String, Integer, Hash") if params.dig(:id) and [ String, Integer, Hash ].none? { |klass| params.dig(:id).is_a?(klass) }
205
205
  raise InvalidParameterError.new("Bad parameter: value must be an String") if params.dig(:value) and !params.dig(:value).is_a?(String)
206
- raise InvalidParameterError.new("Bad parameter: attachment_file must be one of String, Integer, Hash") if params.dig(:attachment_file) and [String, Integer, Hash].none? { |klass| params.dig(:attachment_file).is_a?(klass) }
206
+ raise InvalidParameterError.new("Bad parameter: attachment_file must be one of String, Integer, Hash") if params.dig(:attachment_file) and [ String, Integer, Hash ].none? { |klass| params.dig(:attachment_file).is_a?(klass) }
207
207
  raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
208
208
 
209
209
  response, options = Api.send_request("/behaviors/#{params[:id]}", :patch, params, options)
@@ -54,6 +54,15 @@ module Files
54
54
  @attributes[:require_registration] = value
55
55
  end
56
56
 
57
+ # string - Legal text that must be agreed to prior to accessing Bundle.
58
+ def clickwrap_body
59
+ @attributes[:clickwrap_body]
60
+ end
61
+
62
+ def clickwrap_body=(value)
63
+ @attributes[:clickwrap_body] = value
64
+ end
65
+
57
66
  # int64 - Bundle ID
58
67
  def id
59
68
  @attributes[:id]
@@ -77,6 +86,15 @@ module Files
77
86
  @attributes[:expires_at] = value
78
87
  end
79
88
 
89
+ # int64 - Maximum number of times bundle can be accessed
90
+ def max_uses
91
+ @attributes[:max_uses]
92
+ end
93
+
94
+ def max_uses=(value)
95
+ @attributes[:max_uses] = value
96
+ end
97
+
80
98
  # string - Bundle internal note
81
99
  def note
82
100
  @attributes[:note]
@@ -104,6 +122,24 @@ module Files
104
122
  @attributes[:username] = value
105
123
  end
106
124
 
125
+ # int64 - ID of the clickwrap to use with this bundle.
126
+ def clickwrap_id
127
+ @attributes[:clickwrap_id]
128
+ end
129
+
130
+ def clickwrap_id=(value)
131
+ @attributes[:clickwrap_id] = value
132
+ end
133
+
134
+ # int64 - ID of the associated inbox, if available.
135
+ def inbox_id
136
+ @attributes[:inbox_id]
137
+ end
138
+
139
+ def inbox_id=(value)
140
+ @attributes[:inbox_id] = value
141
+ end
142
+
107
143
  # array - A list of paths in this bundle
108
144
  def paths
109
145
  @attributes[:paths]
@@ -143,10 +179,13 @@ module Files
143
179
  # Parameters:
144
180
  # password - string - Password for this bundle.
145
181
  # expires_at - string - Bundle expiration date/time
182
+ # max_uses - int64 - Maximum number of times bundle can be accessed
146
183
  # description - string - Public description
147
184
  # note - string - Bundle internal note
148
185
  # code - string - Bundle code. This code forms the end part of the Public URL.
149
186
  # require_registration - boolean - Show a registration page that captures the downloader's name and email address?
187
+ # clickwrap_id - int64 - ID of the clickwrap to use with this bundle.
188
+ # inbox_id - int64 - ID of the associated inbox, if available.
150
189
  def update(params = {})
151
190
  params ||= {}
152
191
  params[:id] = @attributes[:id]
@@ -154,9 +193,12 @@ module Files
154
193
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
155
194
  raise InvalidParameterError.new("Bad parameter: password must be an String") if params.dig(:password) and !params.dig(:password).is_a?(String)
156
195
  raise InvalidParameterError.new("Bad parameter: expires_at must be an String") if params.dig(:expires_at) and !params.dig(:expires_at).is_a?(String)
196
+ raise InvalidParameterError.new("Bad parameter: max_uses must be an Integer") if params.dig(:max_uses) and !params.dig(:max_uses).is_a?(Integer)
157
197
  raise InvalidParameterError.new("Bad parameter: description must be an String") if params.dig(:description) and !params.dig(:description).is_a?(String)
158
198
  raise InvalidParameterError.new("Bad parameter: note must be an String") if params.dig(:note) and !params.dig(:note).is_a?(String)
159
199
  raise InvalidParameterError.new("Bad parameter: code must be an String") if params.dig(:code) and !params.dig(:code).is_a?(String)
200
+ raise InvalidParameterError.new("Bad parameter: clickwrap_id must be an Integer") if params.dig(:clickwrap_id) and !params.dig(:clickwrap_id).is_a?(Integer)
201
+ raise InvalidParameterError.new("Bad parameter: inbox_id must be an Integer") if params.dig(:inbox_id) and !params.dig(:inbox_id).is_a?(Integer)
160
202
  raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
161
203
 
162
204
  Api.send_request("/bundles/#{@attributes[:id]}", :patch, params, @options)
@@ -227,18 +269,24 @@ module Files
227
269
  # paths (required) - array(string) - A list of paths to include in this bundle.
228
270
  # password - string - Password for this bundle.
229
271
  # expires_at - string - Bundle expiration date/time
272
+ # max_uses - int64 - Maximum number of times bundle can be accessed
230
273
  # description - string - Public description
231
274
  # note - string - Bundle internal note
232
275
  # code - string - Bundle code. This code forms the end part of the Public URL.
233
276
  # require_registration - boolean - Show a registration page that captures the downloader's name and email address?
277
+ # clickwrap_id - int64 - ID of the clickwrap to use with this bundle.
278
+ # inbox_id - int64 - ID of the associated inbox, if available.
234
279
  def self.create(params = {}, options = {})
235
280
  raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params.dig(:user_id) and !params.dig(:user_id).is_a?(Integer)
236
281
  raise InvalidParameterError.new("Bad parameter: paths must be an Array") if params.dig(:paths) and !params.dig(:paths).is_a?(Array)
237
282
  raise InvalidParameterError.new("Bad parameter: password must be an String") if params.dig(:password) and !params.dig(:password).is_a?(String)
238
283
  raise InvalidParameterError.new("Bad parameter: expires_at must be an String") if params.dig(:expires_at) and !params.dig(:expires_at).is_a?(String)
284
+ raise InvalidParameterError.new("Bad parameter: max_uses must be an Integer") if params.dig(:max_uses) and !params.dig(:max_uses).is_a?(Integer)
239
285
  raise InvalidParameterError.new("Bad parameter: description must be an String") if params.dig(:description) and !params.dig(:description).is_a?(String)
240
286
  raise InvalidParameterError.new("Bad parameter: note must be an String") if params.dig(:note) and !params.dig(:note).is_a?(String)
241
287
  raise InvalidParameterError.new("Bad parameter: code must be an String") if params.dig(:code) and !params.dig(:code).is_a?(String)
288
+ raise InvalidParameterError.new("Bad parameter: clickwrap_id must be an Integer") if params.dig(:clickwrap_id) and !params.dig(:clickwrap_id).is_a?(Integer)
289
+ raise InvalidParameterError.new("Bad parameter: inbox_id must be an Integer") if params.dig(:inbox_id) and !params.dig(:inbox_id).is_a?(Integer)
242
290
  raise MissingParameterError.new("Parameter missing: paths") unless params.dig(:paths)
243
291
 
244
292
  response, options = Api.send_request("/bundles", :post, params, options)
@@ -266,19 +314,25 @@ module Files
266
314
  # Parameters:
267
315
  # password - string - Password for this bundle.
268
316
  # expires_at - string - Bundle expiration date/time
317
+ # max_uses - int64 - Maximum number of times bundle can be accessed
269
318
  # description - string - Public description
270
319
  # note - string - Bundle internal note
271
320
  # code - string - Bundle code. This code forms the end part of the Public URL.
272
321
  # require_registration - boolean - Show a registration page that captures the downloader's name and email address?
322
+ # clickwrap_id - int64 - ID of the clickwrap to use with this bundle.
323
+ # inbox_id - int64 - ID of the associated inbox, if available.
273
324
  def self.update(id, params = {}, options = {})
274
325
  params ||= {}
275
326
  params[:id] = id
276
327
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
277
328
  raise InvalidParameterError.new("Bad parameter: password must be an String") if params.dig(:password) and !params.dig(:password).is_a?(String)
278
329
  raise InvalidParameterError.new("Bad parameter: expires_at must be an String") if params.dig(:expires_at) and !params.dig(:expires_at).is_a?(String)
330
+ raise InvalidParameterError.new("Bad parameter: max_uses must be an Integer") if params.dig(:max_uses) and !params.dig(:max_uses).is_a?(Integer)
279
331
  raise InvalidParameterError.new("Bad parameter: description must be an String") if params.dig(:description) and !params.dig(:description).is_a?(String)
280
332
  raise InvalidParameterError.new("Bad parameter: note must be an String") if params.dig(:note) and !params.dig(:note).is_a?(String)
281
333
  raise InvalidParameterError.new("Bad parameter: code must be an String") if params.dig(:code) and !params.dig(:code).is_a?(String)
334
+ raise InvalidParameterError.new("Bad parameter: clickwrap_id must be an Integer") if params.dig(:clickwrap_id) and !params.dig(:clickwrap_id).is_a?(Integer)
335
+ raise InvalidParameterError.new("Bad parameter: inbox_id must be an Integer") if params.dig(:inbox_id) and !params.dig(:inbox_id).is_a?(Integer)
282
336
  raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
283
337
 
284
338
  response, options = Api.send_request("/bundles/#{params[:id]}", :patch, params, options)
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Files
4
+ class BundleDownload
5
+ attr_reader :options, :attributes
6
+
7
+ def initialize(attributes = {}, options = {})
8
+ @attributes = attributes || {}
9
+ @options = options || {}
10
+ end
11
+
12
+ # string - Download method (file or full_zip)
13
+ def download_method
14
+ @attributes[:download_method]
15
+ end
16
+
17
+ # string - Download path This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
18
+ def path
19
+ @attributes[:path]
20
+ end
21
+
22
+ # date-time - Download date/time
23
+ def created_at
24
+ @attributes[:created_at]
25
+ end
26
+
27
+ # Parameters:
28
+ # page - int64 - Current page number.
29
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
30
+ # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
31
+ # bundle_registration_id (required) - int64 - BundleRegistration ID
32
+ def self.list(params = {}, options = {})
33
+ raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
34
+ raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
35
+ raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
36
+ raise InvalidParameterError.new("Bad parameter: bundle_registration_id must be an Integer") if params.dig(:bundle_registration_id) and !params.dig(:bundle_registration_id).is_a?(Integer)
37
+ raise MissingParameterError.new("Parameter missing: bundle_registration_id") unless params.dig(:bundle_registration_id)
38
+
39
+ response, options = Api.send_request("/bundle_downloads", :get, params, options)
40
+ response.data.map do |entity_data|
41
+ BundleDownload.new(entity_data, options)
42
+ end
43
+ end
44
+
45
+ def self.all(params = {}, options = {})
46
+ list(params, options)
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,197 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Files
4
+ class Clickwrap
5
+ attr_reader :options, :attributes
6
+
7
+ def initialize(attributes = {}, options = {})
8
+ @attributes = attributes || {}
9
+ @options = options || {}
10
+ end
11
+
12
+ # string - Name of the Clickwrap agreement (used when selecting from multiple Clickwrap agreements.)
13
+ def name
14
+ @attributes[:name]
15
+ end
16
+
17
+ def name=(value)
18
+ @attributes[:name] = value
19
+ end
20
+
21
+ # string - Body text of Clickwrap (supports Markdown formatting).
22
+ def body
23
+ @attributes[:body]
24
+ end
25
+
26
+ def body=(value)
27
+ @attributes[:body] = value
28
+ end
29
+
30
+ # string - Use this Clickwrap for User Registrations? Note: This only applies to User Registrations where the User is invited to your Files.com site using an E-Mail invitation process where they then set their own password.
31
+ def use_with_users
32
+ @attributes[:use_with_users]
33
+ end
34
+
35
+ def use_with_users=(value)
36
+ @attributes[:use_with_users] = value
37
+ end
38
+
39
+ # string - Use this Clickwrap for Bundles?
40
+ def use_with_bundles
41
+ @attributes[:use_with_bundles]
42
+ end
43
+
44
+ def use_with_bundles=(value)
45
+ @attributes[:use_with_bundles] = value
46
+ end
47
+
48
+ # string - Use this Clickwrap for Inboxes?
49
+ def use_with_inboxes
50
+ @attributes[:use_with_inboxes]
51
+ end
52
+
53
+ def use_with_inboxes=(value)
54
+ @attributes[:use_with_inboxes] = value
55
+ end
56
+
57
+ # int64 - Clickwrap ID.
58
+ def id
59
+ @attributes[:id]
60
+ end
61
+
62
+ def id=(value)
63
+ @attributes[:id] = value
64
+ end
65
+
66
+ # Parameters:
67
+ # name - string - Name of the Clickwrap agreement (used when selecting from multiple Clickwrap agreements.)
68
+ # body - string - Body text of Clickwrap (supports Markdown formatting).
69
+ # use_with_bundles - string - Use this Clickwrap for Bundles?
70
+ # use_with_inboxes - string - Use this Clickwrap for Inboxes?
71
+ # use_with_users - string - Use this Clickwrap for User Registrations? Note: This only applies to User Registrations where the User is invited to your Files.com site using an E-Mail invitation process where they then set their own password.
72
+ def update(params = {})
73
+ params ||= {}
74
+ params[:id] = @attributes[:id]
75
+ raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
76
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
77
+ raise InvalidParameterError.new("Bad parameter: name must be an String") if params.dig(:name) and !params.dig(:name).is_a?(String)
78
+ raise InvalidParameterError.new("Bad parameter: body must be an String") if params.dig(:body) and !params.dig(:body).is_a?(String)
79
+ raise InvalidParameterError.new("Bad parameter: use_with_bundles must be an String") if params.dig(:use_with_bundles) and !params.dig(:use_with_bundles).is_a?(String)
80
+ raise InvalidParameterError.new("Bad parameter: use_with_inboxes must be an String") if params.dig(:use_with_inboxes) and !params.dig(:use_with_inboxes).is_a?(String)
81
+ raise InvalidParameterError.new("Bad parameter: use_with_users must be an String") if params.dig(:use_with_users) and !params.dig(:use_with_users).is_a?(String)
82
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
83
+
84
+ Api.send_request("/clickwraps/#{@attributes[:id]}", :patch, params, @options)
85
+ end
86
+
87
+ def delete(params = {})
88
+ params ||= {}
89
+ params[:id] = @attributes[:id]
90
+ raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[: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
+ Api.send_request("/clickwraps/#{@attributes[:id]}", :delete, params, @options)
95
+ end
96
+
97
+ def destroy(params = {})
98
+ delete(params)
99
+ end
100
+
101
+ def save
102
+ if @attributes[:id]
103
+ update(@attributes)
104
+ else
105
+ new_obj = Clickwrap.create(@attributes, @options)
106
+ @attributes = new_obj.attributes
107
+ end
108
+ end
109
+
110
+ # Parameters:
111
+ # page - int64 - Current page number.
112
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
113
+ # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
114
+ def self.list(params = {}, options = {})
115
+ raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
116
+ raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
117
+ raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
118
+
119
+ response, options = Api.send_request("/clickwraps", :get, params, options)
120
+ response.data.map do |entity_data|
121
+ Clickwrap.new(entity_data, options)
122
+ end
123
+ end
124
+
125
+ def self.all(params = {}, options = {})
126
+ list(params, options)
127
+ end
128
+
129
+ # Parameters:
130
+ # id (required) - int64 - Clickwrap ID.
131
+ def self.find(id, params = {}, options = {})
132
+ params ||= {}
133
+ params[:id] = id
134
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
135
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
136
+
137
+ response, options = Api.send_request("/clickwraps/#{params[:id]}", :get, params, options)
138
+ Clickwrap.new(response.data, options)
139
+ end
140
+
141
+ def self.get(id, params = {}, options = {})
142
+ find(id, params, options)
143
+ end
144
+
145
+ # Parameters:
146
+ # name - string - Name of the Clickwrap agreement (used when selecting from multiple Clickwrap agreements.)
147
+ # body - string - Body text of Clickwrap (supports Markdown formatting).
148
+ # use_with_bundles - string - Use this Clickwrap for Bundles?
149
+ # use_with_inboxes - string - Use this Clickwrap for Inboxes?
150
+ # use_with_users - string - Use this Clickwrap for User Registrations? Note: This only applies to User Registrations where the User is invited to your Files.com site using an E-Mail invitation process where they then set their own password.
151
+ def self.create(params = {}, options = {})
152
+ raise InvalidParameterError.new("Bad parameter: name must be an String") if params.dig(:name) and !params.dig(:name).is_a?(String)
153
+ raise InvalidParameterError.new("Bad parameter: body must be an String") if params.dig(:body) and !params.dig(:body).is_a?(String)
154
+ raise InvalidParameterError.new("Bad parameter: use_with_bundles must be an String") if params.dig(:use_with_bundles) and !params.dig(:use_with_bundles).is_a?(String)
155
+ raise InvalidParameterError.new("Bad parameter: use_with_inboxes must be an String") if params.dig(:use_with_inboxes) and !params.dig(:use_with_inboxes).is_a?(String)
156
+ raise InvalidParameterError.new("Bad parameter: use_with_users must be an String") if params.dig(:use_with_users) and !params.dig(:use_with_users).is_a?(String)
157
+
158
+ response, options = Api.send_request("/clickwraps", :post, params, options)
159
+ Clickwrap.new(response.data, options)
160
+ end
161
+
162
+ # Parameters:
163
+ # name - string - Name of the Clickwrap agreement (used when selecting from multiple Clickwrap agreements.)
164
+ # body - string - Body text of Clickwrap (supports Markdown formatting).
165
+ # use_with_bundles - string - Use this Clickwrap for Bundles?
166
+ # use_with_inboxes - string - Use this Clickwrap for Inboxes?
167
+ # use_with_users - string - Use this Clickwrap for User Registrations? Note: This only applies to User Registrations where the User is invited to your Files.com site using an E-Mail invitation process where they then set their own password.
168
+ def self.update(id, params = {}, options = {})
169
+ params ||= {}
170
+ params[:id] = id
171
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
172
+ raise InvalidParameterError.new("Bad parameter: name must be an String") if params.dig(:name) and !params.dig(:name).is_a?(String)
173
+ raise InvalidParameterError.new("Bad parameter: body must be an String") if params.dig(:body) and !params.dig(:body).is_a?(String)
174
+ raise InvalidParameterError.new("Bad parameter: use_with_bundles must be an String") if params.dig(:use_with_bundles) and !params.dig(:use_with_bundles).is_a?(String)
175
+ raise InvalidParameterError.new("Bad parameter: use_with_inboxes must be an String") if params.dig(:use_with_inboxes) and !params.dig(:use_with_inboxes).is_a?(String)
176
+ raise InvalidParameterError.new("Bad parameter: use_with_users must be an String") if params.dig(:use_with_users) and !params.dig(:use_with_users).is_a?(String)
177
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
178
+
179
+ response, options = Api.send_request("/clickwraps/#{params[:id]}", :patch, params, options)
180
+ Clickwrap.new(response.data, options)
181
+ end
182
+
183
+ def self.delete(id, params = {}, options = {})
184
+ params ||= {}
185
+ params[:id] = id
186
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
187
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
188
+
189
+ response, _options = Api.send_request("/clickwraps/#{params[:id]}", :delete, params, options)
190
+ response.data
191
+ end
192
+
193
+ def self.destroy(id, params = {}, options = {})
194
+ delete(id, params, options)
195
+ end
196
+ end
197
+ end
@@ -90,7 +90,7 @@ module Files
90
90
  new(path).mtime
91
91
  end
92
92
 
93
- def self.open(path, mode = "r", options={}, &block)
93
+ def self.open(path, mode = "r", options = {}, &block)
94
94
  file = new(path, mode, options)
95
95
  if block
96
96
  yield file
@@ -306,7 +306,7 @@ module Files
306
306
  end
307
307
 
308
308
  def download_content(io)
309
- Files::ApiClient::download_client.stream_download(download_uri_with_load, io)
309
+ Files::ApiClient.download_client.stream_download(download_uri_with_load, io)
310
310
  end
311
311
 
312
312
  def each(*args, &block)
@@ -571,13 +571,13 @@ module Files
571
571
  end
572
572
 
573
573
  def upload_file(local_file)
574
- File.upload_file(local_file. path)
574
+ File.upload_file(local_file.path)
575
575
  end
576
576
 
577
577
  def write(*args)
578
578
  @mode ||= 'w'
579
579
  if args[0].respond_to?(:read)
580
- flush if @write_io.size > 0
580
+ flush if @write_io.size > 0 # rubocop:disable Style/ZeroLengthPredicate
581
581
  @write_io = args[0]
582
582
  else
583
583
  @write_io.write *args