files.com 1.1.767 → 1.1.769

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.
Files changed (140) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +47 -7
  4. data/_VERSION +1 -1
  5. data/docs/event_record.md +2 -2
  6. data/docs/event_subscription.md +8 -8
  7. data/docs/file.md +37 -0
  8. data/docs/public_key.md +1 -1
  9. data/lib/files.com/api.rb +9 -4
  10. data/lib/files.com/api_client.rb +181 -55
  11. data/lib/files.com/list.rb +98 -66
  12. data/lib/files.com/models/action_log.rb +2 -2
  13. data/lib/files.com/models/action_notification_export.rb +3 -3
  14. data/lib/files.com/models/action_notification_export_result.rb +2 -2
  15. data/lib/files.com/models/ai_assistant_personality.rb +10 -8
  16. data/lib/files.com/models/ai_task.rb +10 -8
  17. data/lib/files.com/models/api_key.rb +12 -10
  18. data/lib/files.com/models/api_request_log.rb +2 -2
  19. data/lib/files.com/models/app.rb +2 -2
  20. data/lib/files.com/models/as2_incoming_message.rb +2 -2
  21. data/lib/files.com/models/as2_outgoing_message.rb +2 -2
  22. data/lib/files.com/models/as2_partner.rb +10 -8
  23. data/lib/files.com/models/as2_station.rb +10 -8
  24. data/lib/files.com/models/automation.rb +12 -10
  25. data/lib/files.com/models/automation_log.rb +2 -2
  26. data/lib/files.com/models/automation_run.rb +6 -6
  27. data/lib/files.com/models/bandwidth_snapshot.rb +2 -2
  28. data/lib/files.com/models/behavior.rb +12 -10
  29. data/lib/files.com/models/bundle.rb +10 -8
  30. data/lib/files.com/models/bundle_action.rb +2 -2
  31. data/lib/files.com/models/bundle_download.rb +2 -2
  32. data/lib/files.com/models/bundle_notification.rb +10 -8
  33. data/lib/files.com/models/bundle_recipient.rb +4 -4
  34. data/lib/files.com/models/bundle_registration.rb +2 -2
  35. data/lib/files.com/models/chat_session.rb +3 -3
  36. data/lib/files.com/models/child_site_management_policy.rb +10 -8
  37. data/lib/files.com/models/clickwrap.rb +10 -8
  38. data/lib/files.com/models/custom_domain.rb +11 -9
  39. data/lib/files.com/models/desktop_configuration_profile.rb +10 -8
  40. data/lib/files.com/models/dns_record.rb +2 -2
  41. data/lib/files.com/models/email_incoming_message.rb +2 -2
  42. data/lib/files.com/models/email_log.rb +2 -2
  43. data/lib/files.com/models/event_channel.rb +10 -8
  44. data/lib/files.com/models/event_delivery_attempt.rb +3 -3
  45. data/lib/files.com/models/event_record.rb +4 -4
  46. data/lib/files.com/models/event_subscription.rb +14 -12
  47. data/lib/files.com/models/event_target.rb +10 -8
  48. data/lib/files.com/models/exavault_api_request_log.rb +2 -2
  49. data/lib/files.com/models/expectation.rb +11 -9
  50. data/lib/files.com/models/expectation_evaluation.rb +3 -3
  51. data/lib/files.com/models/expectation_incident.rb +6 -6
  52. data/lib/files.com/models/external_event.rb +5 -5
  53. data/lib/files.com/models/file.rb +23 -15
  54. data/lib/files.com/models/file_comment.rb +9 -7
  55. data/lib/files.com/models/file_comment_reaction.rb +2 -2
  56. data/lib/files.com/models/file_migration.rb +1 -1
  57. data/lib/files.com/models/file_migration_log.rb +2 -2
  58. data/lib/files.com/models/folder.rb +3 -3
  59. data/lib/files.com/models/form_field_set.rb +10 -8
  60. data/lib/files.com/models/ftp_action_log.rb +2 -2
  61. data/lib/files.com/models/gpg_key.rb +10 -8
  62. data/lib/files.com/models/group.rb +10 -8
  63. data/lib/files.com/models/group_user.rb +9 -7
  64. data/lib/files.com/models/history.rb +10 -10
  65. data/lib/files.com/models/history_export.rb +3 -3
  66. data/lib/files.com/models/history_export_result.rb +2 -2
  67. data/lib/files.com/models/holiday_calendar.rb +10 -8
  68. data/lib/files.com/models/holiday_region.rb +2 -2
  69. data/lib/files.com/models/inbound_s3_log.rb +2 -2
  70. data/lib/files.com/models/inbox_recipient.rb +4 -4
  71. data/lib/files.com/models/inbox_registration.rb +2 -2
  72. data/lib/files.com/models/inbox_upload.rb +2 -2
  73. data/lib/files.com/models/integration_centric_profile.rb +10 -8
  74. data/lib/files.com/models/invoice.rb +3 -3
  75. data/lib/files.com/models/ip_address.rb +8 -8
  76. data/lib/files.com/models/key_lifecycle_rule.rb +10 -8
  77. data/lib/files.com/models/lock.rb +3 -3
  78. data/lib/files.com/models/metadata_category.rb +12 -10
  79. data/lib/files.com/models/notification.rb +10 -8
  80. data/lib/files.com/models/outbound_connection_log.rb +2 -2
  81. data/lib/files.com/models/partner.rb +10 -8
  82. data/lib/files.com/models/partner_channel.rb +10 -8
  83. data/lib/files.com/models/partner_channel_template.rb +10 -8
  84. data/lib/files.com/models/partner_site_request.rb +4 -4
  85. data/lib/files.com/models/payment.rb +3 -3
  86. data/lib/files.com/models/pending_work_event.rb +3 -3
  87. data/lib/files.com/models/permission.rb +4 -4
  88. data/lib/files.com/models/public_hosting_request_log.rb +2 -2
  89. data/lib/files.com/models/public_key.rb +11 -9
  90. data/lib/files.com/models/remote_bandwidth_snapshot.rb +2 -2
  91. data/lib/files.com/models/remote_mount_backend.rb +10 -8
  92. data/lib/files.com/models/remote_server.rb +13 -11
  93. data/lib/files.com/models/remote_server_credential.rb +10 -8
  94. data/lib/files.com/models/request.rb +6 -6
  95. data/lib/files.com/models/restore.rb +4 -4
  96. data/lib/files.com/models/schedule.rb +10 -8
  97. data/lib/files.com/models/scheduled_export.rb +10 -8
  98. data/lib/files.com/models/scim_log.rb +3 -3
  99. data/lib/files.com/models/secret.rb +10 -8
  100. data/lib/files.com/models/session.rb +2 -2
  101. data/lib/files.com/models/settings_change.rb +2 -2
  102. data/lib/files.com/models/sftp_action_log.rb +2 -2
  103. data/lib/files.com/models/sftp_host_key.rb +10 -8
  104. data/lib/files.com/models/share_group.rb +10 -8
  105. data/lib/files.com/models/siem_http_destination.rb +10 -8
  106. data/lib/files.com/models/siem_http_destination_event.rb +3 -3
  107. data/lib/files.com/models/site.rb +3 -3
  108. data/lib/files.com/models/site_subdomain_redirect.rb +3 -3
  109. data/lib/files.com/models/snapshot.rb +10 -8
  110. data/lib/files.com/models/sso_event.rb +3 -3
  111. data/lib/files.com/models/sso_strategy.rb +3 -3
  112. data/lib/files.com/models/style.rb +6 -5
  113. data/lib/files.com/models/sync.rb +10 -8
  114. data/lib/files.com/models/sync_log.rb +2 -2
  115. data/lib/files.com/models/sync_run.rb +3 -3
  116. data/lib/files.com/models/usage_daily_snapshot.rb +2 -2
  117. data/lib/files.com/models/usage_snapshot.rb +2 -2
  118. data/lib/files.com/models/user.rb +10 -8
  119. data/lib/files.com/models/user_additional_email_recipient.rb +10 -8
  120. data/lib/files.com/models/user_cipher_use.rb +2 -2
  121. data/lib/files.com/models/user_lifecycle_rule.rb +10 -8
  122. data/lib/files.com/models/user_request.rb +5 -5
  123. data/lib/files.com/models/user_security_event.rb +3 -3
  124. data/lib/files.com/models/user_sftp_client_use.rb +2 -2
  125. data/lib/files.com/models/web_dav_action_log.rb +2 -2
  126. data/lib/files.com/models/webhook_test.rb +2 -2
  127. data/lib/files.com/models/workspace.rb +10 -8
  128. data/lib/files.com/response.rb +24 -0
  129. data/lib/files.com/sizable_io.rb +65 -4
  130. data/lib/files.com/version.rb +1 -1
  131. data/lib/files.com.rb +23 -1
  132. data/spec/language_spec.rb +20 -10
  133. data/spec/lib/api_client_spec.rb +173 -18
  134. data/spec/list_spec.rb +203 -187
  135. data/spec/models/file_transfer_spec.rb +346 -0
  136. data/spec/models/persistence_spec.rb +167 -0
  137. data/spec/spec_helper.rb +122 -6
  138. data/spec/support/stubbed_api.rb +14 -0
  139. data/spec/support/transfer_server.rb +60 -0
  140. metadata +5 -1
