phrase 2.8.7 → 2.10.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.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +19 -3
  3. data/docs/OrganizationJobTemplate.md +25 -0
  4. data/docs/OrganizationJobTemplateCreateParameters.md +19 -0
  5. data/docs/OrganizationJobTemplateDetails.md +31 -0
  6. data/docs/OrganizationJobTemplateLocaleUpdateParameters.md +27 -0
  7. data/docs/OrganizationJobTemplateLocalesApi.md +341 -0
  8. data/docs/OrganizationJobTemplateLocalesCreateParameters.md +27 -0
  9. data/docs/OrganizationJobTemplateUpdateParameters.md +19 -0
  10. data/docs/OrganizationJobTemplatesApi.md +331 -0
  11. data/docs/Release.md +2 -0
  12. data/docs/ReleaseCreateParameters.md +2 -0
  13. data/docs/ReleasePreview.md +2 -0
  14. data/lib/phrase/api/organization_job_template_locales_api.rb +408 -0
  15. data/lib/phrase/api/organization_job_templates_api.rb +378 -0
  16. data/lib/phrase/models/organization_job_template.rb +230 -0
  17. data/lib/phrase/models/organization_job_template_create_parameters.rb +210 -0
  18. data/lib/phrase/models/organization_job_template_details.rb +267 -0
  19. data/lib/phrase/models/organization_job_template_locale_update_parameters.rb +253 -0
  20. data/lib/phrase/models/organization_job_template_locales_create_parameters.rb +263 -0
  21. data/lib/phrase/models/organization_job_template_update_parameters.rb +210 -0
  22. data/lib/phrase/models/release.rb +12 -1
  23. data/lib/phrase/models/release_create_parameters.rb +13 -1
  24. data/lib/phrase/models/release_preview.rb +12 -1
  25. data/lib/phrase/version.rb +1 -1
  26. data/lib/phrase.rb +8 -0
  27. data/spec/api/organization_job_template_locales_api_spec.rb +100 -0
  28. data/spec/api/organization_job_templates_api_spec.rb +95 -0
  29. data/spec/models/organization_job_template_create_parameters_spec.rb +35 -0
  30. data/spec/models/organization_job_template_details_spec.rb +71 -0
  31. data/spec/models/organization_job_template_locale_update_parameters_spec.rb +59 -0
  32. data/spec/models/organization_job_template_locales_create_parameters_spec.rb +59 -0
  33. data/spec/models/organization_job_template_spec.rb +53 -0
  34. data/spec/models/organization_job_template_update_parameters_spec.rb +35 -0
  35. data/spec/models/release_create_parameters_spec.rb +6 -0
  36. data/spec/models/release_preview_spec.rb +6 -0
  37. data/spec/models/release_spec.rb +6 -0
  38. metadata +240 -208
