phrase 2.7.0 → 2.8.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 (65) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +33 -21
  3. data/docs/BlacklistedKeyCreateParameters.md +1 -1
  4. data/docs/BlacklistedKeyUpdateParameters.md +1 -1
  5. data/docs/BlacklistedKeysApi.md +20 -20
  6. data/docs/DistributionCreateParameters.md +2 -0
  7. data/docs/DistributionUpdateParameters.md +2 -0
  8. data/docs/GlossariesApi.md +20 -20
  9. data/docs/GlossaryTermTranslationsApi.md +12 -12
  10. data/docs/GlossaryTermsApi.md +20 -20
  11. data/docs/JobComment.md +29 -0
  12. data/docs/JobCommentCreateParameters.md +17 -0
  13. data/docs/JobCommentUpdateParameters.md +17 -0
  14. data/docs/JobCommentsApi.md +343 -0
  15. data/docs/Locale.md +2 -0
  16. data/docs/LocaleCreateParameters.md +2 -0
  17. data/docs/LocaleDetails.md +2 -0
  18. data/docs/LocaleUpdateParameters.md +2 -0
  19. data/docs/ScreenshotsApi.md +12 -6
  20. data/docs/StyleguideCreateParameters.md +1 -1
  21. data/docs/StyleguideUpdateParameters.md +1 -1
  22. data/docs/VersionsHistoryApi.md +1 -1
  23. data/docs/WebhookDeliveriesApi.md +206 -0
  24. data/docs/WebhookDelivery.md +29 -0
  25. data/lib/phrase/api/blacklisted_keys_api.rb +20 -20
  26. data/lib/phrase/api/glossaries_api.rb +20 -20
  27. data/lib/phrase/api/glossary_term_translations_api.rb +12 -12
  28. data/lib/phrase/api/glossary_terms_api.rb +20 -20
  29. data/lib/phrase/api/job_comments_api.rb +411 -0
  30. data/lib/phrase/api/screenshots_api.rb +17 -11
  31. data/lib/phrase/api/versions_history_api.rb +2 -2
  32. data/lib/phrase/api/webhook_deliveries_api.rb +241 -0
  33. data/lib/phrase/models/blacklisted_key_create_parameters.rb +1 -1
  34. data/lib/phrase/models/blacklisted_key_update_parameters.rb +1 -1
  35. data/lib/phrase/models/distribution_create_parameters.rb +11 -1
  36. data/lib/phrase/models/distribution_update_parameters.rb +11 -1
  37. data/lib/phrase/models/job_comment.rb +250 -0
  38. data/lib/phrase/models/job_comment_create_parameters.rb +195 -0
  39. data/lib/phrase/models/job_comment_update_parameters.rb +195 -0
  40. data/lib/phrase/models/locale.rb +10 -1
  41. data/lib/phrase/models/locale_create_parameters.rb +11 -1
  42. data/lib/phrase/models/locale_details.rb +10 -1
  43. data/lib/phrase/models/locale_update_parameters.rb +11 -1
  44. data/lib/phrase/models/webhook_delivery.rb +248 -0
  45. data/lib/phrase/version.rb +1 -1
  46. data/lib/phrase.rb +6 -0
  47. data/spec/api/blacklisted_keys_api_spec.rb +10 -10
  48. data/spec/api/glossaries_api_spec.rb +10 -10
  49. data/spec/api/glossary_term_translations_api_spec.rb +6 -6
  50. data/spec/api/glossary_terms_api_spec.rb +10 -10
  51. data/spec/api/job_comments_api_spec.rb +101 -0
  52. data/spec/api/screenshots_api_spec.rb +4 -1
  53. data/spec/api/versions_history_api_spec.rb +1 -1
  54. data/spec/api/webhook_deliveries_api_spec.rb +68 -0
  55. data/spec/models/distribution_create_parameters_spec.rb +6 -0
  56. data/spec/models/distribution_update_parameters_spec.rb +6 -0
  57. data/spec/models/job_comment_create_parameters_spec.rb +29 -0
  58. data/spec/models/job_comment_spec.rb +65 -0
  59. data/spec/models/job_comment_update_parameters_spec.rb +29 -0
  60. data/spec/models/locale_create_parameters_spec.rb +6 -0
  61. data/spec/models/locale_details_spec.rb +6 -0
  62. data/spec/models/locale_spec.rb +6 -0
  63. data/spec/models/locale_update_parameters_spec.rb +6 -0
  64. data/spec/models/webhook_delivery_spec.rb +65 -0
  65. metadata +221 -197