@@ -1,97 +1,129 @@
1
+ require "set"
2
+
1
3
  module Files
4
+ # A page of results from a list operation, such as Files::User.list.
5
+ #
6
+ # +each+, and every other Enumerable method, covers the records on this page.
7
+ # +auto_paging_each+ continues through the pages that follow, requesting each
8
+ # one only when iteration reaches it. To move through a list one page at a
9
+ # time, use +has_next_page?+ and +next_page+:
10
+ #
11
+ # page = Files::User.list(per_page: 100)
12
+ # loop do
13
+ # page.each { |user| puts user.username }
14
+ # break unless page.has_next_page?
15
+ #
16
+ # page = page.next_page
17
+ # end
18
+ #
19
+ # A list operation returns its first page without requesting it yet. A page
20
+ # is requested when first used, and enumerating it again reuses its records.
21
+ #
22
+ # The two ways of paging keep separate places. All pages of one list share
23
+ # the place +next_page+ continues from, so calling it on an older page still
24
+ # returns the page after the newest one. +auto_paging_each+ always starts at
25
+ # the page it is called on, follows the cursors from there, and leaves
26
+ # +next_page+ where it was.
2
27
  class List
3
28
  include Enumerable
4
29
 
5
- def initialize(resource_wrapper, params, current_response = nil, current_options = nil, &request_page)
6
- @resource_wrapper = resource_wrapper
7
- @params = params
8
- @current_response = current_response
9
- @current_options = current_options
10
- @request_page = request_page
11
- params[:per_page] ||= 1_000
12
- end
30
+ # A requested page: its records, the cursor that requested it, and the
31
+ # cursor the API returned for the page after it, if any.
32
+ Page = Struct.new(:records, :cursor, :next_cursor)
13
33
 