@@ -0,0 +1,378 @@
1
+ require 'cgi'
2
+
3
+ module Phrase
4
+ class OrganizationJobTemplatesApi
5
+ attr_accessor :api_client
6
+
7
+ def initialize(api_client = ApiClient.default)
8
+ @api_client = api_client
9
+ end
10
+ # Create an organization job template
11
+ # Create a new organization job template.
12
+ # @param account_id [String] Account ID
13
+ # @param organization_job_template_create_parameters [OrganizationJobTemplateCreateParameters]
14
+ # @param [Hash] opts the optional parameters
15
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
16
+ # @return [OrganizationJobTemplateDetails]
17
+ def organization_job_template_create(account_id, organization_job_template_create_parameters, opts = {})
18
+ data, _status_code, _headers = organization_job_template_create_with_http_info(account_id, organization_job_template_create_parameters, opts)
19
+ data
20
+ end
21
+
22
+ # Create an organization job template
23
+ # Create a new organization job template.
24
+ # @param account_id [String] Account ID
25
+ # @param organization_job_template_create_parameters [OrganizationJobTemplateCreateParameters]
26
+ # @param [Hash] opts the optional parameters
27
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
28
+ # @return [Array<(Response<(OrganizationJobTemplateDetails)>, Integer, Hash)>] Response<(OrganizationJobTemplateDetails)> data, response status code and response headers
29
+ def organization_job_template_create_with_http_info(account_id, organization_job_template_create_parameters, opts = {})
30
+ if @api_client.config.debugging
31
+ @api_client.config.logger.debug 'Calling API: OrganizationJobTemplatesApi.organization_job_template_create ...'
32
+ end
33
+ # verify the required parameter 'account_id' is set
34
+ if @api_client.config.client_side_validation && account_id.nil?
35
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling OrganizationJobTemplatesApi.organization_job_template_create"
36
+ end
37
+ # verify the required parameter 'organization_job_template_create_parameters' is set
38
+ if @api_client.config.client_side_validation && organization_job_template_create_parameters.nil?
39
+ fail ArgumentError, "Missing the required parameter 'organization_job_template_create_parameters' when calling OrganizationJobTemplatesApi.organization_job_template_create"
40
+ end
41
+ # resource path
42
+ local_var_path = '/accounts/{account_id}/job_templates'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s))
43
+
44
+ # query parameters
45
+ query_params = opts[:query_params] || {}
46
+
47
+ # header parameters
48
+ header_params = opts[:header_params] || {}
49
+ # HTTP header 'Accept' (if needed)
50
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
51
+ # HTTP header 'Content-Type'
52
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
53
+ header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
54
+
55
+ # form parameters
56
+ form_params = opts[:form_params] || {}
57
+
58
+ # http body (model)
59
+ post_body = opts[:body] || @api_client.object_to_http_body(organization_job_template_create_parameters)
60
+
61
+ # return_type
62
+ return_type = opts[:return_type] || 'OrganizationJobTemplateDetails'
63
+
64
+ # auth_names
65
+ auth_names = opts[:auth_names] || ['Basic', 'Token']
66
+
67
+ new_options = opts.merge(
68
+ :header_params => header_params,
69
+ :query_params => query_params,
70
+ :form_params => form_params,
71
+ :body => post_body,
72
+ :auth_names => auth_names,
73
+ :return_type => return_type
74
+ )
75
+
76
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
77
+ if @api_client.config.debugging
78
+ @api_client.config.logger.debug "API called: OrganizationJobTemplatesApi#organization_job_template_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
79
+ end
80
+ response = ::Phrase::Response.new(data, headers)
81
+ return response, status_code, headers
82
+ end
83
+
84
+ # Delete an organization job template
85
+ # Delete an existing organization job template.
86
+ # @param account_id [String] Account ID
87
+ # @param id [String] ID
88
+ # @param [Hash] opts the optional parameters
89
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
90
+ # @return [nil]
91
+ def organization_job_template_delete(account_id, id, opts = {})
92
+ data, _status_code, _headers = organization_job_template_delete_with_http_info(account_id, id, opts)
93
+ data
94
+ end
95
+
96
+ # Delete an organization job template
97
+ # Delete an existing organization job template.
98
+ # @param account_id [String] Account ID
99
+ # @param id [String] ID
100
+ # @param [Hash] opts the optional parameters
101
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
102
+ # @return [Array<(Response, Integer, Hash)>] Response<(nil, response status code and response headers
103
+ def organization_job_template_delete_with_http_info(account_id, id, opts = {})
104
+ if @api_client.config.debugging
105
+ @api_client.config.logger.debug 'Calling API: OrganizationJobTemplatesApi.organization_job_template_delete ...'
106
+ end
107
+ # verify the required parameter 'account_id' is set
108
+ if @api_client.config.client_side_validation && account_id.nil?
109
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling OrganizationJobTemplatesApi.organization_job_template_delete"
110
+ end
111
+ # verify the required parameter 'id' is set
112
+ if @api_client.config.client_side_validation && id.nil?
113
+ fail ArgumentError, "Missing the required parameter 'id' when calling OrganizationJobTemplatesApi.organization_job_template_delete"
114
+ end
115
+ # resource path
116
+ local_var_path = '/accounts/{account_id}/job_templates/{id}'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))
117
+
118
+ # query parameters
119
+ query_params = opts[:query_params] || {}
120
+
121
+ # header parameters
122
+ header_params = opts[:header_params] || {}
123
+ header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
124
+
125
+ # form parameters
126
+ form_params = opts[:form_params] || {}
127
+
128
+ # http body (model)
129
+ post_body = opts[:body]
130
+
131
+ # return_type
132
+ return_type = opts[:return_type]
133
+
134
+ # auth_names
135
+ auth_names = opts[:auth_names] || ['Basic', 'Token']
136
+
137
+ new_options = opts.merge(
138
+ :header_params => header_params,
139
+ :query_params => query_params,
140
+ :form_params => form_params,
141
+ :body => post_body,
142
+ :auth_names => auth_names,
143
+ :return_type => return_type
144
+ )
145
+
146
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
147
+ if @api_client.config.debugging
148
+ @api_client.config.logger.debug "API called: OrganizationJobTemplatesApi#organization_job_template_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
149
+ end
150
+ response = ::Phrase::Response.new(data, headers)
151
+ return response, status_code, headers
152
+ end
153
+
154
+ # Update an organization job template
155
+ # Update an existing organization job template.
156
+ # @param account_id [String] Account ID
157
+ # @param id [String] ID
158
+ # @param organization_job_template_update_parameters [OrganizationJobTemplateUpdateParameters]
159
+ # @param [Hash] opts the optional parameters
160
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
161
+ # @return [OrganizationJobTemplateDetails]
162
+ def organization_job_template_update(account_id, id, organization_job_template_update_parameters, opts = {})
163
+ data, _status_code, _headers = organization_job_template_update_with_http_info(account_id, id, organization_job_template_update_parameters, opts)
164
+ data
165
+ end
166
+
167
+ # Update an organization job template
168
+ # Update an existing organization job template.
169
+ # @param account_id [String] Account ID
170
+ # @param id [String] ID
171
+ # @param organization_job_template_update_parameters [OrganizationJobTemplateUpdateParameters]
172
+ # @param [Hash] opts the optional parameters
173
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
174
+ # @return [Array<(Response<(OrganizationJobTemplateDetails)>, Integer, Hash)>] Response<(OrganizationJobTemplateDetails)> data, response status code and response headers
175
+ def organization_job_template_update_with_http_info(account_id, id, organization_job_template_update_parameters, opts = {})
176
+ if @api_client.config.debugging
177
+ @api_client.config.logger.debug 'Calling API: OrganizationJobTemplatesApi.organization_job_template_update ...'
178
+ end
179
+ # verify the required parameter 'account_id' is set
180
+ if @api_client.config.client_side_validation && account_id.nil?
181
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling OrganizationJobTemplatesApi.organization_job_template_update"
182
+ end
183
+ # verify the required parameter 'id' is set
184
+ if @api_client.config.client_side_validation && id.nil?
185
+ fail ArgumentError, "Missing the required parameter 'id' when calling OrganizationJobTemplatesApi.organization_job_template_update"
186
+ end
187
+ # verify the required parameter 'organization_job_template_update_parameters' is set
188
+ if @api_client.config.client_side_validation && organization_job_template_update_parameters.nil?
189
+ fail ArgumentError, "Missing the required parameter 'organization_job_template_update_parameters' when calling OrganizationJobTemplatesApi.organization_job_template_update"
190
+ end
191
+ # resource path
192
+ local_var_path = '/accounts/{account_id}/job_templates/{id}'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))
193
+
194
+ # query parameters
195
+ query_params = opts[:query_params] || {}
196
+
197
+ # header parameters
198
+ header_params = opts[:header_params] || {}
199
+ # HTTP header 'Accept' (if needed)
200
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
201
+ # HTTP header 'Content-Type'
202
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
203
+ header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
204
+
205
+ # form parameters
206
+ form_params = opts[:form_params] || {}
207
+
208
+ # http body (model)
209
+ post_body = opts[:body] || @api_client.object_to_http_body(organization_job_template_update_parameters)
210
+
211
+ # return_type
212
+ return_type = opts[:return_type] || 'OrganizationJobTemplateDetails'
213
+
214
+ # auth_names
215
+ auth_names = opts[:auth_names] || ['Basic', 'Token']
216
+
217
+ new_options = opts.merge(
218
+ :header_params => header_params,
219
+ :query_params => query_params,
220
+ :form_params => form_params,
221
+ :body => post_body,
222
+ :auth_names => auth_names,
223
+ :return_type => return_type
224
+ )
225
+
226
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
227
+ if @api_client.config.debugging
228
+ @api_client.config.logger.debug "API called: OrganizationJobTemplatesApi#organization_job_template_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
229
+ end
230
+ response = ::Phrase::Response.new(data, headers)
231
+ return response, status_code, headers
232
+ end
233
+
234
+ # List organization job templates
235
+ # List all job templates for the given account.
236
+ # @param account_id [String] Account ID
237
+ # @param [Hash] opts the optional parameters
238
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
239
+ # @option opts [Integer] :page Page number
240
+ # @option opts [Integer] :per_page Limit on the number of objects to be returned, between 1 and 100. 25 by default
241
+ # @return [Array<OrganizationJobTemplate>]
242
+ def organization_job_templates_list(account_id, opts = {})
243
+ data, _status_code, _headers = organization_job_templates_list_with_http_info(account_id, opts)
244
+ data
245
+ end
246
+
247
+ # List organization job templates
248
+ # List all job templates for the given account.
249
+ # @param account_id [String] Account ID
250
+ # @param [Hash] opts the optional parameters
251
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
252
+ # @option opts [Integer] :page Page number
253
+ # @option opts [Integer] :per_page Limit on the number of objects to be returned, between 1 and 100. 25 by default
254
+ # @return [Array<(Response<(Array<OrganizationJobTemplate>)>, Integer, Hash)>] Response<(Array<OrganizationJobTemplate>)> data, response status code and response headers
255
+ def organization_job_templates_list_with_http_info(account_id, opts = {})
256
+ if @api_client.config.debugging
257
+ @api_client.config.logger.debug 'Calling API: OrganizationJobTemplatesApi.organization_job_templates_list ...'
258
+ end
259
+ # verify the required parameter 'account_id' is set
260
+ if @api_client.config.client_side_validation && account_id.nil?
261
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling OrganizationJobTemplatesApi.organization_job_templates_list"
262
+ end
263
+ # resource path
264
+ local_var_path = '/accounts/{account_id}/job_templates'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s))
265
+
266
+ # query parameters
267
+ query_params = opts[:query_params] || {}
268
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
269
+ query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
270
+
271
+ # header parameters
272
+ header_params = opts[:header_params] || {}
273
+ # HTTP header 'Accept' (if needed)
274
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
275
+ header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
276
+
277
+ # form parameters
278
+ form_params = opts[:form_params] || {}
279
+
280
+ # http body (model)
281
+ post_body = opts[:body]
282
+
283
+ # return_type
284
+ return_type = opts[:return_type] || 'Array<OrganizationJobTemplate>'
285
+
286
+ # auth_names
287
+ auth_names = opts[:auth_names] || ['Basic', 'Token']
288
+
289
+ new_options = opts.merge(
290
+ :header_params => header_params,
291
+ :query_params => query_params,
292
+ :form_params => form_params,
293
+ :body => post_body,
294
+ :auth_names => auth_names,
295
+ :return_type => return_type
296
+ )
297
+
298
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
299
+ if @api_client.config.debugging
300
+ @api_client.config.logger.debug "API called: OrganizationJobTemplatesApi#organization_job_templates_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
301
+ end
302
+ response = ::Phrase::Response.new(data, headers)
303
+ return response, status_code, headers
304
+ end
305
+
306
+ # Get a single organization job template
307
+ # Get details on a single organization job template for a given account.
308
+ # @param account_id [String] Account ID
309
+ # @param id [String] ID
310
+ # @param [Hash] opts the optional parameters
311
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
312
+ # @return [OrganizationJobTemplateDetails]
313
+ def organization_job_templates_show(account_id, id, opts = {})
314
+ data, _status_code, _headers = organization_job_templates_show_with_http_info(account_id, id, opts)
315
+ data
316
+ end
317
+
318
+ # Get a single organization job template
319
+ # Get details on a single organization job template for a given account.
320
+ # @param account_id [String] Account ID
321
+ # @param id [String] ID
322
+ # @param [Hash] opts the optional parameters
323
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
324
+ # @return [Array<(Response<(OrganizationJobTemplateDetails)>, Integer, Hash)>] Response<(OrganizationJobTemplateDetails)> data, response status code and response headers
325
+ def organization_job_templates_show_with_http_info(account_id, id, opts = {})
326
+ if @api_client.config.debugging
327
+ @api_client.config.logger.debug 'Calling API: OrganizationJobTemplatesApi.organization_job_templates_show ...'
328
+ end
329
+ # verify the required parameter 'account_id' is set
330
+ if @api_client.config.client_side_validation && account_id.nil?
331
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling OrganizationJobTemplatesApi.organization_job_templates_show"
332
+ end
333
+ # verify the required parameter 'id' is set
334
+ if @api_client.config.client_side_validation && id.nil?
335
+ fail ArgumentError, "Missing the required parameter 'id' when calling OrganizationJobTemplatesApi.organization_job_templates_show"
336
+ end
337
+ # resource path
338
+ local_var_path = '/accounts/{account_id}/job_templates/{id}'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))
339
+
340
+ # query parameters
341
+ query_params = opts[:query_params] || {}
342
+
343
+ # header parameters
344
+ header_params = opts[:header_params] || {}
345
+ # HTTP header 'Accept' (if needed)
346
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
347
+ header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
348
+
349
+ # form parameters
350
+ form_params = opts[:form_params] || {}
351
+
352
+ # http body (model)
353
+ post_body = opts[:body]
354
+
355
+ # return_type
356
+ return_type = opts[:return_type] || 'OrganizationJobTemplateDetails'
357
+
358
+ # auth_names
359
+ auth_names = opts[:auth_names] || ['Basic', 'Token']
360
+
361
+ new_options = opts.merge(
362
+ :header_params => header_params,
363
+ :query_params => query_params,
364
+ :form_params => form_params,
365
+ :body => post_body,
366
+ :auth_names => auth_names,
367
+ :return_type => return_type
368
+ )
369
+
370
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
371
+ if @api_client.config.debugging
372
+ @api_client.config.logger.debug "API called: OrganizationJobTemplatesApi#organization_job_templates_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
373
+ end
374
+ response = ::Phrase::Response.new(data, headers)
375
+ return response, status_code, headers
376
+ end
377
+ end
378
+ end
@@ -0,0 +1,230 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class OrganizationJobTemplate
5
+ attr_accessor :id
6
+
7
+ attr_accessor :name
8
+
9
+ attr_accessor :briefing
10
+
11
+ attr_accessor :created_at
12
+
13
+ attr_accessor :updated_at
14
+
15
+ # Attribute mapping from ruby-style variable name to JSON key.
16
+ def self.attribute_map
17
+ {
18
+ :'id' => :'id',
19
+ :'name' => :'name',
20
+ :'briefing' => :'briefing',
21
+ :'created_at' => :'created_at',
22
+ :'updated_at' => :'updated_at'
23
+ }
24
+ end
25
+
26
+ # Attribute type mapping.
27
+ def self.openapi_types
28
+ {
29
+ :'id' => :'String',
30
+ :'name' => :'String',
31
+ :'briefing' => :'String',
32
+ :'created_at' => :'DateTime',
33
+ :'updated_at' => :'DateTime'
34
+ }
35
+ end
36
+
37
+ # List of attributes with nullable: true
38
+ def self.openapi_nullable
39
+ Set.new([
40
+ ])
41
+ end
42
+
43
+ # Initializes the object
44
+ # @param [Hash] attributes Model attributes in the form of hash
45
+ def initialize(attributes = {})
46
+ if (!attributes.is_a?(Hash))
47
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::OrganizationJobTemplate` initialize method"
48
+ end
49
+
50
+ # check to see if the attribute exists and convert string to symbol for hash key
51
+ attributes = attributes.each_with_object({}) { |(k, v), h|
52
+ if (!self.class.attribute_map.key?(k.to_sym))
53
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::OrganizationJobTemplate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
54
+ end
55
+ h[k.to_sym] = v
56
+ }
57
+
58
+ if attributes.key?(:'id')
59
+ self.id = attributes[:'id']
60
+ end
61
+
62
+ if attributes.key?(:'name')
63
+ self.name = attributes[:'name']
64
+ end
65
+
66
+ if attributes.key?(:'briefing')
67
+ self.briefing = attributes[:'briefing']
68
+ end
69
+
70
+ if attributes.key?(:'created_at')
71
+ self.created_at = attributes[:'created_at']
72
+ end
73
+
74
+ if attributes.key?(:'updated_at')
75
+ self.updated_at = attributes[:'updated_at']
76
+ end
77
+ end
78
+
79
+ # Show invalid properties with the reasons. Usually used together with valid?
80
+ # @return Array for valid properties with the reasons
81
+ def list_invalid_properties
82
+ invalid_properties = Array.new
83
+ invalid_properties
84
+ end
85
+
86
+ # Check to see if the all the properties in the model are valid
87
+ # @return true if the model is valid
88
+ def valid?
89
+ true
90
+ end
91
+
92
+ # Checks equality by comparing each attribute.
93
+ # @param [Object] Object to be compared
94
+ def ==(o)
95
+ return true if self.equal?(o)
96
+ self.class == o.class &&
97
+ id == o.id &&
98
+ name == o.name &&
99
+ briefing == o.briefing &&
100
+ created_at == o.created_at &&
101
+ updated_at == o.updated_at
102
+ end
103
+
104
+ # @see the `==` method
105
+ # @param [Object] Object to be compared
106
+ def eql?(o)
107
+ self == o
108
+ end
109
+
110
+ # Calculates hash code according to all attributes.
111
+ # @return [Integer] Hash code
112
+ def hash
113
+ [id, name, briefing, created_at, updated_at].hash
114
+ end
115
+
116
+ # Builds the object from hash
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ # @return [Object] Returns the model itself
119
+ def self.build_from_hash(attributes)
120
+ new.build_from_hash(attributes)
121
+ end
122
+
123
+ # Builds the object from hash
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ # @return [Object] Returns the model itself
126
+ def build_from_hash(attributes)
127
+ return nil unless attributes.is_a?(Hash)
128
+ self.class.openapi_types.each_pair do |key, type|
129
+ if type =~ /\AArray<(.*)>/i
130
+ # check to ensure the input is an array given that the attribute
131
+ # is documented as an array but the input is not
132
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
133
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
134
+ end
135
+ elsif !attributes[self.class.attribute_map[key]].nil?
136
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
137
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
138
+ end
139
+
140
+ self
141
+ end
142
+
143
+ # Deserializes the data based on type
144
+ # @param string type Data type
145
+ # @param string value Value to be deserialized
146
+ # @return [Object] Deserialized data
147
+ def _deserialize(type, value)
148
+ case type.to_sym
149
+ when :DateTime
150
+ DateTime.parse(value)
151
+ when :Date
152
+ Date.parse(value)
153
+ when :String
154
+ value.to_s
155
+ when :Integer
156
+ value.to_i
157
+ when :Float
158
+ value.to_f
159
+ when :Boolean
160
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
161
+ true
162
+ else
163
+ false
164
+ end
165
+ when :Object
166
+ # generic object (usually a Hash), return directly
167
+ value
168
+ when /\AArray<(?<inner_type>.+)>\z/
169
+ inner_type = Regexp.last_match[:inner_type]
170
+ value.map { |v| _deserialize(inner_type, v) }
171
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
172
+ k_type = Regexp.last_match[:k_type]
173
+ v_type = Regexp.last_match[:v_type]
174
+ {}.tap do |hash|
175
+ value.each do |k, v|
176
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
177
+ end
178
+ end
179
+ else # model
180
+ Phrase.const_get(type).build_from_hash(value)
181
+ end
182
+ end
183
+
184
+ # Returns the string representation of the object
185
+ # @return [String] String presentation of the object
186
+ def to_s
187
+ to_hash.to_s
188
+ end
189
+
190
+ # to_body is an alias to to_hash (backward compatibility)
191
+ # @return [Hash] Returns the object in the form of hash
192
+ def to_body
193
+ to_hash
194
+ end
195
+
196
+ # Returns the object in the form of hash
197
+ # @return [Hash] Returns the object in the form of hash
198
+ def to_hash
199
+ hash = {}
200
+ self.class.attribute_map.each_pair do |attr, param|
201
+ value = self.send(attr)
202
+ if value.nil?
203
+ is_nullable = self.class.openapi_nullable.include?(attr)
204
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
205
+ end
206
+
207
+ hash[param] = _to_hash(value)
208
+ end
209
+ hash
210
+ end
211
+
212
+ # Outputs non-array value in the form of hash
213
+ # For object, use to_hash. Otherwise, just return the value
214
+ # @param [Object] value Any valid value
215
+ # @return [Hash] Returns the value in the form of hash
216
+ def _to_hash(value)
217
+ if value.is_a?(Array)
218
+ value.compact.map { |v| _to_hash(v) }
219
+ elsif value.is_a?(Hash)
220
+ {}.tap do |hash|
221
+ value.each { |k, v| hash[k] = _to_hash(v) }
222
+ end
223
+ elsif value.respond_to? :to_hash
224
+ value.to_hash
225
+ else
226
+ value
227
+ end
228
+ end
229
+ end
230
+ end