phrase 3.1.1 → 3.2.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.
@@ -0,0 +1,402 @@
1
+ require 'cgi'
2
+
3
+ module Phrase
4
+ class ReleaseTriggersApi
5
+ attr_accessor :api_client
6
+
7
+ def initialize(api_client = ApiClient.default)
8
+ @api_client = api_client
9
+ end
10
+ # Create a release trigger
11
+ # Create a new recurring release. New releases will be published automatically, based on the cron schedule provided. Currently, only one release trigger can exist per distribution.
12
+ # @param account_id [String] Account ID
13
+ # @param distribution_id [String] Distribution ID
14
+ # @param release_create_parameters1 [ReleaseCreateParameters1]
15
+ # @param [Hash] opts the optional parameters
16
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
17
+ # @return [ReleaseTrigger]
18
+ def release_triggers_create(account_id, distribution_id, release_create_parameters1, opts = {})
19
+ data, _status_code, _headers = release_triggers_create_with_http_info(account_id, distribution_id, release_create_parameters1, opts)
20
+ data
21
+ end
22
+
23
+ # Create a release trigger
24
+ # Create a new recurring release. New releases will be published automatically, based on the cron schedule provided. Currently, only one release trigger can exist per distribution.
25
+ # @param account_id [String] Account ID
26
+ # @param distribution_id [String] Distribution ID
27
+ # @param release_create_parameters1 [ReleaseCreateParameters1]
28
+ # @param [Hash] opts the optional parameters
29
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
30
+ # @return [Array<(Response<(ReleaseTrigger)>, Integer, Hash)>] Response<(ReleaseTrigger)> data, response status code and response headers
31
+ def release_triggers_create_with_http_info(account_id, distribution_id, release_create_parameters1, opts = {})
32
+ if @api_client.config.debugging
33
+ @api_client.config.logger.debug 'Calling API: ReleaseTriggersApi.release_triggers_create ...'
34
+ end
35
+ # verify the required parameter 'account_id' is set
36
+ if @api_client.config.client_side_validation && account_id.nil?
37
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling ReleaseTriggersApi.release_triggers_create"
38
+ end
39
+ # verify the required parameter 'distribution_id' is set
40
+ if @api_client.config.client_side_validation && distribution_id.nil?
41
+ fail ArgumentError, "Missing the required parameter 'distribution_id' when calling ReleaseTriggersApi.release_triggers_create"
42
+ end
43
+ # verify the required parameter 'release_create_parameters1' is set
44
+ if @api_client.config.client_side_validation && release_create_parameters1.nil?
45
+ fail ArgumentError, "Missing the required parameter 'release_create_parameters1' when calling ReleaseTriggersApi.release_triggers_create"
46
+ end
47
+ # resource path
48
+ local_var_path = '/accounts/{account_id}/distributions/{distribution_id}/release_triggers'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'distribution_id' + '}', CGI.escape(distribution_id.to_s))
49
+
50
+ # query parameters
51
+ query_params = opts[:query_params] || {}
52
+
53
+ # header parameters
54
+ header_params = opts[:header_params] || {}
55
+ # HTTP header 'Accept' (if needed)
56
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
57
+ # HTTP header 'Content-Type'
58
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
59
+ header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
60
+
61
+ # form parameters
62
+ form_params = opts[:form_params] || {}
63
+
64
+ # http body (model)
65
+ post_body = opts[:body] || @api_client.object_to_http_body(release_create_parameters1)
66
+
67
+ # return_type
68
+ return_type = opts[:return_type] || 'ReleaseTrigger'
69
+
70
+ # auth_names
71
+ auth_names = opts[:auth_names] || ['Basic', 'Token']
72
+
73
+ new_options = opts.merge(
74
+ :header_params => header_params,
75
+ :query_params => query_params,
76
+ :form_params => form_params,
77
+ :body => post_body,
78
+ :auth_names => auth_names,
79
+ :return_type => return_type
80
+ )
81
+
82
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
83
+ if @api_client.config.debugging
84
+ @api_client.config.logger.debug "API called: ReleaseTriggersApi#release_triggers_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
85
+ end
86
+ response = ::Phrase::Response.new(data, headers)
87
+ return response, status_code, headers
88
+ end
89
+
90
+ # Delete a single release trigger
91
+ # Delete a single release trigger.
92
+ # @param account_id [String] Account ID
93
+ # @param distribution_id [String] Distribution ID
94
+ # @param id [String] ID
95
+ # @param [Hash] opts the optional parameters
96
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
97
+ # @return [nil]
98
+ def release_triggers_destroy(account_id, distribution_id, id, opts = {})
99
+ data, _status_code, _headers = release_triggers_destroy_with_http_info(account_id, distribution_id, id, opts)
100
+ data
101
+ end
102
+
103
+ # Delete a single release trigger
104
+ # Delete a single release trigger.
105
+ # @param account_id [String] Account ID
106
+ # @param distribution_id [String] Distribution ID
107
+ # @param id [String] ID
108
+ # @param [Hash] opts the optional parameters
109
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
110
+ # @return [Array<(Response, Integer, Hash)>] Response<(nil, response status code and response headers
111
+ def release_triggers_destroy_with_http_info(account_id, distribution_id, id, opts = {})
112
+ if @api_client.config.debugging
113
+ @api_client.config.logger.debug 'Calling API: ReleaseTriggersApi.release_triggers_destroy ...'
114
+ end
115
+ # verify the required parameter 'account_id' is set
116
+ if @api_client.config.client_side_validation && account_id.nil?
117
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling ReleaseTriggersApi.release_triggers_destroy"
118
+ end
119
+ # verify the required parameter 'distribution_id' is set
120
+ if @api_client.config.client_side_validation && distribution_id.nil?
121
+ fail ArgumentError, "Missing the required parameter 'distribution_id' when calling ReleaseTriggersApi.release_triggers_destroy"
122
+ end
123
+ # verify the required parameter 'id' is set
124
+ if @api_client.config.client_side_validation && id.nil?
125
+ fail ArgumentError, "Missing the required parameter 'id' when calling ReleaseTriggersApi.release_triggers_destroy"
126
+ end
127
+ # resource path
128
+ local_var_path = '/accounts/{account_id}/distributions/{distribution_id}/release_triggers/{id}'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'distribution_id' + '}', CGI.escape(distribution_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))
129
+
130
+ # query parameters
131
+ query_params = opts[:query_params] || {}
132
+
133
+ # header parameters
134
+ header_params = opts[:header_params] || {}
135
+ header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
136
+
137
+ # form parameters
138
+ form_params = opts[:form_params] || {}
139
+
140
+ # http body (model)
141
+ post_body = opts[:body]
142
+
143
+ # return_type
144
+ return_type = opts[:return_type]
145
+
146
+ # auth_names
147
+ auth_names = opts[:auth_names] || ['Basic', 'Token']
148
+
149
+ new_options = opts.merge(
150
+ :header_params => header_params,
151
+ :query_params => query_params,
152
+ :form_params => form_params,
153
+ :body => post_body,
154
+ :auth_names => auth_names,
155
+ :return_type => return_type
156
+ )
157
+
158
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
159
+ if @api_client.config.debugging
160
+ @api_client.config.logger.debug "API called: ReleaseTriggersApi#release_triggers_destroy\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
161
+ end
162
+ response = ::Phrase::Response.new(data, headers)
163
+ return response, status_code, headers
164
+ end
165
+
166
+ # List release triggers
167
+ # List all release triggers for the given distribution.<br> Note: Currently only one release trigger can exist per distribution.
168
+ # @param account_id [String] Account ID
169
+ # @param distribution_id [String] Distribution ID
170
+ # @param [Hash] opts the optional parameters
171
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
172
+ # @return [Array<ReleaseTrigger>]
173
+ def release_triggers_list(account_id, distribution_id, opts = {})
174
+ data, _status_code, _headers = release_triggers_list_with_http_info(account_id, distribution_id, opts)
175
+ data
176
+ end
177
+
178
+ # List release triggers
179
+ # List all release triggers for the given distribution.&lt;br&gt; Note: Currently only one release trigger can exist per distribution.
180
+ # @param account_id [String] Account ID
181
+ # @param distribution_id [String] Distribution ID
182
+ # @param [Hash] opts the optional parameters
183
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
184
+ # @return [Array<(Response<(Array<ReleaseTrigger>)>, Integer, Hash)>] Response<(Array<ReleaseTrigger>)> data, response status code and response headers
185
+ def release_triggers_list_with_http_info(account_id, distribution_id, opts = {})
186
+ if @api_client.config.debugging
187
+ @api_client.config.logger.debug 'Calling API: ReleaseTriggersApi.release_triggers_list ...'
188
+ end
189
+ # verify the required parameter 'account_id' is set
190
+ if @api_client.config.client_side_validation && account_id.nil?
191
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling ReleaseTriggersApi.release_triggers_list"
192
+ end
193
+ # verify the required parameter 'distribution_id' is set
194
+ if @api_client.config.client_side_validation && distribution_id.nil?
195
+ fail ArgumentError, "Missing the required parameter 'distribution_id' when calling ReleaseTriggersApi.release_triggers_list"
196
+ end
197
+ # resource path
198
+ local_var_path = '/accounts/{account_id}/distributions/{distribution_id}/release_triggers'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'distribution_id' + '}', CGI.escape(distribution_id.to_s))
199
+
200
+ # query parameters
201
+ query_params = opts[:query_params] || {}
202
+
203
+ # header parameters
204
+ header_params = opts[:header_params] || {}
205
+ # HTTP header 'Accept' (if needed)
206
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
207
+ header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
208
+
209
+ # form parameters
210
+ form_params = opts[:form_params] || {}
211
+
212
+ # http body (model)
213
+ post_body = opts[:body]
214
+
215
+ # return_type
216
+ return_type = opts[:return_type] || 'Array<ReleaseTrigger>'
217
+
218
+ # auth_names
219
+ auth_names = opts[:auth_names] || ['Basic', 'Token']
220
+
221
+ new_options = opts.merge(
222
+ :header_params => header_params,
223
+ :query_params => query_params,
224
+ :form_params => form_params,
225
+ :body => post_body,
226
+ :auth_names => auth_names,
227
+ :return_type => return_type
228
+ )
229
+
230
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
231
+ if @api_client.config.debugging
232
+ @api_client.config.logger.debug "API called: ReleaseTriggersApi#release_triggers_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
233
+ end
234
+ response = ::Phrase::Response.new(data, headers)
235
+ return response, status_code, headers
236
+ end
237
+
238
+ # Get a single release trigger
239
+ # Get details of a single release trigger.
240
+ # @param account_id [String] Account ID
241
+ # @param distribution_id [String] Distribution ID
242
+ # @param id [String] ID
243
+ # @param [Hash] opts the optional parameters
244
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
245
+ # @return [ReleaseTrigger]
246
+ def release_triggers_show(account_id, distribution_id, id, opts = {})
247
+ data, _status_code, _headers = release_triggers_show_with_http_info(account_id, distribution_id, id, opts)
248
+ data
249
+ end
250
+
251
+ # Get a single release trigger
252
+ # Get details of a single release trigger.
253
+ # @param account_id [String] Account ID
254
+ # @param distribution_id [String] Distribution ID
255
+ # @param id [String] ID
256
+ # @param [Hash] opts the optional parameters
257
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
258
+ # @return [Array<(Response<(ReleaseTrigger)>, Integer, Hash)>] Response<(ReleaseTrigger)> data, response status code and response headers
259
+ def release_triggers_show_with_http_info(account_id, distribution_id, id, opts = {})
260
+ if @api_client.config.debugging
261
+ @api_client.config.logger.debug 'Calling API: ReleaseTriggersApi.release_triggers_show ...'
262
+ end
263
+ # verify the required parameter 'account_id' is set
264
+ if @api_client.config.client_side_validation && account_id.nil?
265
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling ReleaseTriggersApi.release_triggers_show"
266
+ end
267
+ # verify the required parameter 'distribution_id' is set
268
+ if @api_client.config.client_side_validation && distribution_id.nil?
269
+ fail ArgumentError, "Missing the required parameter 'distribution_id' when calling ReleaseTriggersApi.release_triggers_show"
270
+ end
271
+ # verify the required parameter 'id' is set
272
+ if @api_client.config.client_side_validation && id.nil?
273
+ fail ArgumentError, "Missing the required parameter 'id' when calling ReleaseTriggersApi.release_triggers_show"
274
+ end
275
+ # resource path
276
+ local_var_path = '/accounts/{account_id}/distributions/{distribution_id}/release_triggers/{id}'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'distribution_id' + '}', CGI.escape(distribution_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))
277
+
278
+ # query parameters
279
+ query_params = opts[:query_params] || {}
280
+
281
+ # header parameters
282
+ header_params = opts[:header_params] || {}
283
+ # HTTP header 'Accept' (if needed)
284
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
285
+ header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
286
+
287
+ # form parameters
288
+ form_params = opts[:form_params] || {}
289
+
290
+ # http body (model)
291
+ post_body = opts[:body]
292
+
293
+ # return_type
294
+ return_type = opts[:return_type] || 'ReleaseTrigger'
295
+
296
+ # auth_names
297
+ auth_names = opts[:auth_names] || ['Basic', 'Token']
298
+
299
+ new_options = opts.merge(
300
+ :header_params => header_params,
301
+ :query_params => query_params,
302
+ :form_params => form_params,
303
+ :body => post_body,
304
+ :auth_names => auth_names,
305
+ :return_type => return_type
306
+ )
307
+
308
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
309
+ if @api_client.config.debugging
310
+ @api_client.config.logger.debug "API called: ReleaseTriggersApi#release_triggers_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
311
+ end
312
+ response = ::Phrase::Response.new(data, headers)
313
+ return response, status_code, headers
314
+ end
315
+
316
+ # Update a release trigger
317
+ # Update a recurring release.
318
+ # @param account_id [String] Account ID
319
+ # @param distribution_id [String] Distribution ID
320
+ # @param id [String] ID
321
+ # @param release_update_parameters1 [ReleaseUpdateParameters1]
322
+ # @param [Hash] opts the optional parameters
323
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
324
+ # @return [ReleaseTrigger]
325
+ def release_triggers_update(account_id, distribution_id, id, release_update_parameters1, opts = {})
326
+ data, _status_code, _headers = release_triggers_update_with_http_info(account_id, distribution_id, id, release_update_parameters1, opts)
327
+ data
328
+ end
329
+
330
+ # Update a release trigger
331
+ # Update a recurring release.
332
+ # @param account_id [String] Account ID
333
+ # @param distribution_id [String] Distribution ID
334
+ # @param id [String] ID
335
+ # @param release_update_parameters1 [ReleaseUpdateParameters1]
336
+ # @param [Hash] opts the optional parameters
337
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
338
+ # @return [Array<(Response<(ReleaseTrigger)>, Integer, Hash)>] Response<(ReleaseTrigger)> data, response status code and response headers
339
+ def release_triggers_update_with_http_info(account_id, distribution_id, id, release_update_parameters1, opts = {})
340
+ if @api_client.config.debugging
341
+ @api_client.config.logger.debug 'Calling API: ReleaseTriggersApi.release_triggers_update ...'
342
+ end
343
+ # verify the required parameter 'account_id' is set
344
+ if @api_client.config.client_side_validation && account_id.nil?
345
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling ReleaseTriggersApi.release_triggers_update"
346
+ end
347
+ # verify the required parameter 'distribution_id' is set
348
+ if @api_client.config.client_side_validation && distribution_id.nil?
349
+ fail ArgumentError, "Missing the required parameter 'distribution_id' when calling ReleaseTriggersApi.release_triggers_update"
350
+ end
351
+ # verify the required parameter 'id' is set
352
+ if @api_client.config.client_side_validation && id.nil?
353
+ fail ArgumentError, "Missing the required parameter 'id' when calling ReleaseTriggersApi.release_triggers_update"
354
+ end
355
+ # verify the required parameter 'release_update_parameters1' is set
356
+ if @api_client.config.client_side_validation && release_update_parameters1.nil?
357
+ fail ArgumentError, "Missing the required parameter 'release_update_parameters1' when calling ReleaseTriggersApi.release_triggers_update"
358
+ end
359
+ # resource path
360
+ local_var_path = '/accounts/{account_id}/distributions/{distribution_id}/release_triggers/{id}'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)).sub('{' + 'distribution_id' + '}', CGI.escape(distribution_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))
361
+
362
+ # query parameters
363
+ query_params = opts[:query_params] || {}
364
+
365
+ # header parameters
366
+ header_params = opts[:header_params] || {}
367
+ # HTTP header 'Accept' (if needed)
368
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
369
+ # HTTP header 'Content-Type'
370
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
371
+ header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
372
+
373
+ # form parameters
374
+ form_params = opts[:form_params] || {}
375
+
376
+ # http body (model)
377
+ post_body = opts[:body] || @api_client.object_to_http_body(release_update_parameters1)
378
+
379
+ # return_type
380
+ return_type = opts[:return_type] || 'ReleaseTrigger'
381
+
382
+ # auth_names
383
+ auth_names = opts[:auth_names] || ['Basic', 'Token']
384
+
385
+ new_options = opts.merge(
386
+ :header_params => header_params,
387
+ :query_params => query_params,
388
+ :form_params => form_params,
389
+ :body => post_body,
390
+ :auth_names => auth_names,
391
+ :return_type => return_type
392
+ )
393
+
394
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
395
+ if @api_client.config.debugging
396
+ @api_client.config.logger.debug "API called: ReleaseTriggersApi#release_triggers_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
397
+ end
398
+ response = ::Phrase::Response.new(data, headers)
399
+ return response, status_code, headers
400
+ end
401
+ end
402
+ end
@@ -54,10 +54,10 @@ module Phrase
54
54
  def self.openapi_types
