files.com 1.0.90

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. checksums.yaml +7 -0
  2. data/CONTRIBUTORS +4 -0
  3. data/Gemfile +12 -0
  4. data/Gemfile.lock +82 -0
  5. data/LICENSE +21 -0
  6. data/README.md +119 -0
  7. data/Rakefile +12 -0
  8. data/SECURITY.md +24 -0
  9. data/_VERSION +1 -0
  10. data/bin/files +8 -0
  11. data/bin/files-console +16 -0
  12. data/docs/account_line_item.md +41 -0
  13. data/docs/action.md +37 -0
  14. data/docs/api_key.md +202 -0
  15. data/docs/app.md +57 -0
  16. data/docs/as2_key.md +133 -0
  17. data/docs/auto.md +11 -0
  18. data/docs/automation.md +190 -0
  19. data/docs/behavior.md +208 -0
  20. data/docs/bundle.md +252 -0
  21. data/docs/bundle_download.md +35 -0
  22. data/docs/clickwrap.md +143 -0
  23. data/docs/dns_record.md +35 -0
  24. data/docs/errors.md +17 -0
  25. data/docs/file.md +204 -0
  26. data/docs/file_action.md +126 -0
  27. data/docs/file_comment.md +116 -0
  28. data/docs/file_comment_reaction.md +62 -0
  29. data/docs/file_part_upload.md +37 -0
  30. data/docs/file_utils.md +4 -0
  31. data/docs/folder.md +90 -0
  32. data/docs/group.md +153 -0
  33. data/docs/group_user.md +124 -0
  34. data/docs/history.md +171 -0
  35. data/docs/history_export.md +174 -0
  36. data/docs/image.md +13 -0
  37. data/docs/invoice.md +72 -0
  38. data/docs/invoice_line_item.md +27 -0
  39. data/docs/ip_address.md +55 -0
  40. data/docs/lock.md +98 -0
  41. data/docs/message.md +147 -0
  42. data/docs/message_comment.md +132 -0
  43. data/docs/message_comment_reaction.md +94 -0
  44. data/docs/message_reaction.md +94 -0
  45. data/docs/notification.md +177 -0
  46. data/docs/payment.md +72 -0
  47. data/docs/payment_line_item.md +19 -0
  48. data/docs/permission.md +95 -0
  49. data/docs/preview.md +19 -0
  50. data/docs/project.md +121 -0
  51. data/docs/public_ip_address.md +13 -0
  52. data/docs/public_key.md +133 -0
  53. data/docs/remote_server.md +356 -0
  54. data/docs/request.md +100 -0
  55. data/docs/session.md +78 -0
  56. data/docs/site.md +448 -0
  57. data/docs/sso_strategy.md +114 -0
  58. data/docs/status.md +21 -0
  59. data/docs/style.md +93 -0
  60. data/docs/usage_daily_snapshot.md +45 -0
  61. data/docs/usage_snapshot.md +53 -0
  62. data/docs/user.md +535 -0
  63. data/docs/user_cipher_use.md +41 -0
  64. data/docs/user_request.md +93 -0
  65. data/files.com.gemspec +22 -0
  66. data/lib/files.com.rb +184 -0
  67. data/lib/files.com/api.rb +38 -0
  68. data/lib/files.com/api_client.rb +340 -0
  69. data/lib/files.com/errors.rb +41 -0
  70. data/lib/files.com/list.rb +95 -0
  71. data/lib/files.com/models/account_line_item.rb +82 -0
  72. data/lib/files.com/models/action.rb +77 -0
  73. data/lib/files.com/models/api_key.rb +270 -0
  74. data/lib/files.com/models/app.rb +101 -0
  75. data/lib/files.com/models/as2_key.rb +179 -0
  76. data/lib/files.com/models/auto.rb +17 -0
  77. data/lib/files.com/models/automation.rb +304 -0
  78. data/lib/files.com/models/behavior.rb +266 -0
  79. data/lib/files.com/models/bundle.rb +371 -0
  80. data/lib/files.com/models/bundle_download.rb +49 -0
  81. data/lib/files.com/models/clickwrap.rb +197 -0
  82. data/lib/files.com/models/dir.rb +3 -0
  83. data/lib/files.com/models/dns_record.rb +51 -0
  84. data/lib/files.com/models/errors.rb +22 -0
  85. data/lib/files.com/models/file.rb +968 -0
  86. data/lib/files.com/models/file_action.rb +126 -0
  87. data/lib/files.com/models/file_comment.rb +146 -0
  88. data/lib/files.com/models/file_comment_reaction.rb +100 -0
  89. data/lib/files.com/models/file_part_upload.rb +82 -0
  90. data/lib/files.com/models/file_utils.rb +118 -0
  91. data/lib/files.com/models/folder.rb +357 -0
  92. data/lib/files.com/models/group.rb +208 -0
  93. data/lib/files.com/models/group_user.rb +171 -0
  94. data/lib/files.com/models/history.rb +228 -0
  95. data/lib/files.com/models/history_export.rb +353 -0
  96. data/lib/files.com/models/image.rb +22 -0
  97. data/lib/files.com/models/invoice.rb +117 -0
  98. data/lib/files.com/models/invoice_line_item.rb +57 -0
  99. data/lib/files.com/models/ip_address.rb +66 -0
  100. data/lib/files.com/models/lock.rb +173 -0
  101. data/lib/files.com/models/message.rb +201 -0
  102. data/lib/files.com/models/message_comment.rb +165 -0
  103. data/lib/files.com/models/message_comment_reaction.rb +128 -0
  104. data/lib/files.com/models/message_reaction.rb +128 -0
  105. data/lib/files.com/models/notification.rb +263 -0
  106. data/lib/files.com/models/payment.rb +117 -0
  107. data/lib/files.com/models/payment_line_item.rb +37 -0
  108. data/lib/files.com/models/permission.rb +172 -0
  109. data/lib/files.com/models/preview.rb +37 -0
  110. data/lib/files.com/models/project.rb +140 -0
  111. data/lib/files.com/models/public_ip_address.rb +22 -0
  112. data/lib/files.com/models/public_key.rb +179 -0
  113. data/lib/files.com/models/remote_server.rb +680 -0
  114. data/lib/files.com/models/request.rb +179 -0
  115. data/lib/files.com/models/session.rb +247 -0
  116. data/lib/files.com/models/site.rb +733 -0
  117. data/lib/files.com/models/sso_strategy.rb +227 -0
  118. data/lib/files.com/models/status.rb +37 -0
  119. data/lib/files.com/models/style.rb +131 -0
  120. data/lib/files.com/models/usage_daily_snapshot.rb +66 -0
  121. data/lib/files.com/models/usage_snapshot.rb +96 -0
  122. data/lib/files.com/models/user.rb +876 -0
  123. data/lib/files.com/models/user_cipher_use.rb +63 -0
  124. data/lib/files.com/models/user_request.rb +127 -0
  125. data/lib/files.com/response.rb +25 -0
  126. data/lib/files.com/sizable_io.rb +32 -0
  127. data/lib/files.com/system_profiler.rb +56 -0
  128. data/lib/files.com/util.rb +106 -0
  129. data/lib/files.com/version.rb +5 -0
  130. data/spec/list_spec.rb +214 -0
  131. data/spec/models/file_spec.rb +68 -0
  132. data/spec/models/folder_spec.rb +40 -0
  133. data/spec/spec_helper.rb +36 -0
  134. data/test.sh +8 -0
  135. data/test/test.rb +75 -0
  136. metadata +235 -0
