files.com 1.0.100 → 1.0.105

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/_VERSION +1 -1
  3. data/docs/api_key.md +18 -2
  4. data/docs/as2_key.md +1 -0
  5. data/docs/bandwidth_snapshot.md +8 -0
  6. data/docs/bundle_download.md +1 -0
  7. data/docs/bundle_recipient.md +1 -0
  8. data/docs/clickwrap.md +1 -0
  9. data/docs/dns_record.md +1 -0
  10. data/docs/external_event.md +43 -0
  11. data/docs/file_comment.md +1 -0
  12. data/docs/file_part_upload.md +2 -0
  13. data/docs/folder.md +1 -1
  14. data/docs/group_user.md +1 -0
  15. data/docs/history_export.md +23 -69
  16. data/docs/history_export_result.md +79 -0
  17. data/docs/invoice.md +1 -0
  18. data/docs/ip_address.md +2 -0
  19. data/docs/lock.md +1 -0
  20. data/docs/message.md +1 -0
  21. data/docs/message_comment.md +1 -0
  22. data/docs/message_comment_reaction.md +1 -0
  23. data/docs/message_reaction.md +1 -0
  24. data/docs/payment.md +1 -0
  25. data/docs/permission.md +17 -2
  26. data/docs/project.md +1 -0
  27. data/docs/public_key.md +1 -0
  28. data/docs/remote_server.md +1 -0
  29. data/docs/request.md +19 -3
  30. data/docs/session.md +10 -2
  31. data/docs/site.md +18 -2
  32. data/docs/sso_strategy.md +1 -0
  33. data/docs/usage_snapshot.md +1 -0
  34. data/docs/user_cipher_use.md +1 -0
  35. data/docs/user_request.md +3 -0
  36. data/lib/files.com.rb +2 -0
  37. data/lib/files.com/api_client.rb +2 -1
  38. data/lib/files.com/models/api_key.rb +12 -0
  39. data/lib/files.com/models/as2_key.rb +4 -3
  40. data/lib/files.com/models/bandwidth_snapshot.rb +18 -3
  41. data/lib/files.com/models/bundle_download.rb +4 -3
  42. data/lib/files.com/models/bundle_recipient.rb +4 -3
  43. data/lib/files.com/models/clickwrap.rb +4 -3
  44. data/lib/files.com/models/dns_record.rb +4 -3
  45. data/lib/files.com/models/external_event.rb +66 -0
  46. data/lib/files.com/models/file.rb +6 -10
  47. data/lib/files.com/models/file_comment.rb +4 -3
  48. data/lib/files.com/models/file_part_upload.rb +5 -0
  49. data/lib/files.com/models/folder.rb +4 -8
  50. data/lib/files.com/models/group_user.rb +4 -3
  51. data/lib/files.com/models/history_export.rb +24 -64
  52. data/lib/files.com/models/history_export_result.rb +152 -0
  53. data/lib/files.com/models/invoice.rb +4 -3
  54. data/lib/files.com/models/ip_address.rb +8 -6
  55. data/lib/files.com/models/lock.rb +6 -9
  56. data/lib/files.com/models/message.rb +4 -3
  57. data/lib/files.com/models/message_comment.rb +4 -3
  58. data/lib/files.com/models/message_comment_reaction.rb +4 -3
  59. data/lib/files.com/models/message_reaction.rb +4 -3
  60. data/lib/files.com/models/payment.rb +4 -3
  61. data/lib/files.com/models/permission.rb +19 -11
  62. data/lib/files.com/models/project.rb +4 -3
  63. data/lib/files.com/models/public_key.rb +4 -3
  64. data/lib/files.com/models/remote_server.rb +4 -3
  65. data/lib/files.com/models/request.rb +20 -12
  66. data/lib/files.com/models/session.rb +6 -0
  67. data/lib/files.com/models/site.rb +12 -0
  68. data/lib/files.com/models/sso_strategy.rb +4 -3
  69. data/lib/files.com/models/usage_snapshot.rb +4 -3
  70. data/lib/files.com/models/user_cipher_use.rb +4 -3
  71. data/lib/files.com/models/user_request.rb +13 -3
  72. metadata +6 -2
@@ -83,14 +83,15 @@ module Files
83
83
  # page - int64 - Current page number.
84
84
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
85
85
  # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
86
+ # 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.
86
87
  def self.list(params = {}, options = {})