@@ -0,0 +1,241 @@
1
+ require 'cgi'
2
+
3
+ module Phrase
4
+ class WebhookDeliveriesApi
5
+ attr_accessor :api_client
6
+
7
+ def initialize(api_client = ApiClient.default)
8
+ @api_client = api_client
9
+ end
10
+ # List webhook deliveries
11
+ # List all webhook deliveries for the given webhook_id.
12
+ # @param project_id [String] Project ID
13
+ # @param webhook_id [String] Webhook ID
14
+ # @param [Hash] opts the optional parameters
15
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
16
+ # @option opts [String] :response_status_codes List of Response Status Codes
17
+ # @return [Array<WebhookDelivery>]
18
+ def webhook_deliveries_list(project_id, webhook_id, opts = {})
19
+ data, _status_code, _headers = webhook_deliveries_list_with_http_info(project_id, webhook_id, opts)
20
+ data
21
+ end
22
+
23
+ # List webhook deliveries
24
+ # List all webhook deliveries for the given webhook_id.
25
+ # @param project_id [String] Project ID
26
+ # @param webhook_id [String] Webhook ID
27
+ # @param [Hash] opts the optional parameters
28
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
29
+ # @option opts [String] :response_status_codes List of Response Status Codes
30
+ # @return [Array<(Response<(Array<WebhookDelivery>)>, Integer, Hash)>] Response<(Array<WebhookDelivery>)> data, response status code and response headers
31
+ def webhook_deliveries_list_with_http_info(project_id, webhook_id, opts = {})
32
+ if @api_client.config.debugging
33
+ @api_client.config.logger.debug 'Calling API: WebhookDeliveriesApi.webhook_deliveries_list ...'
34
+ end
35
+ # verify the required parameter 'project_id' is set
36
+ if @api_client.config.client_side_validation && project_id.nil?
37
+ fail ArgumentError, "Missing the required parameter 'project_id' when calling WebhookDeliveriesApi.webhook_deliveries_list"
38
+ end
39
+ # verify the required parameter 'webhook_id' is set
40
+ if @api_client.config.client_side_validation && webhook_id.nil?
41
+ fail ArgumentError, "Missing the required parameter 'webhook_id' when calling WebhookDeliveriesApi.webhook_deliveries_list"
42
+ end
43
+ # resource path
44
+ local_var_path = '/projects/{project_id}/webhooks/{webhook_id}/deliveries'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'webhook_id' + '}', CGI.escape(webhook_id.to_s))
45
+
46
+ # query parameters
47
+ query_params = opts[:query_params] || {}
48
+ query_params[:'response_status_codes'] = opts[:'response_status_codes'] if !opts[:'response_status_codes'].nil?
49
+
50
+ # header parameters
51
+ header_params = opts[:header_params] || {}
52
+ # HTTP header 'Accept' (if needed)
53
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
54
+ header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
55
+
56
+ # form parameters
57
+ form_params = opts[:form_params] || {}
58
+
59
+ # http body (model)
60
+ post_body = opts[:body]
61
+
62
+ # return_type
63
+ return_type = opts[:return_type] || 'Array<WebhookDelivery>'
64
+
65
+ # auth_names
66
+ auth_names = opts[:auth_names] || ['Basic', 'Token']
67
+
68
+ new_options = opts.merge(
69
+ :header_params => header_params,
70
+ :query_params => query_params,
71
+ :form_params => form_params,
72
+ :body => post_body,
73
+ :auth_names => auth_names,
74
+ :return_type => return_type
75
+ )
76
+
77
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
78
+ if @api_client.config.debugging
79
+ @api_client.config.logger.debug "API called: WebhookDeliveriesApi#webhook_deliveries_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
80
+ end
81
+ response = ::Phrase::Response.new(data, headers)
82
+ return response, status_code, headers
83
+ end
84
+
85
+ # Redeliver a single webhook delivery
86
+ # Trigger an individual webhook delivery to be redelivered.
87
+ # @param project_id [String] Project ID
88
+ # @param webhook_id [String] Webhook ID
89
+ # @param id [String] ID
90
+ # @param [Hash] opts the optional parameters
91
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
92
+ # @return [WebhookDelivery]
93
+ def webhook_deliveries_redeliver(project_id, webhook_id, id, opts = {})
94
+ data, _status_code, _headers = webhook_deliveries_redeliver_with_http_info(project_id, webhook_id, id, opts)
95
+ data
96
+ end
97
+
98
+ # Redeliver a single webhook delivery
99
+ # Trigger an individual webhook delivery to be redelivered.
100
+ # @param project_id [String] Project ID
101
+ # @param webhook_id [String] Webhook ID
102
+ # @param id [String] ID
103
+ # @param [Hash] opts the optional parameters
104
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
105
+ # @return [Array<(Response<(WebhookDelivery)>, Integer, Hash)>] Response<(WebhookDelivery)> data, response status code and response headers
106
+ def webhook_deliveries_redeliver_with_http_info(project_id, webhook_id, id, opts = {})
107
+ if @api_client.config.debugging
108
+ @api_client.config.logger.debug 'Calling API: WebhookDeliveriesApi.webhook_deliveries_redeliver ...'
109
+ end
110
+ # verify the required parameter 'project_id' is set
111
+ if @api_client.config.client_side_validation && project_id.nil?
112
+ fail ArgumentError, "Missing the required parameter 'project_id' when calling WebhookDeliveriesApi.webhook_deliveries_redeliver"
113
+ end
114
+ # verify the required parameter 'webhook_id' is set
115
+ if @api_client.config.client_side_validation && webhook_id.nil?
116
+ fail ArgumentError, "Missing the required parameter 'webhook_id' when calling WebhookDeliveriesApi.webhook_deliveries_redeliver"
117
+ end
118
+ # verify the required parameter 'id' is set
119
+ if @api_client.config.client_side_validation && id.nil?
120
+ fail ArgumentError, "Missing the required parameter 'id' when calling WebhookDeliveriesApi.webhook_deliveries_redeliver"
121
+ end
122
+ # resource path
123
+ local_var_path = '/projects/{project_id}/webhooks/{webhook_id}/deliveries/{id}/redeliver'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'webhook_id' + '}', CGI.escape(webhook_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))
124
+
125
+ # query parameters
126
+ query_params = opts[:query_params] || {}
127
+
128
+ # header parameters
129
+ header_params = opts[:header_params] || {}
130
+ # HTTP header 'Accept' (if needed)
131
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
132
+ header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
133
+
134
+ # form parameters
135
+ form_params = opts[:form_params] || {}
136
+
137
+ # http body (model)
138
+ post_body = opts[:body]
139
+
140
+ # return_type
141
+ return_type = opts[:return_type] || 'WebhookDelivery'
142
+
143
+ # auth_names
144
+ auth_names = opts[:auth_names] || ['Basic', 'Token']
145
+
146
+ new_options = opts.merge(
147
+ :header_params => header_params,
148
+ :query_params => query_params,
149
+ :form_params => form_params,
150
+ :body => post_body,
151
+ :auth_names => auth_names,
152
+ :return_type => return_type
153
+ )
154
+
155
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
156
+ if @api_client.config.debugging
157
+ @api_client.config.logger.debug "API called: WebhookDeliveriesApi#webhook_deliveries_redeliver\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
158
+ end
159
+ response = ::Phrase::Response.new(data, headers)
160
+ return response, status_code, headers
161
+ end
162
+
163
+ # Get a single webhook delivery
164
+ # Get all information about a single webhook delivery for the given ID.
165
+ # @param project_id [String] Project ID
166
+ # @param webhook_id [String] Webhook ID
167
+ # @param id [String] ID
168
+ # @param [Hash] opts the optional parameters
169
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
170
+ # @return [WebhookDelivery]
171
+ def webhook_deliveries_show(project_id, webhook_id, id, opts = {})
172
+ data, _status_code, _headers = webhook_deliveries_show_with_http_info(project_id, webhook_id, id, opts)
173
+ data
174
+ end
175
+
176
+ # Get a single webhook delivery
177
+ # Get all information about a single webhook delivery for the given ID.
178
+ # @param project_id [String] Project ID
179
+ # @param webhook_id [String] Webhook ID
180
+ # @param id [String] ID
181
+ # @param [Hash] opts the optional parameters
182
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
183
+ # @return [Array<(Response<(WebhookDelivery)>, Integer, Hash)>] Response<(WebhookDelivery)> data, response status code and response headers
184
+ def webhook_deliveries_show_with_http_info(project_id, webhook_id, id, opts = {})
185
+ if @api_client.config.debugging
186
+ @api_client.config.logger.debug 'Calling API: WebhookDeliveriesApi.webhook_deliveries_show ...'
187
+ end
188
+ # verify the required parameter 'project_id' is set
189
+ if @api_client.config.client_side_validation && project_id.nil?
190
+ fail ArgumentError, "Missing the required parameter 'project_id' when calling WebhookDeliveriesApi.webhook_deliveries_show"
191
+ end
192
+ # verify the required parameter 'webhook_id' is set
193
+ if @api_client.config.client_side_validation && webhook_id.nil?
194
+ fail ArgumentError, "Missing the required parameter 'webhook_id' when calling WebhookDeliveriesApi.webhook_deliveries_show"
195
+ end
196
+ # verify the required parameter 'id' is set
197
+ if @api_client.config.client_side_validation && id.nil?
198
+ fail ArgumentError, "Missing the required parameter 'id' when calling WebhookDeliveriesApi.webhook_deliveries_show"
199
+ end
200
+ # resource path
201
+ local_var_path = '/projects/{project_id}/webhooks/{webhook_id}/deliveries/{id}'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'webhook_id' + '}', CGI.escape(webhook_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))
202
+
203
+ # query parameters
204
+ query_params = opts[:query_params] || {}
205
+
206
+ # header parameters
207
+ header_params = opts[:header_params] || {}
208
+ # HTTP header 'Accept' (if needed)
209
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
210
+ header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
211
+
212
+ # form parameters
213
+ form_params = opts[:form_params] || {}
214
+
215
+ # http body (model)
216
+ post_body = opts[:body]
217
+
218
+ # return_type
219
+ return_type = opts[:return_type] || 'WebhookDelivery'
220
+
221
+ # auth_names
222
+ auth_names = opts[:auth_names] || ['Basic', 'Token']
223
+
224
+ new_options = opts.merge(
225
+ :header_params => header_params,
226
+ :query_params => query_params,
227
+ :form_params => form_params,
228
+ :body => post_body,
229
+ :auth_names => auth_names,
230
+ :return_type => return_type
231
+ )
232
+
233
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
234
+ if @api_client.config.debugging
235
+ @api_client.config.logger.debug "API called: WebhookDeliveriesApi#webhook_deliveries_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
236
+ end
237
+ response = ::Phrase::Response.new(data, headers)
238
+ return response, status_code, headers
239
+ end
240
+ end
241
+ end
@@ -2,7 +2,7 @@ require 'date'
2
2
 