14
- # Iterates through each resource in all pages, making additional fetches to
15
- # the API as necessary.
16
- #
17
- # Note that this method will make as many API calls as necessary to fetch
18
- # all resources. For more granular control, please see +each+ and
19
- # +next_page+.
20
- def auto_paging_each(&block)
21
- return enum_for(:auto_paging_each).lazy unless block_given?
34
+ # Where next_page continues from, shared by all pages of one list.
35
+ Progress = Struct.new(:next_cursor, :requested_cursors)
36
+ private_constant :Page, :Progress
22
37
 
23
- loop do
24
- page = next_page
25
- break unless page.valid_response?
38
+ # The block requests one page. It receives that page's parameters, which
39
+ # are +params+ plus its cursor, and a check to pass on to Api.send_request,
40
+ # so a rejected page leaves the caller's options as they were. +params+
41
+ # itself is copied, not changed.
42
+ def initialize(resource_wrapper, params, &request)
43
+ @resource_wrapper = resource_wrapper
44
+ @params = params.dup
45
+ @params[:per_page] ||= 1_000
46
+ @request = request
47
+ @progress = Progress.new(nil, Set.new)
48
+ end
26
49
 
27
- page.set_cursor
50
+ # Yields each record on this page and returns the block's results. Without
51
+ # a block, returns an Enumerator.
52
+ def each(&block)
53
+ return enum_for(:each) unless block
28
54
 
29
- page.wrap_data do |data|
30
- block.call(data)
31
- end
55
+ page.records.map(&block)
56
+ end
32
57
 
33
- break if page.on_last_page?
58
+ # Yields each record on this page and then on each page after it, requesting
59
+ # those pages as iteration reaches them. Without a block, returns a lazy
60
+ # Enumerator, so methods such as +first+ request only the pages they need.
61
+ # This does not change where +next_page+ continues.
62
+ def auto_paging_each(&block)
63
+ return enum_for(:auto_paging_each).lazy unless block
64
+
65
+ requested_cursors = Set[page.cursor]
66
+ list = self
67
+ list.page.records.each(&block)
68
+ while (cursor = list.page.next_cursor)
69
+ list = request_list(cursor, requested_cursors)
70
+ list.page.records.each(&block)
34
71
  end
35
72
  end
36
73
 
37
- # Iterates through each resource in the current page.
38
- #
39
- # Note that this method makes no effort to fetch a new page when it gets to
40
- # the end of the current page's resources. See also +auto_paging_each+.
41
- def each(&block)
42
- page = current_page
43
- return [] unless page.valid_response?
44
-
45
- page.set_cursor
46
- page.wrap_data { |data| block.call data }
74
+ # Whether +next_page+ has another page to return, as reported by the page
75
+ # +next_page+ returned last (the first page, before any call). When stepping
76
+ # with <tt>page = page.next_page</tt>, that is this page.
77
+ def has_next_page?
78
+ page
79
+ !@progress.next_cursor.nil?
47
80
  end
48
81
 
49
- # Fetches the next page of resources (if there is one).
50
- #
51
- # This method will try to respect the per_page set. If none
52
- # was given, the default per_page will be used.
82
+ # Requests the page after the last one +next_page+ returned, starting after
83
+ # the first page, so repeated calls on any page of this list walk forward.
84
+ # Once there are no more pages, returns an empty page without a request.
53
85
  def next_page
54
- self.class.new(resource_wrapper, params, *request_page.call, &request_page)
86
+ page
87
+ return with_page(Page.new([], nil, nil)) unless @progress.next_cursor
88
+
89
+ list = request_list(@progress.next_cursor, @progress.requested_cursors)
90
+ @progress.next_cursor = list.page.next_cursor
91
+ list
55
92
  end
56
93
 
57
94
  protected
58
95
 