87
88
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
88
89
  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
90
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
91
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
90
92
 
91
- response, options = Api.send_request("/invoices", :get, params, options)
92
- response.data.map do |entity_data|
93
- AccountLineItem.new(entity_data, options)
93
+ List.new(AccountLineItem, params) do
94
+ Api.send_request("/invoices", :get, params, options)
94
95
  end
95
96
  end
96
97
 
@@ -33,14 +33,15 @@ module Files
33
33
  # page - int64 - Current page number.
34
34
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
35
35
  # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
36
+ # 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.
36
37
  def self.list(params = {}, options = {})
37
38
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
38
39
  raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
39
40
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
41
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
40
42
 
41
- response, options = Api.send_request("/ip_addresses", :get, params, options)
42
- response.data.map do |entity_data|
43
- IpAddress.new(entity_data, options)
43
+ List.new(IpAddress, params) do
44
+ Api.send_request("/ip_addresses", :get, params, options)
44
45
  end
45
46
  end
46
47
 
@@ -52,14 +53,15 @@ module Files
52
53
  # page - int64 - Current page number.
53
54
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
54
55
  # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
56
+ # 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.
55
57
  def self.get_reserved(params = {}, options = {})
56
58
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
57
59
  raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
58
60
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
61
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
59
62
 
60
- response, options = Api.send_request("/ip_addresses/reserved", :get, params, options)
61
- response.data.map do |entity_data|
62
- PublicIpAddress.new(entity_data, options)
63
+ List.new(PublicIpAddress, params) do
64
+ Api.send_request("/ip_addresses/reserved", :get, params, options)
63
65
  end
64
66
  end
65
67
  end
@@ -109,18 +109,15 @@ module Files
109
109
  end
110
110
 
111
111
  def save
112
- if @attributes[:path]
113
- raise NotImplementedError.new("The Lock object doesn't support updates.")
114
- else
115
- new_obj = Lock.create(@attributes, @options)
116
- @attributes = new_obj.attributes
117
- end
112
+ new_obj = Lock.create(path, @attributes, @options)
113
+ @attributes = new_obj.attributes
118
114
  end
119
115
 
120
116
  # Parameters:
121
117
  # page - int64 - Current page number.
122
118
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
123
119
  # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
120
+ # 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.
124
121
  # path (required) - string - Path to operate on.
125
122
  # include_children - boolean - Include locks from children objects?
126
123
  def self.list_for(path, params = {}, options = {})
@@ -129,12 +126,12 @@ module Files
129
126
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
130
127
  raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
131
128
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
129
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
132
130
  raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
133
131
  raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
134
132
 
135
- response, options = Api.send_request("/locks/#{params[:path]}", :get, params, options)
136
- response.data.map do |entity_data|
137
- Lock.new(entity_data, options)
133
+ List.new(Lock, params) do
134
+ Api.send_request("/locks/#{params[:path]}", :get, params, options)
138
135
  end
139
136
  end
140
137
 
@@ -111,18 +111,19 @@ module Files
111
111
  # page - int64 - Current page number.
112
112
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
113
113
  # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
114
+ # 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.
114
115
  # project_id (required) - int64 - Project for which to return messages.
115
116
  def self.list(params = {}, options = {})
116
117
  raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params.dig(:user_id) and !params.dig(:user_id).is_a?(Integer)
117
118
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
118
119
  raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
119
120
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
121
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
120
122
  raise InvalidParameterError.new("Bad parameter: project_id must be an Integer") if params.dig(:project_id) and !params.dig(:project_id).is_a?(Integer)
121
123
  raise MissingParameterError.new("Parameter missing: project_id") unless params.dig(:project_id)
122
124
 
123
- response, options = Api.send_request("/messages", :get, params, options)
124
- response.data.map do |entity_data|
125
- Message.new(entity_data, options)
125
+ List.new(Message, params) do
126
+ Api.send_request("/messages", :get, params, options)
126
127
  end
127
128
  end
128
129
 
@@ -87,18 +87,19 @@ module Files
87
87
  # page - int64 - Current page number.
88
88
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
89
89
  # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
90
+ # 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.
90
91
  # message_id (required) - int64 - Message comment to return comments for.
91
92
  def self.list(params = {}, options = {})
92
93
  raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params.dig(:user_id) and !params.dig(:user_id).is_a?(Integer)