3
3
  module Phrase
4
4
  class BlacklistedKeyCreateParameters
5
- # Blacklisted key name
5
+ # Blocked key name
6
6
  attr_accessor :name
7
7
 
8
8
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -2,7 +2,7 @@ require 'date'
2
2
 
3
3
  module Phrase
4
4
  class BlacklistedKeyUpdateParameters
5
- # Blacklisted key name
5
+ # Blocked key name
6
6
  attr_accessor :name
7
7
 
8
8
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -17,6 +17,9 @@ module Phrase
17
17
  # Additional formatting and render options. Only <code>enclose_in_cdata</code> is available for platform <code>android</code>.
18
18
  attr_accessor :format_options
19
19
 
20
+ # Use fallback locale if there is no translation in the current locale.
21
+ attr_accessor :fallback_locales_enabled
22
+
20
23
  # Indicates whether to fallback to non regional locale when locale can not be found
21
24
  attr_accessor :fallback_to_non_regional_locale
22
25
 
@@ -34,6 +37,7 @@ module Phrase
34
37
  :'platforms' => :'platforms',
35
38
  :'locale_ids' => :'locale_ids',
36
39
  :'format_options' => :'format_options',
40
+ :'fallback_locales_enabled' => :'fallback_locales_enabled',
37
41
  :'fallback_to_non_regional_locale' => :'fallback_to_non_regional_locale',