59
- attr_reader :resource_wrapper,
60
- :params,
61
- :request_page
62
-
63
- def current_page
64
- @current_page ||= if @current_response and @current_options
65
- self
66
- else
67
- next_page
68
- end
69
- end
96
+ attr_writer :page
70
97
 
71
- def data
72
- @current_response.data
73
- end
74
-
75
- def wrap_data
76
- data.map do |object|
77
- yield resource_wrapper.new(object, @current_options)
98
+ def page
99
+ @page ||= request_page(@params[:cursor]).tap do |first_page|
100
+ @progress.requested_cursors << first_page.cursor
101
+ @progress.next_cursor = first_page.next_cursor
78
102
  end
79
103
  end
80
104
 
81
- def set_cursor
82
- params[:cursor] = @current_options[:client].cursor
83
- end
105
+ private
106
+
107
+ # A cursor this list has already requested would repeat pages, possibly
108
+ # forever, so it ends the list with an error instead. A request that fails
109
+ # can be tried again.
110
+ def request_list(cursor, requested_cursors)
111
+ raise APIConnectionError, "The Files.com API repeated a list cursor, so the SDK stopped requesting pages." if requested_cursors.include?(cursor)
84
112
 
85
- def cursor
86
- params[:cursor]
113
+ list = with_page(request_page(cursor))
114
+ requested_cursors << cursor
115
+ list
87
116
  end
88
117
 
89
- def valid_response?
90
- @current_response.http_status == 200
118
+ def request_page(cursor)
119
+ response, options = @request.call(cursor ? @params.merge(cursor: cursor) : @params) { |reply| reply.require_list(@resource_wrapper) }
120
+ records = response.data.map { |attributes| @resource_wrapper.new(attributes, options) }
121
+ next_cursor = response.http_headers["x-files-cursor"]
122
+ Page.new(records, cursor, (next_cursor unless next_cursor.to_s.strip.empty?))
91
123
  end
92
124
 
93
- def on_last_page?
94
- !cursor or (data.count < params[:per_page])
125
+ def with_page(page)
126
+ dup.tap { |list| list.page = page }
95
127
  end
96
128
  end
97
129
  end
@@ -98,8 +98,8 @@ module Files
98
98
  raise InvalidParameterError.new("Bad parameter: filter_lt must be an Hash") if params[:filter_lt] and !params[:filter_lt].is_a?(Hash)
99
99
  raise InvalidParameterError.new("Bad parameter: filter_lteq must be an Hash") if params[:filter_lteq] and !params[:filter_lteq].is_a?(Hash)
100
100
 
101
- List.new(ActionLog, params) do
102
- Api.send_request("/action_logs", :get, params, options)
101
+ List.new(ActionLog, params) do |page_params, &check_page|
102
+ Api.send_request("/action_logs", :get, page_params, options, &check_page)
103
103
  end
104
104
  end
105
105
 
@@ -149,9 +149,9 @@ module Files
149
149
  raise NotImplementedError.new("The ActionNotificationExport object doesn't support updates.")
150
150
  else
151
151
  new_obj = ActionNotificationExport.create(@attributes, @options)
152
+ @attributes = new_obj.attributes
152
153
  end
153
154
 
154
- @attributes = new_obj.attributes
155
155
  true
156
156
  end
157
157
 
@@ -163,7 +163,7 @@ module Files
163
163
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
164
164
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]
165
165
 
166
- response, options = Api.send_request("/action_notification_exports/#{params[:id]}", :get, params, options)
166
+ response, options = Api.send_request("/action_notification_exports/#{params[:id]}", :get, params, options) { |reply| reply.require_object("ActionNotificationExport") }
167
167
  ActionNotificationExport.new(response.data, options)
168
168
  end
169
169
 
@@ -195,7 +195,7 @@ module Files
195
195
  raise InvalidParameterError.new("Bad parameter: query_path must be an String") if params[:query_path] and !params[:query_path].is_a?(String)
196
196
  raise InvalidParameterError.new("Bad parameter: query_folder must be an String") if params[:query_folder] and !params[:query_folder].is_a?(String)
197
197
 
198
- response, options = Api.send_request("/action_notification_exports", :post, params, options)
198
+ response, options = Api.send_request("/action_notification_exports", :post, params, options) { |reply| reply.require_object("ActionNotificationExport") }
199
199
  ActionNotificationExport.new(response.data, options)
200
200
  end
201
201
  end
@@ -71,8 +71,8 @@ module Files
71
71
  raise InvalidParameterError.new("Bad parameter: action_notification_export_id must be an Integer") if params[:action_notification_export_id] and !params[:action_notification_export_id].is_a?(Integer)
72
72
  raise MissingParameterError.new("Parameter missing: action_notification_export_id") unless params[:action_notification_export_id]
73
73
 
74
- List.new(ActionNotificationExportResult, params) do
75
- Api.send_request("/action_notification_export_results", :get, params, options)
74
+ List.new(ActionNotificationExportResult, params) do |page_params, &check_page|
75
+ Api.send_request("/action_notification_export_results", :get, page_params, options, &check_page)
76
76
  end