93
94
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
94
95
  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
96
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
97
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
96
98
  raise InvalidParameterError.new("Bad parameter: message_id must be an Integer") if params.dig(:message_id) and !params.dig(:message_id).is_a?(Integer)
97
99
  raise MissingParameterError.new("Parameter missing: message_id") unless params.dig(:message_id)
98
100
 
99
- response, options = Api.send_request("/message_comments", :get, params, options)
100
- response.data.map do |entity_data|
101
- MessageComment.new(entity_data, options)
101
+ List.new(MessageComment, params) do
102
+ Api.send_request("/message_comments", :get, params, options)
102
103
  end
103
104
  end
104
105
 
@@ -64,18 +64,19 @@ module Files
64
64
  # page - int64 - Current page number.
65
65
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
66
66
  # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
67
+ # 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.
67
68
  # message_comment_id (required) - int64 - Message comment to return reactions for.
68
69
  def self.list(params = {}, options = {})
69
70
  raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params.dig(:user_id) and !params.dig(:user_id).is_a?(Integer)
70
71
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
71
72
  raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
72
73
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
74
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
73
75
  raise InvalidParameterError.new("Bad parameter: message_comment_id must be an Integer") if params.dig(:message_comment_id) and !params.dig(:message_comment_id).is_a?(Integer)
74
76
  raise MissingParameterError.new("Parameter missing: message_comment_id") unless params.dig(:message_comment_id)
75
77
 
76
- response, options = Api.send_request("/message_comment_reactions", :get, params, options)
77
- response.data.map do |entity_data|
78
- MessageCommentReaction.new(entity_data, options)
78
+ List.new(MessageCommentReaction, params) do
79
+ Api.send_request("/message_comment_reactions", :get, params, options)
79
80
  end
80
81
  end
81
82
 
@@ -64,18 +64,19 @@ module Files
64
64
  # page - int64 - Current page number.
65
65
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
66
66
  # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
67
+ # 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.
67
68
  # message_id (required) - int64 - Message to return reactions for.
68
69
  def self.list(params = {}, options = {})
69
70
  raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params.dig(:user_id) and !params.dig(:user_id).is_a?(Integer)
70
71
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
71
72
  raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
72
73
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
74
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
73
75
  raise InvalidParameterError.new("Bad parameter: message_id must be an Integer") if params.dig(:message_id) and !params.dig(:message_id).is_a?(Integer)
74
76
  raise MissingParameterError.new("Parameter missing: message_id") unless params.dig(:message_id)
75
77
 
76
- response, options = Api.send_request("/message_reactions", :get, params, options)
77
- response.data.map do |entity_data|
78
- MessageReaction.new(entity_data, options)
78
+ List.new(MessageReaction, params) do
79
+ Api.send_request("/message_reactions", :get, params, options)
79
80
  end
80
81
  end
81
82
 
@@ -83,14 +83,15 @@ module Files
83
83
  # page - int64 - Current page number.
84
84
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
85
85
  # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
86
+ # 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.
86
87
  def self.list(params = {}, options = {})
87
88
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
88
89
  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
90
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
91
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
90
92
 
91
- response, options = Api.send_request("/payments", :get, params, options)
92
- response.data.map do |entity_data|
93
- AccountLineItem.new(entity_data, options)
93
+ List.new(AccountLineItem, params) do
94
+ Api.send_request("/payments", :get, params, options)
94
95
  end
95
96
  end
96
97
 
@@ -81,8 +81,22 @@ module Files
81
81
  @attributes[:recursive] = value
82
82
  end
83
83
 
84
+ def delete(params = {})
85
+ params ||= {}
86
+ params[:id] = @attributes[:id]
87
+ raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
88
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
89
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
90
+
91
+ Api.send_request("/permissions/#{@attributes[:id]}", :delete, params, @options)
92
+ end
93
+
94
+ def destroy(params = {})
95
+ delete(params)
96
+ end
97
+
84
98
  def save
85
- if @attributes[:path]
99
+ if @attributes[:id]
86
100
  raise NotImplementedError.new("The Permission object doesn't support updates.")
87
101
  else
88
102
  new_obj = Permission.create(@attributes, @options)
@@ -106,9 +120,7 @@ module Files
106
120
  # group_id - string - DEPRECATED: Group ID. If provided, will scope permissions to this group. Use `filter[group_id]` instead.`