38
42
  :'fallback_to_default_locale' => :'fallback_to_default_locale',
39
43
  :'use_last_reviewed_version' => :'use_last_reviewed_version'
@@ -48,6 +52,7 @@ module Phrase
48
52
  :'platforms' => :'Array<String>',
49
53
  :'locale_ids' => :'Array<String>',
50
54
  :'format_options' => :'Hash<String, String>',
55
+ :'fallback_locales_enabled' => :'Boolean',
51
56
  :'fallback_to_non_regional_locale' => :'Boolean',
52
57
  :'fallback_to_default_locale' => :'Boolean',
53
58
  :'use_last_reviewed_version' => :'Boolean'
@@ -101,6 +106,10 @@ module Phrase
101
106
  end
102
107
  end
103
108
 
109
+ if attributes.key?(:'fallback_locales_enabled')
110
+ self.fallback_locales_enabled = attributes[:'fallback_locales_enabled']
111
+ end
112
+
104
113
  if attributes.key?(:'fallback_to_non_regional_locale')
105
114
  self.fallback_to_non_regional_locale = attributes[:'fallback_to_non_regional_locale']
106
115
  end
@@ -137,6 +146,7 @@ module Phrase
137
146
  platforms == o.platforms &&
138
147
  locale_ids == o.locale_ids &&