77
77
  end
78
78
 
@@ -89,7 +89,9 @@ module Files
89
89
  raise InvalidParameterError.new("Bad parameter: workspace_id must be an Integer") if params[:workspace_id] and !params[:workspace_id].is_a?(Integer)
90
90
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]
91
91
 
92
- Api.send_request("/ai_assistant_personalities/#{@attributes[:id]}", :patch, params, @options)
92
+ response, options = Api.send_request("/ai_assistant_personalities/#{@attributes[:id]}", :patch, params, @options) { |reply| reply.require_object("AiAssistantPersonality") }
93
+ @attributes = response.data
94
+ [ response, options ]
93
95
  end
94
96
 
95
97
  def delete(params = {})
@@ -109,12 +111,12 @@ module Files
109
111
 
110
112
  def save
111
113
  if @attributes[:id]
112
- new_obj = update(@attributes)
114
+ update(@attributes)
113
115
  else
114
116
  new_obj = AiAssistantPersonality.create(@attributes, @options)
117
+ @attributes = new_obj.attributes
115
118
  end
116
119
 
117
- @attributes = new_obj.attributes
118
120
  true
119
121
  end
120
122
 
@@ -129,8 +131,8 @@ module Files
129
131
  raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params[:sort_by] and !params[:sort_by].is_a?(Hash)
130
132
  raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params[:filter] and !params[:filter].is_a?(Hash)
131
133
 
132
- List.new(AiAssistantPersonality, params) do
133
- Api.send_request("/ai_assistant_personalities", :get, params, options)
134
+ List.new(AiAssistantPersonality, params) do |page_params, &check_page|
135
+ Api.send_request("/ai_assistant_personalities", :get, page_params, options, &check_page)
134
136
  end
135
137
  end
136
138
 
@@ -146,7 +148,7 @@ module Files
146
148
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
147
149
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]
148
150
 
149
- response, options = Api.send_request("/ai_assistant_personalities/#{params[:id]}", :get, params, options)
151
+ response, options = Api.send_request("/ai_assistant_personalities/#{params[:id]}", :get, params, options) { |reply| reply.require_object("AiAssistantPersonality") }
150
152
  AiAssistantPersonality.new(response.data, options)
151
153
  end
152
154
 
@@ -167,7 +169,7 @@ module Files
167
169
  raise MissingParameterError.new("Parameter missing: name") unless params[:name]
168
170
  raise MissingParameterError.new("Parameter missing: system_prompt") unless params[:system_prompt]
169
171
 
170
- response, options = Api.send_request("/ai_assistant_personalities", :post, params, options)
172
+ response, options = Api.send_request("/ai_assistant_personalities", :post, params, options) { |reply| reply.require_object("AiAssistantPersonality") }
171
173
  AiAssistantPersonality.new(response.data, options)
172
174
  end
173
175
 
@@ -186,7 +188,7 @@ module Files
186
188
  raise InvalidParameterError.new("Bad parameter: workspace_id must be an Integer") if params[:workspace_id] and !params[:workspace_id].is_a?(Integer)
187
189
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]
188
190
 
189
- response, options = Api.send_request("/ai_assistant_personalities/#{params[:id]}", :patch, params, options)
191
+ response, options = Api.send_request("/ai_assistant_personalities/#{params[:id]}", :patch, params, options) { |reply| reply.require_object("AiAssistantPersonality") }
190
192
  AiAssistantPersonality.new(response.data, options)
191
193
  end
192
194
 
@@ -271,7 +271,9 @@ module Files
271
271
  raise InvalidParameterError.new("Bad parameter: workspace_id must be an Integer") if params[:workspace_id] and !params[:workspace_id].is_a?(Integer)
272
272
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]
273
273
 
274
- Api.send_request("/ai_tasks/#{@attributes[:id]}", :patch, params, @options)
274
+ response, options = Api.send_request("/ai_tasks/#{@attributes[:id]}", :patch, params, @options) { |reply| reply.require_object("AiTask") }
275
+ @attributes = response.data
276
+ [ response, options ]
275
277
  end
276
278
 
277
279
  def delete(params = {})
@@ -291,12 +293,12 @@ module Files
291
293
 
292
294
  def save
293
295
  if @attributes[:id]
294
- new_obj = update(@attributes)
296
+ update(@attributes)
295
297
  else
296
298
  new_obj = AiTask.create(@attributes, @options)
299
+ @attributes = new_obj.attributes
297
300
  end
298
301
 
299
- @attributes = new_obj.attributes
300
302
  true
301
303
  end
302
304
 
@@ -311,8 +313,8 @@ module Files
311
313
  raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params[:sort_by] and !params[:sort_by].is_a?(Hash)
312
314
  raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params[:filter] and !params[:filter].is_a?(Hash)
313
315
 