107
121
  # user_id - string - DEPRECATED: User ID. If provided, will scope permissions to this user. Use `filter[user_id]` instead.`
108
122
  # 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
123
+ def self.list(params = {}, options = {})
112
124
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
113
125
  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
126
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
@@ -129,8 +141,8 @@ module Files
129
141
  end
130
142
  end
131
143
 
132
- def self.all(path, params = {}, options = {})
133
- list(path, params, options)
144
+ def self.all(params = {}, options = {})
145
+ list(params, options)
134
146
  end
135
147
 
136
148
  # Parameters:
@@ -140,9 +152,7 @@ module Files
140
152
  # recursive - boolean - Apply to subfolders recursively?
141
153
  # user_id - int64 - User ID. Provide `username` or `user_id`
142
154
  # username - string - User username. Provide `username` or `user_id`
143
- def self.create(path, params = {}, options = {})
144
- params ||= {}
145
- params[:path] = path
155
+ def self.create(params = {}, options = {})
146
156
  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
157
  raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
148
158
  raise InvalidParameterError.new("Bad parameter: permission must be an String") if params.dig(:permission) and !params.dig(:permission).is_a?(String)
@@ -153,8 +163,6 @@ module Files
153
163
  Permission.new(response.data, options)
154
164
  end
155
165
 
156
- # Parameters:
157
- # id (required) - int64 - Permission ID.
158
166
  def self.delete(id, params = {}, options = {})
159
167
  params ||= {}
160
168
  params[:id] = id
@@ -68,14 +68,15 @@ module Files
68
68
  # page - int64 - Current page number.
69
69
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
70
70
  # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
71
+ # 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.
71
72
  def self.list(params = {}, options = {})
72
73
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
73
74
  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
75
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
76
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
75
77
 
76
- response, options = Api.send_request("/projects", :get, params, options)
77
- response.data.map do |entity_data|
78
- Project.new(entity_data, options)
78
+ List.new(Project, params) do
79
+ Api.send_request("/projects", :get, params, options)
79
80
  end
80
81
  end
81
82
 
@@ -101,15 +101,16 @@ module Files
101
101
  # page - int64 - Current page number.
102
102
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
103
103
  # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
104
+ # 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.
104
105
  def self.list(params = {}, options = {})
105
106
  raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params.dig(:user_id) and !params.dig(:user_id).is_a?(Integer)
106
107
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
107
108
  raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
108
109
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
110
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
109
111
 
110
- response, options = Api.send_request("/public_keys", :get, params, options)
111
- response.data.map do |entity_data|
112
- PublicKey.new(entity_data, options)
112
+ List.new(PublicKey, params) do
113
+ Api.send_request("/public_keys", :get, params, options)
113
114
  end
114
115
  end
115
116
 
@@ -476,14 +476,15 @@ module Files
476
476
  # page - int64 - Current page number.
477
477
  # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
478
478
  # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
479
+ # 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.
479
480
  def self.list(params = {}, options = {})
480
481
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
481
482
  raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
482
483
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
484
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
483
485
 
484
- response, options = Api.send_request("/remote_servers", :get, params, options)
485
- response.data.map do |entity_data|
486
- RemoteServer.new(entity_data, options)
486
+ List.new(RemoteServer, params) do
487
+ Api.send_request("/remote_servers", :get, params, options)
487
488
  end
488
489
  end
489
490
 
@@ -81,8 +81,22 @@ module Files
81
81
  @attributes[:group_ids] = value
82
82
  end
83
83
 
84
+ def delete(params = {})
85
+ params ||= {}
86
+ params[:id] = @attributes[:id]
87
+ raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
88
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
89
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
90
+
91
+ Api.send_request("/requests/#{@attributes[:id]}", :delete, params, @options)
92
+ end
93
+
94
+ def destroy(params = {})
95
+ delete(params)
96
+ end
97
+
84
98
  def save
85
- if @attributes[:path]
99
+ if @attributes[:id]
86
100
  raise NotImplementedError.new("The Request object doesn't support updates.")
87
101
  else
88
102
  new_obj = Request.create(@attributes, @options)
@@ -98,9 +112,7 @@ module Files
98
112
  # 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 `site_id`, `folder_id` or `destination`.
99
113
  # mine - boolean - Only show requests of the current user? (Defaults to true if current user is not a site admin.)