@@ -0,0 +1,353 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Files
4
+ class HistoryExport
5
+ attr_reader :options, :attributes
6
+
7
+ def initialize(attributes = {}, options = {})
8
+ @attributes = attributes || {}
9
+ @options = options || {}
10
+ end
11
+
12
+ # int64 - History Export ID
13
+ def id
14
+ @attributes[:id]
15
+ end
16
+
17
+ def id=(value)
18
+ @attributes[:id] = value
19
+ end
20
+
21
+ # date-time - Start date/time of export range.
22
+ def start_at
23
+ @attributes[:start_at]
24
+ end
25
+
26
+ def start_at=(value)
27
+ @attributes[:start_at] = value
28
+ end
29
+
30
+ # date-time - End date/time of export range.
31
+ def end_at
32
+ @attributes[:end_at]
33
+ end
34
+
35
+ def end_at=(value)
36
+ @attributes[:end_at] = value
37
+ end
38
+
39
+ # string - Status of export. Will be: `building` or `ready`
40
+ def status
41
+ @attributes[:status]
42
+ end
43
+
44
+ def status=(value)
45
+ @attributes[:status] = value
46
+ end
47
+
48
+ # string - Filter results by this this action type. Valid values: `create`, `read`, `update`, `destroy`, `move`, `login`, `failedlogin`, `copy`, `user_create`, `user_update`, `user_destroy`, `group_create`, `group_update`, `group_destroy`, `permission_create`, `permission_destroy`, `api_key_create`, `api_key_update`, `api_key_destroy`
49
+ def query_action
50
+ @attributes[:query_action]
51
+ end
52
+
53
+ def query_action=(value)
54
+ @attributes[:query_action] = value
55
+ end
56
+
57
+ # string - Filter results by this this interface type. Valid values: `web`, `ftp`, `robot`, `jsapi`, `webdesktopapi`, `sftp`, `dav`, `desktop`, `restapi`, `scim`
58
+ def query_interface
59
+ @attributes[:query_interface]
60
+ end
61
+
62
+ def query_interface=(value)
63
+ @attributes[:query_interface] = value
64
+ end
65
+
66
+ # int64 - Return results that are actions performed by the user indiciated by this User ID
67
+ def query_user_id
68
+ @attributes[:query_user_id]
69
+ end
70
+
71
+ def query_user_id=(value)
72
+ @attributes[:query_user_id] = value
73
+ end
74
+
75
+ # int64 - Return results that are file actions related to the file indicated by this File ID
76
+ def query_file_id
77
+ @attributes[:query_file_id]
78
+ end
79
+
80
+ def query_file_id=(value)
81
+ @attributes[:query_file_id] = value
82
+ end
83
+
84
+ # int64 - Return results that are file actions inside the parent folder specified by this folder ID
85
+ def query_parent_id
86
+ @attributes[:query_parent_id]
87
+ end
88
+
89
+ def query_parent_id=(value)
90
+ @attributes[:query_parent_id] = value
91
+ end
92
+
93
+ # string - Return results that are file actions related to this path.
94
+ def query_path
95
+ @attributes[:query_path]
96
+ end
97
+
98
+ def query_path=(value)
99
+ @attributes[:query_path] = value
100
+ end
101
+
102
+ # string - Return results that are file actions related to files or folders inside this folder path.
103
+ def query_folder
104
+ @attributes[:query_folder]
105
+ end
106
+
107
+ def query_folder=(value)
108
+ @attributes[:query_folder] = value
109
+ end
110
+
111
+ # string - Return results that are file moves originating from this path.
112
+ def query_src
113
+ @attributes[:query_src]
114
+ end
115
+
116
+ def query_src=(value)
117
+ @attributes[:query_src] = value
118
+ end
119
+
120
+ # string - Return results that are file moves with this path as destination.
121
+ def query_destination
122
+ @attributes[:query_destination]
123
+ end
124
+
125
+ def query_destination=(value)
126
+ @attributes[:query_destination] = value
127
+ end
128
+
129
+ # string - Filter results by this IP address.
130
+ def query_ip
131
+ @attributes[:query_ip]
132
+ end
133
+
134
+ def query_ip=(value)
135
+ @attributes[:query_ip] = value
136
+ end
137
+
138
+ # string - Filter results by this username.
139
+ def query_username
140
+ @attributes[:query_username]
141
+ end
142
+
143
+ def query_username=(value)
144
+ @attributes[:query_username] = value
145
+ end
146
+
147
+ # string - If searching for Histories about login failures, this parameter restricts results to failures of this specific type. Valid values: `expired_trial`, `account_overdue`, `locked_out`, `ip_mismatch`, `password_mismatch`, `site_mismatch`, `username_not_found`, `none`, `no_ftp_permission`, `no_web_permission`, `no_directory`, `errno_enoent`, `no_sftp_permission`, `no_dav_permission`, `no_restapi_permission`, `key_mismatch`, `region_mismatch`, `expired_access`, `desktop_ip_mismatch`, `desktop_api_key_not_used_quickly_enough`, `disabled`
148
+ def query_failure_type
149
+ @attributes[:query_failure_type]
150
+ end
151
+
152
+ def query_failure_type=(value)
153
+ @attributes[:query_failure_type] = value
154
+ end
155
+
156
+ # int64 - If searching for Histories about specific objects (such as Users, or API Keys), this paremeter restricts results to objects that match this ID.
157
+ def query_target_id
158
+ @attributes[:query_target_id]
159
+ end
160
+
161
+ def query_target_id=(value)
162
+ @attributes[:query_target_id] = value
163
+ end
164
+
165
+ # string - If searching for Histories about Users, Groups or other objects with names, this parameter restricts results to objects with this name/username.
166
+ def query_target_name
167
+ @attributes[:query_target_name]
168
+ end
169
+
170
+ def query_target_name=(value)
171
+ @attributes[:query_target_name] = value
172
+ end
173
+
174
+ # string - If searching for Histories about Permisisons, this parameter restricts results to permissions of this level.
175
+ def query_target_permission
176
+ @attributes[:query_target_permission]
177
+ end
178
+
179
+ def query_target_permission=(value)
180
+ @attributes[:query_target_permission] = value
181
+ end
182
+
183
+ # int64 - If searching for Histories about API keys, this parameter restricts results to API keys created by/for this user ID.
184
+ def query_target_user_id
185
+ @attributes[:query_target_user_id]
186
+ end
187
+
188
+ def query_target_user_id=(value)
189
+ @attributes[:query_target_user_id] = value
190
+ end
191
+
192
+ # string - If searching for Histories about API keys, this parameter restricts results to API keys created by/for this username.
193
+ def query_target_username
194
+ @attributes[:query_target_username]
195
+ end
196
+
197
+ def query_target_username=(value)
198
+ @attributes[:query_target_username] = value
199
+ end
200
+
201
+ # string - If searching for Histories about API keys, this parameter restricts results to API keys associated with this platform.
202
+ def query_target_platform
203
+ @attributes[:query_target_platform]
204
+ end
205
+
206
+ def query_target_platform=(value)
207
+ @attributes[:query_target_platform] = value
208
+ end
209
+
210
+ # string - If searching for Histories about API keys, this parameter restricts results to API keys with this permission set.
211
+ def query_target_permission_set
212
+ @attributes[:query_target_permission_set]
213
+ end
214
+
215
+ def query_target_permission_set=(value)
216
+ @attributes[:query_target_permission_set] = value
217
+ end
218
+
219
+ # int64 - User ID. Provide a value of `0` to operate the current session's user.
220
+ def user_id
221
+ @attributes[:user_id]
222
+ end
223
+
224
+ def user_id=(value)
225
+ @attributes[:user_id] = value
226
+ end
227
+
228
+ def delete(params = {})
229
+ params ||= {}
230
+ params[:id] = @attributes[:id]
231
+ raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
232
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
233
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
234
+
235
+ Api.send_request("/history_exports/#{@attributes[:id]}", :delete, params, @options)
236
+ end
237
+
238
+ def destroy(params = {})
239
+ delete(params)
240
+ end
241
+
242
+ def save
243
+ if @attributes[:id]
244
+ raise NotImplementedError.new("The HistoryExport object doesn't support updates.")
245
+ else
246
+ new_obj = HistoryExport.create(@attributes, @options)
247
+ @attributes = new_obj.attributes
248
+ end
249
+ end
250
+
251
+ # Parameters:
252
+ # user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
253
+ # page - int64 - Current page number.
254
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
255
+ # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
256
+ def self.list(params = {}, options = {})
257
+ raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params.dig(:user_id) and !params.dig(:user_id).is_a?(Integer)
258
+ raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
259
+ raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
260
+ raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
261
+
262
+ response, options = Api.send_request("/history_exports", :get, params, options)
263
+ response.data.map do |entity_data|
264
+ HistoryExport.new(entity_data, options)
265
+ end
266
+ end
267
+
268
+ def self.all(params = {}, options = {})
269
+ list(params, options)
270
+ end
271
+
272
+ # Parameters:
273
+ # id (required) - int64 - History Export ID.
274
+ def self.find(id, params = {}, options = {})
275
+ params ||= {}
276
+ params[:id] = id
277
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
278
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
279
+
280
+ response, options = Api.send_request("/history_exports/#{params[:id]}", :get, params, options)
281
+ HistoryExport.new(response.data, options)
282
+ end
283
+
284
+ def self.get(id, params = {}, options = {})
285
+ find(id, params, options)
286
+ end
287
+
288
+ # Parameters:
289
+ # user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
290
+ # start_at - string - Start date/time of export range.
291
+ # end_at - string - End date/time of export range.
292
+ # query_action - string - Filter results by this this action type. Valid values: `create`, `read`, `update`, `destroy`, `move`, `login`, `failedlogin`, `copy`, `user_create`, `user_update`, `user_destroy`, `group_create`, `group_update`, `group_destroy`, `permission_create`, `permission_destroy`, `api_key_create`, `api_key_update`, `api_key_destroy`
293
+ # query_interface - string - Filter results by this this interface type. Valid values: `web`, `ftp`, `robot`, `jsapi`, `webdesktopapi`, `sftp`, `dav`, `desktop`, `restapi`, `scim`
294
+ # query_user_id - int64 - Return results that are actions performed by the user indiciated by this User ID
295
+ # query_file_id - int64 - Return results that are file actions related to the file indicated by this File ID
296
+ # query_parent_id - int64 - Return results that are file actions inside the parent folder specified by this folder ID
297
+ # query_path - string - Return results that are file actions related to this path.
298
+ # query_folder - string - Return results that are file actions related to files or folders inside this folder path.
299
+ # query_src - string - Return results that are file moves originating from this path.
300
+ # query_destination - string - Return results that are file moves with this path as destination.
301
+ # query_ip - string - Filter results by this IP address.
302
+ # query_username - string - Filter results by this username.
303
+ # query_failure_type - string - If searching for Histories about login failures, this parameter restricts results to failures of this specific type. Valid values: `expired_trial`, `account_overdue`, `locked_out`, `ip_mismatch`, `password_mismatch`, `site_mismatch`, `username_not_found`, `none`, `no_ftp_permission`, `no_web_permission`, `no_directory`, `errno_enoent`, `no_sftp_permission`, `no_dav_permission`, `no_restapi_permission`, `key_mismatch`, `region_mismatch`, `expired_access`, `desktop_ip_mismatch`, `desktop_api_key_not_used_quickly_enough`, `disabled`
304
+ # query_target_id - int64 - If searching for Histories about specific objects (such as Users, or API Keys), this paremeter restricts results to objects that match this ID.
305
+ # query_target_name - string - If searching for Histories about Users, Groups or other objects with names, this parameter restricts results to objects with this name/username.
306
+ # query_target_permission - string - If searching for Histories about Permisisons, this parameter restricts results to permissions of this level.
307
+ # query_target_user_id - int64 - If searching for Histories about API keys, this parameter restricts results to API keys created by/for this user ID.
308
+ # query_target_username - string - If searching for Histories about API keys, this parameter restricts results to API keys created by/for this username.
309
+ # query_target_platform - string - If searching for Histories about API keys, this parameter restricts results to API keys associated with this platform.
310
+ # query_target_permission_set - string - If searching for Histories about API keys, this parameter restricts results to API keys with this permission set.
311
+ def self.create(params = {}, options = {})
312
+ raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params.dig(:user_id) and !params.dig(:user_id).is_a?(Integer)
313
+ raise InvalidParameterError.new("Bad parameter: start_at must be an String") if params.dig(:start_at) and !params.dig(:start_at).is_a?(String)
314
+ raise InvalidParameterError.new("Bad parameter: end_at must be an String") if params.dig(:end_at) and !params.dig(:end_at).is_a?(String)
315
+ raise InvalidParameterError.new("Bad parameter: query_action must be an String") if params.dig(:query_action) and !params.dig(:query_action).is_a?(String)
316
+ raise InvalidParameterError.new("Bad parameter: query_interface must be an String") if params.dig(:query_interface) and !params.dig(:query_interface).is_a?(String)
317
+ raise InvalidParameterError.new("Bad parameter: query_user_id must be an Integer") if params.dig(:query_user_id) and !params.dig(:query_user_id).is_a?(Integer)
318
+ raise InvalidParameterError.new("Bad parameter: query_file_id must be an Integer") if params.dig(:query_file_id) and !params.dig(:query_file_id).is_a?(Integer)
319
+ raise InvalidParameterError.new("Bad parameter: query_parent_id must be an Integer") if params.dig(:query_parent_id) and !params.dig(:query_parent_id).is_a?(Integer)
320
+ raise InvalidParameterError.new("Bad parameter: query_path must be an String") if params.dig(:query_path) and !params.dig(:query_path).is_a?(String)
321
+ raise InvalidParameterError.new("Bad parameter: query_folder must be an String") if params.dig(:query_folder) and !params.dig(:query_folder).is_a?(String)
322
+ raise InvalidParameterError.new("Bad parameter: query_src must be an String") if params.dig(:query_src) and !params.dig(:query_src).is_a?(String)
323
+ raise InvalidParameterError.new("Bad parameter: query_destination must be an String") if params.dig(:query_destination) and !params.dig(:query_destination).is_a?(String)
324
+ raise InvalidParameterError.new("Bad parameter: query_ip must be an String") if params.dig(:query_ip) and !params.dig(:query_ip).is_a?(String)
325
+ raise InvalidParameterError.new("Bad parameter: query_username must be an String") if params.dig(:query_username) and !params.dig(:query_username).is_a?(String)
326
+ raise InvalidParameterError.new("Bad parameter: query_failure_type must be an String") if params.dig(:query_failure_type) and !params.dig(:query_failure_type).is_a?(String)
327
+ raise InvalidParameterError.new("Bad parameter: query_target_id must be an Integer") if params.dig(:query_target_id) and !params.dig(:query_target_id).is_a?(Integer)
328
+ raise InvalidParameterError.new("Bad parameter: query_target_name must be an String") if params.dig(:query_target_name) and !params.dig(:query_target_name).is_a?(String)
329
+ raise InvalidParameterError.new("Bad parameter: query_target_permission must be an String") if params.dig(:query_target_permission) and !params.dig(:query_target_permission).is_a?(String)
330
+ raise InvalidParameterError.new("Bad parameter: query_target_user_id must be an Integer") if params.dig(:query_target_user_id) and !params.dig(:query_target_user_id).is_a?(Integer)
331
+ raise InvalidParameterError.new("Bad parameter: query_target_username must be an String") if params.dig(:query_target_username) and !params.dig(:query_target_username).is_a?(String)
332
+ raise InvalidParameterError.new("Bad parameter: query_target_platform must be an String") if params.dig(:query_target_platform) and !params.dig(:query_target_platform).is_a?(String)
333
+ raise InvalidParameterError.new("Bad parameter: query_target_permission_set must be an String") if params.dig(:query_target_permission_set) and !params.dig(:query_target_permission_set).is_a?(String)
334
+
335
+ response, options = Api.send_request("/history_exports", :post, params, options)
336
+ HistoryExport.new(response.data, options)
337
+ end
338
+
339
+ def self.delete(id, params = {}, options = {})
340
+ params ||= {}
341
+ params[:id] = id
342
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
343
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
344
+
345
+ response, _options = Api.send_request("/history_exports/#{params[:id]}", :delete, params, options)
346
+ response.data
347
+ end
348
+
349
+ def self.destroy(id, params = {}, options = {})
350
+ delete(id, params, options)
351
+ end
352
+ end
353
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Files
4
+ class Image
5
+ attr_reader :options, :attributes
6
+
7
+ def initialize(attributes = {}, options = {})
8
+ @attributes = attributes || {}
9
+ @options = options || {}
10
+ end
11
+
12
+ # string - Image name
13
+ def name
14
+ @attributes[:name]
15
+ end
16
+
17
+ # string - Image URI
18
+ def uri
19
+ @attributes[:uri]
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,117 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Files
4
+ class Invoice
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("/invoices", :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 - Invoice 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("/invoices/#{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