314
- List.new(AiTask, params) do
315
- Api.send_request("/ai_tasks", :get, params, options)
316
+ List.new(AiTask, params) do |page_params, &check_page|
317
+ Api.send_request("/ai_tasks", :get, page_params, options, &check_page)
316
318
  end
317
319
  end
318
320
 
@@ -328,7 +330,7 @@ module Files
328
330
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
329
331
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]
330
332
 
331
- response, options = Api.send_request("/ai_tasks/#{params[:id]}", :get, params, options)
333
+ response, options = Api.send_request("/ai_tasks/#{params[:id]}", :get, params, options) { |reply| reply.require_object("AiTask") }
332
334
  AiTask.new(response.data, options)
333
335
  end
334
336
 
@@ -376,7 +378,7 @@ module Files
376
378
  raise MissingParameterError.new("Parameter missing: name") unless params[:name]
377
379
  raise MissingParameterError.new("Parameter missing: prompt") unless params[:prompt]
378
380
 
379
- response, options = Api.send_request("/ai_tasks", :post, params, options)
381
+ response, options = Api.send_request("/ai_tasks", :post, params, options) { |reply| reply.require_object("AiTask") }
380
382
  AiTask.new(response.data, options)
381
383
  end
382
384
 
@@ -433,7 +435,7 @@ module Files
433
435
  raise InvalidParameterError.new("Bad parameter: workspace_id must be an Integer") if params[:workspace_id] and !params[:workspace_id].is_a?(Integer)
434
436
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]
435
437
 
436
- response, options = Api.send_request("/ai_tasks/#{params[:id]}", :patch, params, options)
438
+ response, options = Api.send_request("/ai_tasks/#{params[:id]}", :patch, params, options) { |reply| reply.require_object("AiTask") }
437
439
  AiTask.new(response.data, options)
438
440
  end
439
441
 
@@ -190,7 +190,9 @@ module Files
190
190
  raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String)
191
191
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]
192
192
 
193
- Api.send_request("/api_keys/#{@attributes[:id]}", :patch, params, @options)
193
+ response, options = Api.send_request("/api_keys/#{@attributes[:id]}", :patch, params, @options) { |reply| reply.require_object("ApiKey") }
194
+ @attributes = response.data
195
+ [ response, options ]
194
196
  end
195
197
 
196
198
  def delete(params = {})
@@ -210,12 +212,12 @@ module Files
210
212
 
211
213
  def save
212
214
  if @attributes[:id]
213
- new_obj = update(@attributes)
215
+ update(@attributes)
214
216
  else
215
217
  new_obj = ApiKey.create(@attributes, @options)
218
+ @attributes = new_obj.attributes
216
219
  end
217
220
 
218
- @attributes = new_obj.attributes
219
221
  true
220
222
  end
221
223
 
@@ -240,8 +242,8 @@ module Files
240
242
  raise InvalidParameterError.new("Bad parameter: filter_lt must be an Hash") if params[:filter_lt] and !params[:filter_lt].is_a?(Hash)
241
243
  raise InvalidParameterError.new("Bad parameter: filter_lteq must be an Hash") if params[:filter_lteq] and !params[:filter_lteq].is_a?(Hash)
242
244
 
243
- List.new(ApiKey, params) do
244
- Api.send_request("/api_keys", :get, params, options)
245
+ List.new(ApiKey, params) do |page_params, &check_page|
246
+ Api.send_request("/api_keys", :get, page_params, options, &check_page)
245
247
  end
246
248
  end
247
249
 
@@ -250,7 +252,7 @@ module Files
250
252
  end
251
253
 
252
254
  def self.find_current(params = {}, options = {})
253
- response, options = Api.send_request("/api_key", :get, params, options)
255
+ response, options = Api.send_request("/api_key", :get, params, options) { |reply| reply.require_object("ApiKey") }
254
256
  ApiKey.new(response.data, options)
255
257
  end
256
258
 
@@ -262,7 +264,7 @@ module Files
262
264
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
263
265
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]
264
266
 
265
- response, options = Api.send_request("/api_keys/#{params[:id]}", :get, params, options)
267
+ response, options = Api.send_request("/api_keys/#{params[:id]}", :get, params, options) { |reply| reply.require_object("ApiKey") }
266
268
  ApiKey.new(response.data, options)
267
269
  end
268
270
 
@@ -289,7 +291,7 @@ module Files
289
291
  raise InvalidParameterError.new("Bad parameter: workspace_id must be an Integer") if params[:workspace_id] and !params[:workspace_id].is_a?(Integer)
290
292
  raise MissingParameterError.new("Parameter missing: name") unless params[:name]
291
293
 
292
- response, options = Api.send_request("/api_keys", :post, params, options)
294
+ response, options = Api.send_request("/api_keys", :post, params, options) { |reply| reply.require_object("ApiKey") }
293
295
  ApiKey.new(response.data, options)
294
296
  end
295
297
 
@@ -302,7 +304,7 @@ module Files
302
304
  raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String)
303
305
  raise InvalidParameterError.new("Bad parameter: permission_set must be an String") if params[:permission_set] and !params[:permission_set].is_a?(String)