100
114
  # path - string - Path to show requests for. If omitted, shows all paths. Send `/` to represent the root directory.
101
- def self.list(path, params = {}, options = {})
102
- params ||= {}
103
- params[:path] = path
115
+ def self.list(params = {}, options = {})
104
116
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
105
117
  raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
106
118
  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
@@ -113,8 +125,8 @@ module Files
113
125
  end
114
126
  end
115
127
 
116
- def self.all(path, params = {}, options = {})
117
- list(path, params, options)
128
+ def self.all(params = {}, options = {})
129
+ list(params, options)
118
130
  end
119
131
 
120
132
  # Parameters:
@@ -125,7 +137,7 @@ module Files
125
137
  # 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 `site_id`, `folder_id` or `destination`.
126
138
  # mine - boolean - Only show requests of the current user? (Defaults to true if current user is not a site admin.)
127
139
  # path (required) - string - Path to show requests for. If omitted, shows all paths. Send `/` to represent the root directory.
128
- def self.find_folder(path, params = {}, options = {})
140
+ def self.get_folder(path, params = {}, options = {})
129
141
  params ||= {}
130
142
  params[:path] = path
131
143
  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
@@ -146,9 +158,7 @@ module Files
146
158
  # destination (required) - string - Destination filename (without extension) to request.
147
159
  # user_ids - string - A list of user IDs to request the file from. If sent as a string, it should be comma-delimited.
148
160
  # group_ids - string - A list of group IDs to request the file from. If sent as a string, it should be comma-delimited.
149
- def self.create(path, params = {}, options = {})
150
- params ||= {}
151
- params[:path] = path
161
+ def self.create(params = {}, options = {})
152
162
  raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
153
163
  raise InvalidParameterError.new("Bad parameter: destination must be an String") if params.dig(:destination) and !params.dig(:destination).is_a?(String)
154
164
  raise InvalidParameterError.new("Bad parameter: user_ids must be an String") if params.dig(:user_ids) and !params.dig(:user_ids).is_a?(String)
@@ -160,8 +170,6 @@ module Files
160
170
  Request.new(response.data, options)
161
171
  end
162
172
 
163
- # Parameters:
164
- # id (required) - int64 - Request ID.
165
173
  def self.delete(id, params = {}, options = {})
166
174
  params ||= {}
167
175
  params[:id] = id
@@ -235,7 +235,13 @@ module Files
235
235
  Session.new(response.data, options)
236
236
  end
237
237
 
238
+ # Parameters:
239
+ # format - string
240
+ # session - object
238
241
  def self.delete(params = {}, options = {})
242
+ raise InvalidParameterError.new("Bad parameter: format must be an String") if params.dig(:format) and !params.dig(:format).is_a?(String)
243
+ raise InvalidParameterError.new("Bad parameter: session must be an Hash") if params.dig(:session) and !params.dig(:session).is_a?(Hash)
244
+
239
245
  response, _options = Api.send_request("/sessions", :delete, params, options)
240
246
  response.data
241
247
  end
@@ -559,12 +559,24 @@ module Files
559
559
  @attributes[:disable_users_from_inactivity_period_days]
560
560
  end
561
561
 
562
+ # Parameters:
563
+ # format - string
564
+ # site - object
562
565
  def self.get(params = {}, options = {})
566
+ raise InvalidParameterError.new("Bad parameter: format must be an String") if params.dig(:format) and !params.dig(:format).is_a?(String)
567
+ raise InvalidParameterError.new("Bad parameter: site must be an Hash") if params.dig(:site) and !params.dig(:site).is_a?(Hash)
568
+
563
569
  response, options = Api.send_request("/site", :get, params, options)
564
570
  Site.new(response.data, options)
565
571
  end
566
572
 
573
+ # Parameters:
574
+ # format - string
575
+ # site - object
567
576
  def self.get_usage(params = {}, options = {})
577
+ raise InvalidParameterError.new("Bad parameter: format must be an String") if params.dig(:format) and !params.dig(:format).is_a?(String)
578
+ raise InvalidParameterError.new("Bad parameter: site must be an Hash") if params.dig(:site) and !params.dig(:site).is_a?(Hash)
579
+
568
580
  response, options = Api.send_request("/site/usage", :get, params, options)
569
581
  UsageSnapshot.new(response.data, options)
570
582
  end