139
148
  format_options == o.format_options &&
149
+ fallback_locales_enabled == o.fallback_locales_enabled &&
140
150
  fallback_to_non_regional_locale == o.fallback_to_non_regional_locale &&
141
151
  fallback_to_default_locale == o.fallback_to_default_locale &&
142
152
  use_last_reviewed_version == o.use_last_reviewed_version
@@ -151,7 +161,7 @@ module Phrase
151
161
  # Calculates hash code according to all attributes.
152
162
  # @return [Integer] Hash code
153
163
  def hash
154
- [name, project_id, platforms, locale_ids, format_options, fallback_to_non_regional_locale, fallback_to_default_locale, use_last_reviewed_version].hash
164
+ [name, project_id, platforms, locale_ids, format_options, fallback_locales_enabled, fallback_to_non_regional_locale, fallback_to_default_locale, use_last_reviewed_version].hash
155
165
  end
156
166
 
157
167
  # Builds the object from hash
@@ -17,6 +17,9 @@ module Phrase
17
17
  # Additional formatting and render options. Only <code>enclose_in_cdata</code> is available for platform <code>android</code>.
18
18
  attr_accessor :format_options
19
19
 
20
+ # Use fallback locale if there is no translation in the current locale.
21
+ attr_accessor :fallback_locales_enabled
22
+
20
23
  # Indicates whether to fallback to non regional locale when locale can not be found
21
24
  attr_accessor :fallback_to_non_regional_locale
22
25
 
@@ -34,6 +37,7 @@ module Phrase
34
37
  :'platforms' => :'platforms',
35
38
  :'locale_ids' => :'locale_ids',
36
39
  :'format_options' => :'format_options',
40
+ :'fallback_locales_enabled' => :'fallback_locales_enabled',
37
41
  :'fallback_to_non_regional_locale' => :'fallback_to_non_regional_locale',
38
42
  :'fallback_to_default_locale' => :'fallback_to_default_locale',
39
43
  :'use_last_reviewed_version' => :'use_last_reviewed_version'
@@ -48,6 +52,7 @@ module Phrase
48
52
  :'platforms' => :'Array<String>',
49
53
  :'locale_ids' => :'Array<String>',
50
54
  :'format_options' => :'Hash<String, String>',
55
+ :'fallback_locales_enabled' => :'Boolean',
51
56
  :'fallback_to_non_regional_locale' => :'Boolean',
52
57
  :'fallback_to_default_locale' => :'Boolean',
53
58
  :'use_last_reviewed_version' => :'Boolean'
@@ -101,6 +106,10 @@ module Phrase
101
106
  end
102
107
  end
103
108
 