304
306
 
305
- response, options = Api.send_request("/api_key", :patch, params, options)
307
+ response, options = Api.send_request("/api_key", :patch, params, options) { |reply| reply.require_object("ApiKey") }
306
308
  ApiKey.new(response.data, options)
307
309
  end
308
310
 
@@ -319,7 +321,7 @@ module Files
319
321
  raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String)
320
322
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]
321
323
 
322
- response, options = Api.send_request("/api_keys/#{params[:id]}", :patch, params, options)
324
+ response, options = Api.send_request("/api_keys/#{params[:id]}", :patch, params, options) { |reply| reply.require_object("ApiKey") }
323
325
  ApiKey.new(response.data, options)
324
326
  end
325
327
 
@@ -133,8 +133,8 @@ module Files
133
133
  raise InvalidParameterError.new("Bad parameter: filter_lt must be an Hash") if params[:filter_lt] and !params[:filter_lt].is_a?(Hash)
134
134
  raise InvalidParameterError.new("Bad parameter: filter_lteq must be an Hash") if params[:filter_lteq] and !params[:filter_lteq].is_a?(Hash)
135
135
 
136
- List.new(ApiRequestLog, params) do
137
- Api.send_request("/api_request_logs", :get, params, options)
136
+ List.new(ApiRequestLog, params) do |page_params, &check_page|
137
+ Api.send_request("/api_request_logs", :get, page_params, options, &check_page)
138
138
  end
139
139
  end
140
140
 
@@ -127,8 +127,8 @@ module Files
127
127
  raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params[:filter] and !params[:filter].is_a?(Hash)
128
128
  raise InvalidParameterError.new("Bad parameter: filter_prefix must be an Hash") if params[:filter_prefix] and !params[:filter_prefix].is_a?(Hash)
129
129
 
130
- List.new(App, params) do
131
- Api.send_request("/apps", :get, params, options)
130
+ List.new(App, params) do |page_params, &check_page|
131
+ Api.send_request("/apps", :get, page_params, options, &check_page)
132
132
  end
133
133
  end
134
134
 
@@ -203,8 +203,8 @@ module Files
203
203
  raise InvalidParameterError.new("Bad parameter: filter_lt must be an Hash") if params[:filter_lt] and !params[:filter_lt].is_a?(Hash)
204
204
  raise InvalidParameterError.new("Bad parameter: filter_lteq must be an Hash") if params[:filter_lteq] and !params[:filter_lteq].is_a?(Hash)
205
205
 
206
- List.new(As2IncomingMessage, params) do
207
- Api.send_request("/as2_incoming_messages", :get, params, options)
206
+ List.new(As2IncomingMessage, params) do |page_params, &check_page|
207
+ Api.send_request("/as2_incoming_messages", :get, page_params, options, &check_page)
208
208
  end
209
209
  end
210
210
 
@@ -188,8 +188,8 @@ module Files
188
188
  raise InvalidParameterError.new("Bad parameter: filter_lt must be an Hash") if params[:filter_lt] and !params[:filter_lt].is_a?(Hash)
189
189
  raise InvalidParameterError.new("Bad parameter: filter_lteq must be an Hash") if params[:filter_lteq] and !params[:filter_lteq].is_a?(Hash)
190
190
 
191
- List.new(As2OutgoingMessage, params) do
192
- Api.send_request("/as2_outgoing_messages", :get, params, options)
191
+ List.new(As2OutgoingMessage, params) do |page_params, &check_page|
192
+ Api.send_request("/as2_outgoing_messages", :get, page_params, options, &check_page)
193
193
  end
194
194
  end
195
195
 
@@ -226,7 +226,9 @@ module Files
226
226
  raise InvalidParameterError.new("Bad parameter: public_certificate must be an String") if params[:public_certificate] and !params[:public_certificate].is_a?(String)
227
227
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]
228
228
 
229
- Api.send_request("/as2_partners/#{@attributes[:id]}", :patch, params, @options)
229
+ response, options = Api.send_request("/as2_partners/#{@attributes[:id]}", :patch, params, @options) { |reply| reply.require_object("As2Partner") }
230
+ @attributes = response.data
231
+ [ response, options ]
230
232
  end
231
233
 
232
234
  def delete(params = {})
@@ -246,12 +248,12 @@ module Files
246
248
 
247
249
  def save
248
250
  if @attributes[:id]
249
- new_obj = update(@attributes)
251
+ update(@attributes)
250
252
  else
251
253
  new_obj = As2Partner.create(@attributes, @options)
254
+ @attributes = new_obj.attributes
252
255
  end
253
256
 
254
- @attributes = new_obj.attributes
255
257
  true
256
258
  end
257
259
 
@@ -266,8 +268,8 @@ module Files
266
268
  raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params[:sort_by] and !params[:sort_by].is_a?(Hash)
267
269
  raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params[:filter] and !params[:filter].is_a?(Hash)
268
270
 
