incident_io_api 1.3.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6bf9f1c5912e372c6d2c203c09ef2e9d21b734512db214f0d7e5a0eb21f176f1
4
- data.tar.gz: 77f62d6fed7b3a19a6e60ade9be517c565cdf6d7a70cdb3ecb436329516066ea
3
+ metadata.gz: 2e7a91e1f3d5eaf63c351ce67902096216d151d5979a86a655f3abac5c78159e
4
+ data.tar.gz: e1cce06d29e94ff99d12e21c06ae9bb9d89500cd633a2417a68ef1fb7e514345
5
5
  SHA512:
6
- metadata.gz: '02308c9db7f0125ab0a839de724fc37551230154b265257537a1041cb311ac315149858317b78d2dc568e4ba9c7f3fdc492577ef7da649c85298cc5c92482a61'
7
- data.tar.gz: f56c5bf6541e09cc54f9acf7199d57eeed10103efb7e637733a3839a063d665830d76df6541fa092deea8f148245a2248c2dc714f503d13dd111b5790b39573e
6
+ metadata.gz: 6e00237b007db00f61cbca80606093577b79cd5a7b62c295505284ec20128738fdf69605f17333e5eca442e11cb38b812bc9d9a7c2d9572584dcaafa34aaf153
7
+ data.tar.gz: a34c42ca564d0f7fcd46f5e4410a94b8f4415af7f030c3970c8a6b6dd654db07652ad063dbc64aa116f68c1d861a6ff7fb597d62bdaa1326e7bb20dc97c71408
@@ -0,0 +1,158 @@
1
+ =begin
2
+ #incident.io
3
+
4
+ #Ruby client for the incident.io API.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.25.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module IncidentIo
16
+ class IncidentTeamMembershipsV1Api
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Create Incident Team Memberships V1
23
+ # Grants a team access to a private incident
24
+ # @param incident_team_memberships_create_payload_v1 [IncidentTeamMembershipsCreatePayloadV1]
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [IncidentTeamMembershipsCreateResultV1]
27
+ def incident_team_memberships_v1_create(incident_team_memberships_create_payload_v1, opts = {})
28
+ data, _status_code, _headers = incident_team_memberships_v1_create_with_http_info(incident_team_memberships_create_payload_v1, opts)
29
+ data
30
+ end
31
+
32
+ # Create Incident Team Memberships V1
33
+ # Grants a team access to a private incident
34
+ # @param incident_team_memberships_create_payload_v1 [IncidentTeamMembershipsCreatePayloadV1]
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(IncidentTeamMembershipsCreateResultV1, Integer, Hash)>] IncidentTeamMembershipsCreateResultV1 data, response status code and response headers
37
+ def incident_team_memberships_v1_create_with_http_info(incident_team_memberships_create_payload_v1, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: IncidentTeamMembershipsV1Api.incident_team_memberships_v1_create ...'
40
+ end
41
+ # verify the required parameter 'incident_team_memberships_create_payload_v1' is set
42
+ if @api_client.config.client_side_validation && incident_team_memberships_create_payload_v1.nil?
43
+ fail ArgumentError, "Missing the required parameter 'incident_team_memberships_create_payload_v1' when calling IncidentTeamMembershipsV1Api.incident_team_memberships_v1_create"
44
+ end
45
+ # resource path
46
+ local_var_path = '/v1/incident_team_memberships'
47
+
48
+ # query parameters
49
+ query_params = opts[:query_params] || {}
50
+
51
+ # header parameters
52
+ header_params = opts[:header_params] || {}
53
+ # HTTP header 'Accept' (if needed)
54
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
55
+ # HTTP header 'Content-Type'
56
+ content_type = @api_client.select_header_content_type(['application/json'])
57
+ if !content_type.nil?
58
+ header_params['Content-Type'] = content_type
59
+ end
60
+
61
+ # form parameters
62
+ form_params = opts[:form_params] || {}
63
+
64
+ # http body (model)
65
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(incident_team_memberships_create_payload_v1)
66
+
67
+ # return_type
68
+ return_type = opts[:debug_return_type] || 'IncidentTeamMembershipsCreateResultV1'
69
+
70
+ # auth_names
71
+ auth_names = opts[:debug_auth_names] || ['BearerAuth']
72
+
73
+ new_options = opts.merge(
74
+ :operation => :"IncidentTeamMembershipsV1Api.incident_team_memberships_v1_create",
75
+ :header_params => header_params,
76
+ :query_params => query_params,
77
+ :form_params => form_params,
78
+ :body => post_body,
79
+ :auth_names => auth_names,
80
+ :return_type => return_type
81
+ )
82
+
83
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
84
+ if @api_client.config.debugging
85
+ @api_client.config.logger.debug "API called: IncidentTeamMembershipsV1Api#incident_team_memberships_v1_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
86
+ end
87
+ return data, status_code, headers
88
+ end
89
+
90
+ # Revoke Incident Team Memberships V1
91
+ # Revoke a team's access to a private incident. Members who only had access through this team lose it too; directly-added members and members still covered by another team keep theirs.
92
+ # @param incident_team_memberships_revoke_payload_v1 [IncidentTeamMembershipsRevokePayloadV1]
93
+ # @param [Hash] opts the optional parameters
94
+ # @return [nil]
95
+ def incident_team_memberships_v1_revoke(incident_team_memberships_revoke_payload_v1, opts = {})
96
+ incident_team_memberships_v1_revoke_with_http_info(incident_team_memberships_revoke_payload_v1, opts)
97
+ nil
98
+ end
99
+
100
+ # Revoke Incident Team Memberships V1
101
+ # Revoke a team&#39;s access to a private incident. Members who only had access through this team lose it too; directly-added members and members still covered by another team keep theirs.
102
+ # @param incident_team_memberships_revoke_payload_v1 [IncidentTeamMembershipsRevokePayloadV1]
103
+ # @param [Hash] opts the optional parameters
104
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
105
+ def incident_team_memberships_v1_revoke_with_http_info(incident_team_memberships_revoke_payload_v1, opts = {})
106
+ if @api_client.config.debugging
107
+ @api_client.config.logger.debug 'Calling API: IncidentTeamMembershipsV1Api.incident_team_memberships_v1_revoke ...'
108
+ end
109
+ # verify the required parameter 'incident_team_memberships_revoke_payload_v1' is set
110
+ if @api_client.config.client_side_validation && incident_team_memberships_revoke_payload_v1.nil?
111
+ fail ArgumentError, "Missing the required parameter 'incident_team_memberships_revoke_payload_v1' when calling IncidentTeamMembershipsV1Api.incident_team_memberships_v1_revoke"
112
+ end
113
+ # resource path
114
+ local_var_path = '/v1/incident_team_memberships/actions/revoke'
115
+
116
+ # query parameters
117
+ query_params = opts[:query_params] || {}
118
+
119
+ # header parameters
120
+ header_params = opts[:header_params] || {}
121
+ # HTTP header 'Accept' (if needed)
122
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
123
+ # HTTP header 'Content-Type'
124
+ content_type = @api_client.select_header_content_type(['application/json'])
125
+ if !content_type.nil?
126
+ header_params['Content-Type'] = content_type
127
+ end
128
+
129
+ # form parameters
130
+ form_params = opts[:form_params] || {}
131
+
132
+ # http body (model)
133
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(incident_team_memberships_revoke_payload_v1)
134
+
135
+ # return_type
136
+ return_type = opts[:debug_return_type]
137
+
138
+ # auth_names
139
+ auth_names = opts[:debug_auth_names] || ['BearerAuth']
140
+
141
+ new_options = opts.merge(
142
+ :operation => :"IncidentTeamMembershipsV1Api.incident_team_memberships_v1_revoke",
143
+ :header_params => header_params,
144
+ :query_params => query_params,
145
+ :form_params => form_params,
146
+ :body => post_body,
147
+ :auth_names => auth_names,
148
+ :return_type => return_type
149
+ )
150
+
151
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
152
+ if @api_client.config.debugging
153
+ @api_client.config.logger.debug "API called: IncidentTeamMembershipsV1Api#incident_team_memberships_v1_revoke\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
154
+ end
155
+ return data, status_code, headers
156
+ end
157
+ end
158
+ end
@@ -723,7 +723,7 @@ module IncidentIo
723
723
  end
724
724
 
725
725
  # ListScheduleEntries Schedules V2
726
- # List the schedule entries for a schedule over a window of time. Use this endpoint to find out who is on-call for a schedule, either right now or at any point in the future. Common uses include: - Building a calendar or timeline view of who is on-call. - Looking up who was on-call at a particular moment (for example, when an incident fired). - Exporting upcoming shifts into another system, such as a payroll or scheduling tool. The response groups entries into three lists: `scheduled` (the entries the rotation rules produce, before any overrides), `overrides` (any one-off overrides that apply in the window) and `final` (the effective schedule after overrides have been merged in — this is normally the list you want). Each entry includes the `rotation_id` and `layer_id` it belongs to. Schedules can be made up of multiple rotations (for example, a primary and a secondary rotation) and each rotation can have several layers, and we return entries for every rotation and layer on the schedule. The endpoint returns all entries that overlap with the given window. If no window is provided we default to a sensible range starting from now. ## Pagination Responses are paginated. When more entries are available than fit on a single page, the response includes a `pagination_meta` block with two fields: - `after_url` — a fully-formed URL for the next page. The simplest way to paginate is to keep following this URL until it is no longer present. - `after` — an opaque cursor token. To fetch the next page manually, re-issue the request with `entry_window_start` set to this value and `entry_window_end` left unchanged from the original request. Treat the token as opaque — do not parse or modify it. Keep paginating until `pagination_meta` is absent from the response, at which point you have received every entry in the window.
726
+ # List the schedule entries for a schedule over a window of time. Use this endpoint to find out who is on-call for a schedule, either right now or at any point in the future. Common uses include: - Building a calendar or timeline view of who is on-call. - Looking up who was on-call at a particular moment (for example, when an incident fired). - Exporting upcoming shifts into another system, such as a payroll or scheduling tool. The response groups entries into three lists: `scheduled` (the entries the rotation rules produce, before any overrides), `overrides` (any one-off overrides that apply in the window) and `final` (the effective schedule after overrides have been merged in — this is normally the list you want). Each entry includes the `rotation_id` it belongs to. Schedules can be made up of multiple rotations (for example, a primary and a secondary rotation) and each rotation can have several layers, and we return entries for every rotation and layer on the schedule. The endpoint returns all entries that overlap with the given window. If no window is provided we default to a sensible range starting from now. ## Pagination Responses are paginated. When more entries are available than fit on a single page, the response includes a `pagination_meta` block with two fields: - `after_url` — a fully-formed URL for the next page. The simplest way to paginate is to keep following this URL until it is no longer present. - `after` — an opaque cursor token. To fetch the next page manually, re-issue the request with `entry_window_start` set to this value and `entry_window_end` left unchanged from the original request. Treat the token as opaque — do not parse or modify it. Keep paginating until `pagination_meta` is absent from the response, at which point you have received every entry in the window.
727
727
  # @param schedule_id [String] The ID of the schedule to get entries for.
728
728
  # @param [Hash] opts the optional parameters
729
729
  # @option opts [String] :entry_window_start The start of the window to get entries for. May also carry an opaque pagination cursor previously returned in &#x60;pagination_meta.after&#x60; — pass it back here unchanged to fetch the next page (leave &#x60;entry_window_end&#x60; unchanged from the original request).
@@ -735,7 +735,7 @@ module IncidentIo
735
735
  end
736
736
 
737
737
  # ListScheduleEntries Schedules V2
738
- # List the schedule entries for a schedule over a window of time. Use this endpoint to find out who is on-call for a schedule, either right now or at any point in the future. Common uses include: - Building a calendar or timeline view of who is on-call. - Looking up who was on-call at a particular moment (for example, when an incident fired). - Exporting upcoming shifts into another system, such as a payroll or scheduling tool. The response groups entries into three lists: &#x60;scheduled&#x60; (the entries the rotation rules produce, before any overrides), &#x60;overrides&#x60; (any one-off overrides that apply in the window) and &#x60;final&#x60; (the effective schedule after overrides have been merged in — this is normally the list you want). Each entry includes the &#x60;rotation_id&#x60; and &#x60;layer_id&#x60; it belongs to. Schedules can be made up of multiple rotations (for example, a primary and a secondary rotation) and each rotation can have several layers, and we return entries for every rotation and layer on the schedule. The endpoint returns all entries that overlap with the given window. If no window is provided we default to a sensible range starting from now. ## Pagination Responses are paginated. When more entries are available than fit on a single page, the response includes a &#x60;pagination_meta&#x60; block with two fields: - &#x60;after_url&#x60; — a fully-formed URL for the next page. The simplest way to paginate is to keep following this URL until it is no longer present. - &#x60;after&#x60; — an opaque cursor token. To fetch the next page manually, re-issue the request with &#x60;entry_window_start&#x60; set to this value and &#x60;entry_window_end&#x60; left unchanged from the original request. Treat the token as opaque — do not parse or modify it. Keep paginating until &#x60;pagination_meta&#x60; is absent from the response, at which point you have received every entry in the window.
738
+ # List the schedule entries for a schedule over a window of time. Use this endpoint to find out who is on-call for a schedule, either right now or at any point in the future. Common uses include: - Building a calendar or timeline view of who is on-call. - Looking up who was on-call at a particular moment (for example, when an incident fired). - Exporting upcoming shifts into another system, such as a payroll or scheduling tool. The response groups entries into three lists: &#x60;scheduled&#x60; (the entries the rotation rules produce, before any overrides), &#x60;overrides&#x60; (any one-off overrides that apply in the window) and &#x60;final&#x60; (the effective schedule after overrides have been merged in — this is normally the list you want). Each entry includes the &#x60;rotation_id&#x60; it belongs to. Schedules can be made up of multiple rotations (for example, a primary and a secondary rotation) and each rotation can have several layers, and we return entries for every rotation and layer on the schedule. The endpoint returns all entries that overlap with the given window. If no window is provided we default to a sensible range starting from now. ## Pagination Responses are paginated. When more entries are available than fit on a single page, the response includes a &#x60;pagination_meta&#x60; block with two fields: - &#x60;after_url&#x60; — a fully-formed URL for the next page. The simplest way to paginate is to keep following this URL until it is no longer present. - &#x60;after&#x60; — an opaque cursor token. To fetch the next page manually, re-issue the request with &#x60;entry_window_start&#x60; set to this value and &#x60;entry_window_end&#x60; left unchanged from the original request. Treat the token as opaque — do not parse or modify it. Keep paginating until &#x60;pagination_meta&#x60; is absent from the response, at which point you have received every entry in the window.
739
739
  # @param schedule_id [String] The ID of the schedule to get entries for.
740
740
  # @param [Hash] opts the optional parameters
741
741
  # @option opts [String] :entry_window_start The start of the window to get entries for. May also carry an opaque pagination cursor previously returned in &#x60;pagination_meta.after&#x60; — pass it back here unchanged to fetch the next page (leave &#x60;entry_window_end&#x60; unchanged from the original request).
@@ -0,0 +1,326 @@
1
+ =begin
2
+ #incident.io
3
+
4
+ #Ruby client for the incident.io API.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.25.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module IncidentIo
17
+ class AuditLogsOnCallNotificationPauseResumedV1 < ApiModelBase
18
+ # The type of log entry that this is
19
+ attr_accessor :action
20
+
21
+ attr_accessor :actor
22
+
23
+ attr_accessor :context
24
+
25
+ attr_accessor :metadata
26
+
27
+ # When the entry occurred
28
+ attr_accessor :occurred_at
29
+
30
+ # The custom field that was created
31
+ attr_accessor :targets
32
+
33
+ # Which version the event is
34
+ attr_accessor :version
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'action' => :'action',
40
+ :'actor' => :'actor',
41
+ :'context' => :'context',
42
+ :'metadata' => :'metadata',
43
+ :'occurred_at' => :'occurred_at',
44
+ :'targets' => :'targets',
45
+ :'version' => :'version'
46
+ }
47
+ end
48
+
49
+ # Returns attribute mapping this model knows about
50
+ def self.acceptable_attribute_map
51
+ attribute_map
52
+ end
53
+
54
+ # Returns all the JSON keys this model knows about
55
+ def self.acceptable_attributes
56
+ acceptable_attribute_map.values
57
+ end
58
+
59
+ # Attribute type mapping.
60
+ def self.openapi_types
61
+ {
62
+ :'action' => :'String',
63
+ :'actor' => :'AuditLogActorV2',
64
+ :'context' => :'AuditLogEntryContextV2',
65
+ :'metadata' => :'AuditLogOnCallNotificationPauseMetadataV2',
66
+ :'occurred_at' => :'Time',
67
+ :'targets' => :'Array<AuditLogTargetV2>',
68
+ :'version' => :'Integer'
69
+ }
70
+ end
71
+
72
+ # List of attributes with nullable: true
73
+ def self.openapi_nullable
74
+ Set.new([
75
+ ])
76
+ end
77
+
78
+ # Initializes the object
79
+ # @param [Hash] attributes Model attributes in the form of hash
80
+ def initialize(attributes = {})
81
+ if (!attributes.is_a?(Hash))
82
+ fail ArgumentError, "The input argument (attributes) must be a hash in `IncidentIo::AuditLogsOnCallNotificationPauseResumedV1` initialize method"
83
+ end
84
+
85
+ # check to see if the attribute exists and convert string to symbol for hash key
86
+ acceptable_attribute_map = self.class.acceptable_attribute_map
87
+ attributes = attributes.each_with_object({}) { |(k, v), h|
88
+ if (!acceptable_attribute_map.key?(k.to_sym))
89
+ fail ArgumentError, "`#{k}` is not a valid attribute in `IncidentIo::AuditLogsOnCallNotificationPauseResumedV1`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
90
+ end
91
+ h[k.to_sym] = v
92
+ }
93
+
94
+ if attributes.key?(:'action')
95
+ self.action = attributes[:'action']
96
+ else
97
+ self.action = nil
98
+ end
99
+
100
+ if attributes.key?(:'actor')
101
+ self.actor = attributes[:'actor']
102
+ else
103
+ self.actor = nil
104
+ end
105
+
106
+ if attributes.key?(:'context')
107
+ self.context = attributes[:'context']
108
+ else
109
+ self.context = nil
110
+ end
111
+
112
+ if attributes.key?(:'metadata')
113
+ self.metadata = attributes[:'metadata']
114
+ else
115
+ self.metadata = nil
116
+ end
117
+
118
+ if attributes.key?(:'occurred_at')
119
+ self.occurred_at = attributes[:'occurred_at']
120
+ else
121
+ self.occurred_at = nil
122
+ end
123
+
124
+ if attributes.key?(:'targets')
125
+ if (value = attributes[:'targets']).is_a?(Array)
126
+ self.targets = value
127
+ end
128
+ else
129
+ self.targets = nil
130
+ end
131
+
132
+ if attributes.key?(:'version')
133
+ self.version = attributes[:'version']
134
+ else
135
+ self.version = nil
136
+ end
137
+ end
138
+
139
+ # Show invalid properties with the reasons. Usually used together with valid?
140
+ # @return Array for valid properties with the reasons
141
+ def list_invalid_properties
142
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
143
+ invalid_properties = Array.new
144
+ if @action.nil?
145
+ invalid_properties.push('invalid value for "action", action cannot be nil.')
146
+ end
147
+
148
+ if @actor.nil?
149
+ invalid_properties.push('invalid value for "actor", actor cannot be nil.')
150
+ end
151
+
152
+ if @context.nil?
153
+ invalid_properties.push('invalid value for "context", context cannot be nil.')
154
+ end
155
+
156
+ if @metadata.nil?
157
+ invalid_properties.push('invalid value for "metadata", metadata cannot be nil.')
158
+ end
159
+
160
+ if @occurred_at.nil?
161
+ invalid_properties.push('invalid value for "occurred_at", occurred_at cannot be nil.')
162
+ end
163
+
164
+ if @targets.nil?
165
+ invalid_properties.push('invalid value for "targets", targets cannot be nil.')
166
+ end
167
+
168
+ if @version.nil?
169
+ invalid_properties.push('invalid value for "version", version cannot be nil.')
170
+ end
171
+
172
+ invalid_properties
173
+ end
174
+
175
+ # Check to see if the all the properties in the model are valid
176
+ # @return true if the model is valid
177
+ def valid?
178
+ warn '[DEPRECATED] the `valid?` method is obsolete'
179
+ return false if @action.nil?
180
+ return false if @actor.nil?
181
+ return false if @context.nil?
182
+ return false if @metadata.nil?
183
+ return false if @occurred_at.nil?
184
+ return false if @targets.nil?
185
+ return false if @version.nil?
186
+ true
187
+ end
188
+
189
+ # Custom attribute writer method with validation
190
+ # @param [Object] action Value to be assigned
191
+ def action=(action)
192
+ if action.nil?
193
+ fail ArgumentError, 'action cannot be nil'
194
+ end
195
+
196
+ @action = action
197
+ end
198
+
199
+ # Custom attribute writer method with validation
200
+ # @param [Object] actor Value to be assigned
201
+ def actor=(actor)
202
+ if actor.nil?
203
+ fail ArgumentError, 'actor cannot be nil'
204
+ end
205
+
206
+ @actor = actor
207
+ end
208
+
209
+ # Custom attribute writer method with validation
210
+ # @param [Object] context Value to be assigned
211
+ def context=(context)
212
+ if context.nil?
213
+ fail ArgumentError, 'context cannot be nil'
214
+ end
215
+
216
+ @context = context
217
+ end
218
+
219
+ # Custom attribute writer method with validation
220
+ # @param [Object] metadata Value to be assigned
221
+ def metadata=(metadata)
222
+ if metadata.nil?
223
+ fail ArgumentError, 'metadata cannot be nil'
224
+ end
225
+
226
+ @metadata = metadata
227
+ end
228
+
229
+ # Custom attribute writer method with validation
230
+ # @param [Object] occurred_at Value to be assigned
231
+ def occurred_at=(occurred_at)
232
+ if occurred_at.nil?
233
+ fail ArgumentError, 'occurred_at cannot be nil'
234
+ end
235
+
236
+ @occurred_at = occurred_at
237
+ end
238
+
239
+ # Custom attribute writer method with validation
240
+ # @param [Object] targets Value to be assigned
241
+ def targets=(targets)
242
+ if targets.nil?
243
+ fail ArgumentError, 'targets cannot be nil'
244
+ end
245
+
246
+ @targets = targets
247
+ end
248
+
249
+ # Custom attribute writer method with validation
250
+ # @param [Object] version Value to be assigned
251
+ def version=(version)
252
+ if version.nil?
253
+ fail ArgumentError, 'version cannot be nil'
254
+ end
255
+
256
+ @version = version
257
+ end
258
+
259
+ # Checks equality by comparing each attribute.
260
+ # @param [Object] Object to be compared
261
+ def ==(o)
262
+ return true if self.equal?(o)
263
+ self.class == o.class &&
264
+ action == o.action &&
265
+ actor == o.actor &&
266
+ context == o.context &&
267
+ metadata == o.metadata &&
268
+ occurred_at == o.occurred_at &&
269
+ targets == o.targets &&
270
+ version == o.version
271
+ end
272
+
273
+ # @see the `==` method
274
+ # @param [Object] Object to be compared
275
+ def eql?(o)
276
+ self == o
277
+ end
278
+
279
+ # Calculates hash code according to all attributes.
280
+ # @return [Integer] Hash code
281
+ def hash
282
+ [action, actor, context, metadata, occurred_at, targets, version].hash
283
+ end
284
+
285
+ # Builds the object from hash
286
+ # @param [Hash] attributes Model attributes in the form of hash
287
+ # @return [Object] Returns the model itself
288
+ def self.build_from_hash(attributes)
289
+ return nil unless attributes.is_a?(Hash)
290
+ attributes = attributes.transform_keys(&:to_sym)
291
+ transformed_hash = {}
292
+ openapi_types.each_pair do |key, type|
293
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
294
+ transformed_hash["#{key}"] = nil
295
+ elsif type =~ /\AArray<(.*)>/i
296
+ # check to ensure the input is an array given that the attribute
297
+ # is documented as an array but the input is not
298
+ if attributes[attribute_map[key]].is_a?(Array)
299
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
300
+ end
301
+ elsif !attributes[attribute_map[key]].nil?
302
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
303
+ end
304
+ end
305
+ new(transformed_hash)
306
+ end
307
+
308
+ # Returns the object in the form of hash
309
+ # @return [Hash] Returns the object in the form of hash
310
+ def to_hash
311
+ hash = {}
312
+ self.class.attribute_map.each_pair do |attr, param|
313
+ value = self.send(attr)
314
+ if value.nil?
315
+ is_nullable = self.class.openapi_nullable.include?(attr)
316
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
317
+ end
318
+
319
+ hash[param] = _to_hash(value)
320
+ end
321
+ hash
322
+ end
323
+
324
+ end
325
+
326
+ end