55
55
  {
56
56
  :'keys_count' => :'Integer',
57
- :'translated_translations_percentage' => :'Integer',
58
- :'unverified_translations_percentage' => :'Integer',
59
- :'reviewed_translations_percentage' => :'Integer',
60
- :'untranslated_keys_percentage' => :'Integer',
57
+ :'translated_translations_percentage' => :'Float',
58
+ :'unverified_translations_percentage' => :'Float',
59
+ :'reviewed_translations_percentage' => :'Float',
60
+ :'untranslated_keys_percentage' => :'Float',
61
61
  :'completed_translations_count' => :'Integer',
62
62
  :'untranslated_keys_count' => :'Integer',
63
63
  :'unverified_translations_count' => :'Integer',
@@ -0,0 +1,261 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class ReleaseCreateParameters1
5
+ # Cron schedule for the scheduler. Read more about the format of this field at https://en.wikipedia.org/wiki/Cron
6
+ attr_accessor :cron_schedule
7
+
8
+ # Time zone for the scheduler
9
+ attr_accessor :time_zone
10
+
11
+ # List of locale ids that will be included in the release.
12
+ attr_accessor :locale_ids
13
+
14
+ # Only include tagged keys in the release. For a key to be included it must be tagged with all tags provided
15
+ attr_accessor :tags
16
+
17
+ # Branch used for release
18
+ attr_accessor :branch
19
+
20
+ # The created releases will be available only for apps with version greater or equal to this value
21
+ attr_accessor :app_min_version
22
+
23
+ # The created releases will be available only for apps with version less or equal to this value
24
+ attr_accessor :app_max_version
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'cron_schedule' => :'cron_schedule',
30
+ :'time_zone' => :'time_zone',
31
+ :'locale_ids' => :'locale_ids',
32
+ :'tags' => :'tags',
33
+ :'branch' => :'branch',
34
+ :'app_min_version' => :'app_min_version',
35
+ :'app_max_version' => :'app_max_version'
36
+ }
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.openapi_types
41
+ {
42
+ :'cron_schedule' => :'String',
43
+ :'time_zone' => :'String',
44
+ :'locale_ids' => :'Array<String>',
45
+ :'tags' => :'Array<String>',
46
+ :'branch' => :'String',
47
+ :'app_min_version' => :'String',
48
+ :'app_max_version' => :'String'
49
+ }
50
+ end
51
+
52
+ # List of attributes with nullable: true
53
+ def self.openapi_nullable
54
+ Set.new([
55
+ ])
56
+ end
57
+
58
+ # Initializes the object
59
+ # @param [Hash] attributes Model attributes in the form of hash
60
+ def initialize(attributes = {})
61
+ if (!attributes.is_a?(Hash))
62
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::ReleaseCreateParameters1` initialize method"
63
+ end
64
+
65
+ # check to see if the attribute exists and convert string to symbol for hash key
66
+ attributes = attributes.each_with_object({}) { |(k, v), h|
67
+ if (!self.class.attribute_map.key?(k.to_sym))
68
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::ReleaseCreateParameters1`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
69
+ end
70
+ h[k.to_sym] = v
71
+ }
72
+
73
+ if attributes.key?(:'cron_schedule')
74
+ self.cron_schedule = attributes[:'cron_schedule']
75
+ end
76
+
77
+ if attributes.key?(:'time_zone')
78
+ self.time_zone = attributes[:'time_zone']
79
+ end
80
+
81
+ if attributes.key?(:'locale_ids')
82
+ if (value = attributes[:'locale_ids']).is_a?(Array)
83
+ self.locale_ids = value
84
+ end
85
+ end
86
+
87
+ if attributes.key?(:'tags')
88
+ if (value = attributes[:'tags']).is_a?(Array)
89
+ self.tags = value
90
+ end
91
+ end
92
+
93
+ if attributes.key?(:'branch')
94
+ self.branch = attributes[:'branch']
95
+ end
96
+
97
+ if attributes.key?(:'app_min_version')
98
+ self.app_min_version = attributes[:'app_min_version']
99
+ end
100
+
101
+ if attributes.key?(:'app_max_version')
102
+ self.app_max_version = attributes[:'app_max_version']
103
+ end
104
+ end
105
+
106
+ # Show invalid properties with the reasons. Usually used together with valid?
107
+ # @return Array for valid properties with the reasons
108
+ def list_invalid_properties
109
+ invalid_properties = Array.new
110
+ invalid_properties
111
+ end
112
+
113
+ # Check to see if the all the properties in the model are valid
114
+ # @return true if the model is valid
115
+ def valid?
116
+ true
117
+ end
118
+
119
+ # Checks equality by comparing each attribute.
120
+ # @param [Object] Object to be compared
121
+ def ==(o)
122
+ return true if self.equal?(o)
123
+ self.class == o.class &&
124
+ cron_schedule == o.cron_schedule &&
125
+ time_zone == o.time_zone &&
126
+ locale_ids == o.locale_ids &&
127
+ tags == o.tags &&
128
+ branch == o.branch &&
129
+ app_min_version == o.app_min_version &&
130
+ app_max_version == o.app_max_version
131
+ end
132
+
133
+ # @see the `==` method
134
+ # @param [Object] Object to be compared
135
+ def eql?(o)
136
+ self == o
137
+ end
138
+
139
+ # Calculates hash code according to all attributes.
140
+ # @return [Integer] Hash code
141
+ def hash
142
+ [cron_schedule, time_zone, locale_ids, tags, branch, app_min_version, app_max_version].hash
143
+ end
144
+
145
+ # Builds the object from hash
146
+ # @param [Hash] attributes Model attributes in the form of hash
147
+ # @return [Object] Returns the model itself
148
+ def self.build_from_hash(attributes)
149
+ new.build_from_hash(attributes)
150
+ end
151
+
152
+ # Builds the object from hash
153
+ # @param [Hash] attributes Model attributes in the form of hash
154
+ # @return [Object] Returns the model itself
155
+ def build_from_hash(attributes)
156
+ return nil unless attributes.is_a?(Hash)
157
+ self.class.openapi_types.each_pair do |key, type|
158
+ if type =~ /\AArray<(.*)>/i
159
+ # check to ensure the input is an array given that the attribute
160
+ # is documented as an array but the input is not
161
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
162
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
163
+ end
164
+ elsif !attributes[self.class.attribute_map[key]].nil?
165
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
166
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
167
+ end
168
+
169
+ self
170
+ end
171
+
172
+ # Deserializes the data based on type
173
+ # @param string type Data type
174
+ # @param string value Value to be deserialized
175
+ # @return [Object] Deserialized data
176
+ def _deserialize(type, value)
177
+ case type.to_sym
178
+ when :DateTime
179
+ DateTime.parse(value)
180
+ when :Date
181
+ Date.parse(value)
182
+ when :Time
183
+ Time.parse(value)
184
+ when :String
185
+ value.to_s
186
+ when :Integer
187
+ value.to_i
188
+ when :Float
189
+ value.to_f
190
+ when :Boolean
191
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
192
+ true
193
+ else
194
+ false
195
+ end
196
+ when :Object
197
+ # generic object (usually a Hash), return directly
198
+ value
199
+ when /\AArray<(?<inner_type>.+)>\z/
200
+ inner_type = Regexp.last_match[:inner_type]
201
+ value.map { |v| _deserialize(inner_type, v) }
202
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
203
+ k_type = Regexp.last_match[:k_type]
204
+ v_type = Regexp.last_match[:v_type]
205
+ {}.tap do |hash|
206
+ value.each do |k, v|
207
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
208
+ end
209
+ end
210
+ else # model
211
+ Phrase.const_get(type).build_from_hash(value)
212
+ end
213
+ end
214
+
215
+ # Returns the string representation of the object
216
+ # @return [String] String presentation of the object
217
+ def to_s
218
+ to_hash.to_s
219
+ end
220
+
221
+ # to_body is an alias to to_hash (backward compatibility)
222
+ # @return [Hash] Returns the object in the form of hash
223
+ def to_body
224
+ to_hash
225
+ end
226
+
227
+ # Returns the object in the form of hash
228
+ # @return [Hash] Returns the object in the form of hash
229
+ def to_hash
230
+ hash = {}
231
+ self.class.attribute_map.each_pair do |attr, param|
232
+ value = self.send(attr)
233
+ if value.nil?
234
+ is_nullable = self.class.openapi_nullable.include?(attr)
235
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
236
+ end
237
+
238
+ hash[param] = _to_hash(value)
239
+ end
240
+ hash
241
+ end
242
+
243
+ # Outputs non-array value in the form of hash
244
+ # For object, use to_hash. Otherwise, just return the value
245
+ # @param [Object] value Any valid value
246
+ # @return [Hash] Returns the value in the form of hash
247
+ def _to_hash(value)
248
+ if value.is_a?(Array)
249
+ value.compact.map { |v| _to_hash(v) }
250
+ elsif value.is_a?(Hash)
251
+ {}.tap do |hash|
252
+ value.each { |k, v| hash[k] = _to_hash(v) }
253
+ end
254
+ elsif value.respond_to? :to_hash
255
+ value.to_hash
256
+ else
257
+ value
258
+ end
259
+ end
260
+ end
261
+ end