269
- List.new(As2Partner, params) do
270
- Api.send_request("/as2_partners", :get, params, options)
271
+ List.new(As2Partner, params) do |page_params, &check_page|
272
+ Api.send_request("/as2_partners", :get, page_params, options, &check_page)
271
273
  end
272
274
  end
273
275
 
@@ -283,7 +285,7 @@ module Files
283
285
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
284
286
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]
285
287
 
286
- response, options = Api.send_request("/as2_partners/#{params[:id]}", :get, params, options)
288
+ response, options = Api.send_request("/as2_partners/#{params[:id]}", :get, params, options) { |reply| reply.require_object("As2Partner") }
287
289
  As2Partner.new(response.data, options)
288
290
  end
289
291
 
@@ -321,7 +323,7 @@ module Files
321
323
  raise MissingParameterError.new("Parameter missing: uri") unless params[:uri]
322
324
  raise MissingParameterError.new("Parameter missing: public_certificate") unless params[:public_certificate]
323
325
 
324
- response, options = Api.send_request("/as2_partners", :post, params, options)
326
+ response, options = Api.send_request("/as2_partners", :post, params, options) { |reply| reply.require_object("As2Partner") }
325
327
  As2Partner.new(response.data, options)
326
328
  end
327
329
 
@@ -353,7 +355,7 @@ module Files
353
355
  raise InvalidParameterError.new("Bad parameter: public_certificate must be an String") if params[:public_certificate] and !params[:public_certificate].is_a?(String)
354
356
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]
355
357
 
356
- response, options = Api.send_request("/as2_partners/#{params[:id]}", :patch, params, options)
358
+ response, options = Api.send_request("/as2_partners/#{params[:id]}", :patch, params, options) { |reply| reply.require_object("As2Partner") }
357
359
  As2Partner.new(response.data, options)
358
360
  end
359
361
 
@@ -178,7 +178,9 @@ module Files
178
178
  raise InvalidParameterError.new("Bad parameter: private_key_password must be an String") if params[:private_key_password] and !params[:private_key_password].is_a?(String)
179
179
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]
180
180
 
181
- Api.send_request("/as2_stations/#{@attributes[:id]}", :patch, params, @options)
181
+ response, options = Api.send_request("/as2_stations/#{@attributes[:id]}", :patch, params, @options) { |reply| reply.require_object("As2Station") }
182
+ @attributes = response.data
183
+ [ response, options ]
182
184
  end
183
185
 
184
186
  def delete(params = {})
@@ -198,12 +200,12 @@ module Files
198
200
 
199
201
  def save
200
202
  if @attributes[:id]
201
- new_obj = update(@attributes)
203
+ update(@attributes)
202
204
  else
203
205
  new_obj = As2Station.create(@attributes, @options)
206
+ @attributes = new_obj.attributes
204
207
  end
205
208
 
206
- @attributes = new_obj.attributes
207
209
  true
208
210
  end
209
211
 
@@ -218,8 +220,8 @@ module Files
218
220
  raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params[:sort_by] and !params[:sort_by].is_a?(Hash)
219
221
  raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params[:filter] and !params[:filter].is_a?(Hash)
220
222
 
221
- List.new(As2Station, params) do
222
- Api.send_request("/as2_stations", :get, params, options)
223
+ List.new(As2Station, params) do |page_params, &check_page|
224
+ Api.send_request("/as2_stations", :get, page_params, options, &check_page)
223
225
  end
224
226
  end
225
227
 
@@ -235,7 +237,7 @@ module Files
235
237
  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
236
238
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]
237
239
 
238
- response, options = Api.send_request("/as2_stations/#{params[:id]}", :get, params, options)
240
+ response, options = Api.send_request("/as2_stations/#{params[:id]}", :get, params, options) { |reply| reply.require_object("As2Station") }
239
241
  As2Station.new(response.data, options)
240
242
  end
241
243
 
@@ -259,7 +261,7 @@ module Files
259
261
  raise MissingParameterError.new("Parameter missing: public_certificate") unless params[:public_certificate]
260
262
  raise MissingParameterError.new("Parameter missing: private_key") unless params[:private_key]
261
263
 
262
- response, options = Api.send_request("/as2_stations", :post, params, options)
264
+ response, options = Api.send_request("/as2_stations", :post, params, options) { |reply| reply.require_object("As2Station") }
263
265
  As2Station.new(response.data, options)
264
266
  end
265
267
 
@@ -278,7 +280,7 @@ module Files
278
280
  raise InvalidParameterError.new("Bad parameter: private_key_password must be an String") if params[:private_key_password] and !params[:private_key_password].is_a?(String)
279
281
  raise MissingParameterError.new("Parameter missing: id") unless params[:id]
280
282
 
281
- response, options = Api.send_request("/as2_stations/#{params[:id]}", :patch, params, options)
283
+ response, options = Api.send_request("/as2_stations/#{params[:id]}", :patch, params, options) { |reply| reply.require_object("As2Station") }
282
284
  As2Station.new(response.data, options)
283
285
  end
284
286