109
+ if attributes.key?(:'fallback_locales_enabled')
110
+ self.fallback_locales_enabled = attributes[:'fallback_locales_enabled']
111
+ end
112
+
104
113
  if attributes.key?(:'fallback_to_non_regional_locale')
105
114
  self.fallback_to_non_regional_locale = attributes[:'fallback_to_non_regional_locale']
106
115
  end
@@ -137,6 +146,7 @@ module Phrase
137
146
  platforms == o.platforms &&
138
147
  locale_ids == o.locale_ids &&
139
148
  format_options == o.format_options &&
149
+ fallback_locales_enabled == o.fallback_locales_enabled &&
140
150
  fallback_to_non_regional_locale == o.fallback_to_non_regional_locale &&
141
151
  fallback_to_default_locale == o.fallback_to_default_locale &&
142
152
  use_last_reviewed_version == o.use_last_reviewed_version
@@ -151,7 +161,7 @@ module Phrase
151
161
  # Calculates hash code according to all attributes.
152
162
  # @return [Integer] Hash code
153
163
  def hash
154
- [name, project_id, platforms, locale_ids, format_options, fallback_to_non_regional_locale, fallback_to_default_locale, use_last_reviewed_version].hash
164
+ [name, project_id, platforms, locale_ids, format_options, fallback_locales_enabled, fallback_to_non_regional_locale, fallback_to_default_locale, use_last_reviewed_version].hash
155
165
  end
156
166
 
157
167
  # Builds the object from hash
@@ -0,0 +1,250 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class JobComment
5
+ attr_accessor :id
6
+
7
+ attr_accessor :message
8
+
9
+ attr_accessor :job_id
10
+
11
+ attr_accessor :user
12
+
13
+ attr_accessor :created_at
14
+
15
+ attr_accessor :updated_at
16
+
17
+ attr_accessor :mentioned_users
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'id' => :'id',
23
+ :'message' => :'message',
24
+ :'job_id' => :'job_id',
25
+ :'user' => :'user',
26
+ :'created_at' => :'created_at',
27
+ :'updated_at' => :'updated_at',
28
+ :'mentioned_users' => :'mentioned_users'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'id' => :'String',
36
+ :'message' => :'String',
37
+ :'job_id' => :'String',
38
+ :'user' => :'UserPreview',
39
+ :'created_at' => :'DateTime',
40
+ :'updated_at' => :'DateTime',
41
+ :'mentioned_users' => :'Array<UserPreview>'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::JobComment` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!self.class.attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::JobComment`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'id')
67
+ self.id = attributes[:'id']
68
+ end
69
+
70
+ if attributes.key?(:'message')
71
+ self.message = attributes[:'message']
72
+ end
73
+
74
+ if attributes.key?(:'job_id')
75
+ self.job_id = attributes[:'job_id']
76
+ end
77
+
78
+ if attributes.key?(:'user')
79
+ self.user = attributes[:'user']
80
+ end
81
+
82
+ if attributes.key?(:'created_at')
83
+ self.created_at = attributes[:'created_at']
84
+ end
85
+
86
+ if attributes.key?(:'updated_at')
87
+ self.updated_at = attributes[:'updated_at']
88
+ end
89
+
90
+ if attributes.key?(:'mentioned_users')
91
+ if (value = attributes[:'mentioned_users']).is_a?(Array)
92
+ self.mentioned_users = value
93
+ end
94
+ end
95
+ end
96
+
97
+ # Show invalid properties with the reasons. Usually used together with valid?
98
+ # @return Array for valid properties with the reasons
99
+ def list_invalid_properties
100
+ invalid_properties = Array.new
101
+ invalid_properties
102
+ end
103
+
104
+ # Check to see if the all the properties in the model are valid
105
+ # @return true if the model is valid
106
+ def valid?
107
+ true
108
+ end
109
+
110
+ # Checks equality by comparing each attribute.
111
+ # @param [Object] Object to be compared
112
+ def ==(o)
113
+ return true if self.equal?(o)
114
+ self.class == o.class &&
115
+ id == o.id &&
116
+ message == o.message &&
117
+ job_id == o.job_id &&
118
+ user == o.user &&
119
+ created_at == o.created_at &&
120
+ updated_at == o.updated_at &&
121
+ mentioned_users == o.mentioned_users
122
+ end
123
+
124
+ # @see the `==` method
125
+ # @param [Object] Object to be compared
126
+ def eql?(o)
127
+ self == o
128
+ end
129
+
130
+ # Calculates hash code according to all attributes.
131
+ # @return [Integer] Hash code
132
+ def hash
133
+ [id, message, job_id, user, created_at, updated_at, mentioned_users].hash
134
+ end
135
+
136
+ # Builds the object from hash
137
+ # @param [Hash] attributes Model attributes in the form of hash
138
+ # @return [Object] Returns the model itself
139
+ def self.build_from_hash(attributes)
140
+ new.build_from_hash(attributes)
141
+ end
142
+
143
+ # Builds the object from hash
144
+ # @param [Hash] attributes Model attributes in the form of hash
145
+ # @return [Object] Returns the model itself
146
+ def build_from_hash(attributes)
147
+ return nil unless attributes.is_a?(Hash)
148
+ self.class.openapi_types.each_pair do |key, type|
149
+ if type =~ /\AArray<(.*)>/i
150
+ # check to ensure the input is an array given that the attribute
151
+ # is documented as an array but the input is not
152
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
153
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
154
+ end
155
+ elsif !attributes[self.class.attribute_map[key]].nil?
156
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
157
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
158
+ end
159
+
160
+ self
161
+ end
162
+
163
+ # Deserializes the data based on type
164
+ # @param string type Data type
165
+ # @param string value Value to be deserialized
166
+ # @return [Object] Deserialized data
167
+ def _deserialize(type, value)
168
+ case type.to_sym
169
+ when :DateTime
170
+ DateTime.parse(value)
171
+ when :Date
172
+ Date.parse(value)
173
+ when :String
174
+ value.to_s
175
+ when :Integer
176
+ value.to_i
177
+ when :Float
178
+ value.to_f
179
+ when :Boolean
180
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
181
+ true
182
+ else
183
+ false
184
+ end
185
+ when :Object
186
+ # generic object (usually a Hash), return directly
187
+ value
188
+ when /\AArray<(?<inner_type>.+)>\z/
189
+ inner_type = Regexp.last_match[:inner_type]
190
+ value.map { |v| _deserialize(inner_type, v) }
191
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
192
+ k_type = Regexp.last_match[:k_type]
193
+ v_type = Regexp.last_match[:v_type]
194
+ {}.tap do |hash|
195
+ value.each do |k, v|
196
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
197
+ end
198
+ end
199
+ else # model
200
+ Phrase.const_get(type).build_from_hash(value)
201
+ end
202
+ end
203
+
204
+ # Returns the string representation of the object
205
+ # @return [String] String presentation of the object
206
+ def to_s
207
+ to_hash.to_s
208
+ end
209
+
210
+ # to_body is an alias to to_hash (backward compatibility)
211
+ # @return [Hash] Returns the object in the form of hash
212
+ def to_body
213
+ to_hash
214
+ end
215
+
216
+ # Returns the object in the form of hash
217
+ # @return [Hash] Returns the object in the form of hash
218
+ def to_hash
219
+ hash = {}
220
+ self.class.attribute_map.each_pair do |attr, param|
221
+ value = self.send(attr)
222
+ if value.nil?
223
+ is_nullable = self.class.openapi_nullable.include?(attr)
224
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
225
+ end
226
+
227
+ hash[param] = _to_hash(value)
228
+ end
229
+ hash
230
+ end
231
+
232
+ # Outputs non-array value in the form of hash
233
+ # For object, use to_hash. Otherwise, just return the value
234
+ # @param [Object] value Any valid value
235
+ # @return [Hash] Returns the value in the form of hash
236
+ def _to_hash(value)
237
+ if value.is_a?(Array)
238
+ value.compact.map { |v| _to_hash(v) }
239
+ elsif value.is_a?(Hash)
240
+ {}.tap do |hash|
241
+ value.each { |k, v| hash[k] = _to_hash(v) }
242
+ end
243
+ elsif value.respond_to? :to_hash
244
+ value.to_hash
245
+ else
246
+ value
247
+ end
248
+ end
249
+ end
250
+ end