phrase 4.26.0 → 4.27.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 (58) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -0
  3. data/README.md +14 -3
  4. data/docs/CheckIssue.md +33 -0
  5. data/docs/ChecksApi.md +146 -0
  6. data/docs/JobCreateParameters.md +1 -1
  7. data/docs/KeyCreateParameters.md +1 -1
  8. data/docs/KeyUpdateParameters.md +1 -1
  9. data/docs/Locale.md +6 -0
  10. data/docs/LocaleCreateParameters.md +2 -0
  11. data/docs/LocaleDetails.md +6 -0
  12. data/docs/LocaleUpdateParameters.md +2 -0
  13. data/docs/MachineTranslationApi.md +263 -0
  14. data/docs/MachineTranslationLocaleProviderMapping.md +21 -0
  15. data/docs/MachineTranslationLocaleProviderMappingsCreateParameters.md +21 -0
  16. data/docs/MachineTranslationSettings.md +23 -0
  17. data/docs/MachineTranslationSettingsUpdateParameters.md +17 -0
  18. data/docs/ProjectCreateParameters.md +8 -2
  19. data/docs/ProjectDetails.md +3 -1
  20. data/docs/ProjectUpdateParameters.md +8 -2
  21. data/docs/ScreenshotUpdateParameters.md +1 -1
  22. data/docs/Upload.md +3 -1
  23. data/docs/UploadsApi.md +4 -4
  24. data/lib/phrase/api/checks_api.rb +174 -0
  25. data/lib/phrase/api/machine_translation_api.rb +302 -0
  26. data/lib/phrase/api/uploads_api.rb +6 -6
  27. data/lib/phrase/models/check_issue.rb +319 -0
  28. data/lib/phrase/models/job_create_parameters.rb +1 -1
  29. data/lib/phrase/models/locale.rb +31 -1
  30. data/lib/phrase/models/locale_create_parameters.rb +11 -1
  31. data/lib/phrase/models/locale_details.rb +31 -1
  32. data/lib/phrase/models/locale_update_parameters.rb +11 -1
  33. data/lib/phrase/models/machine_translation_locale_provider_mapping.rb +217 -0
  34. data/lib/phrase/models/machine_translation_locale_provider_mappings_create_parameters.rb +232 -0
  35. data/lib/phrase/models/machine_translation_settings.rb +230 -0
  36. data/lib/phrase/models/machine_translation_settings_update_parameters.rb +198 -0
  37. data/lib/phrase/models/project_create_parameters.rb +35 -1
  38. data/lib/phrase/models/project_details.rb +10 -1
  39. data/lib/phrase/models/project_update_parameters.rb +35 -1
  40. data/lib/phrase/models/upload.rb +13 -1
  41. data/lib/phrase/version.rb +1 -1
  42. data/lib/phrase.rb +7 -0
  43. data/spec/api/checks_api_spec.rb +56 -0
  44. data/spec/api/machine_translation_api_spec.rb +79 -0
  45. data/spec/models/check_issue_spec.rb +85 -0
  46. data/spec/models/locale_create_parameters_spec.rb +6 -0
  47. data/spec/models/locale_details_spec.rb +18 -0
  48. data/spec/models/locale_spec.rb +18 -0
  49. data/spec/models/locale_update_parameters_spec.rb +6 -0
  50. data/spec/models/machine_translation_locale_provider_mapping_spec.rb +41 -0
  51. data/spec/models/machine_translation_locale_provider_mappings_create_parameters_spec.rb +41 -0
  52. data/spec/models/machine_translation_settings_spec.rb +47 -0
  53. data/spec/models/machine_translation_settings_update_parameters_spec.rb +29 -0
  54. data/spec/models/project_create_parameters_spec.rb +18 -0
  55. data/spec/models/project_details_spec.rb +6 -0
  56. data/spec/models/project_update_parameters_spec.rb +18 -0
  57. data/spec/models/upload_spec.rb +6 -0
  58. metadata +292 -264
@@ -0,0 +1,302 @@
1
+ require 'cgi'
2
+
3
+ module Phrase
4
+ class MachineTranslationApi
5
+ attr_accessor :api_client
6
+
7
+ def initialize(api_client = ApiClient.default)
8
+ @api_client = api_client
9
+ end
10
+ # Create a locale provider mapping
11
+ # Creates a locale-pair-specific machine translation provider override for the account. When a mapping exists for a given source/target locale pair, that provider is used instead of the account default. Only one mapping may exist per source/target locale pair; attempting to create a duplicate returns a validation error. The source and target locale codes must differ.
12
+ # @param account_id [String] Account ID
13
+ # @param machine_translation_locale_provider_mappings_create_parameters [MachineTranslationLocaleProviderMappingsCreateParameters]
14
+ # @param [Hash] opts the optional parameters
15
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
16
+ # @return [MachineTranslationLocaleProviderMapping]
17
+ def machine_translation_locale_provider_mappings_create(account_id, machine_translation_locale_provider_mappings_create_parameters, opts = {})
18
+ data, _status_code, _headers = machine_translation_locale_provider_mappings_create_with_http_info(account_id, machine_translation_locale_provider_mappings_create_parameters, opts)
19
+ data
20
+ end
21
+
22
+ # Create a locale provider mapping
23
+ # Creates a locale-pair-specific machine translation provider override for the account. When a mapping exists for a given source/target locale pair, that provider is used instead of the account default. Only one mapping may exist per source/target locale pair; attempting to create a duplicate returns a validation error. The source and target locale codes must differ.
24
+ # @param account_id [String] Account ID
25
+ # @param machine_translation_locale_provider_mappings_create_parameters [MachineTranslationLocaleProviderMappingsCreateParameters]
26
+ # @param [Hash] opts the optional parameters
27
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
28
+ # @return [Array<(Response<(MachineTranslationLocaleProviderMapping)>, Integer, Hash)>] Response<(MachineTranslationLocaleProviderMapping)> data, response status code and response headers
29
+ def machine_translation_locale_provider_mappings_create_with_http_info(account_id, machine_translation_locale_provider_mappings_create_parameters, opts = {})
30
+ if @api_client.config.debugging
31
+ @api_client.config.logger.debug 'Calling API: MachineTranslationApi.machine_translation_locale_provider_mappings_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 MachineTranslationApi.machine_translation_locale_provider_mappings_create"
36
+ end
37
+ # verify the required parameter 'machine_translation_locale_provider_mappings_create_parameters' is set
38
+ if @api_client.config.client_side_validation && machine_translation_locale_provider_mappings_create_parameters.nil?
39
+ fail ArgumentError, "Missing the required parameter 'machine_translation_locale_provider_mappings_create_parameters' when calling MachineTranslationApi.machine_translation_locale_provider_mappings_create"
40
+ end
41
+ # resource path
42
+ local_var_path = '/accounts/{account_id}/machine_translation_locale_provider_mappings'.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(machine_translation_locale_provider_mappings_create_parameters)
60
+
61
+ # return_type
62
+ return_type = opts[:return_type] || 'MachineTranslationLocaleProviderMapping'
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: MachineTranslationApi#machine_translation_locale_provider_mappings_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 a locale provider mapping
85
+ # Removes the machine translation provider override for the specified source and target locale pair. The mapping is identified by locale codes supplied as query parameters rather than a path ID.
86
+ # @param account_id [String] Account ID
87
+ # @param source_locale_code [String] The locale code of the source language of the mapping to delete.
88
+ # @param target_locale_code [String] The locale code of the target language of the mapping to delete.
89
+ # @param [Hash] opts the optional parameters
90
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
91
+ # @return [nil]
92
+ def machine_translation_locale_provider_mappings_destroy(account_id, source_locale_code, target_locale_code, opts = {})
93
+ data, _status_code, _headers = machine_translation_locale_provider_mappings_destroy_with_http_info(account_id, source_locale_code, target_locale_code, opts)
94
+ data
95
+ end
96
+
97
+ # Delete a locale provider mapping
98
+ # Removes the machine translation provider override for the specified source and target locale pair. The mapping is identified by locale codes supplied as query parameters rather than a path ID.
99
+ # @param account_id [String] Account ID
100
+ # @param source_locale_code [String] The locale code of the source language of the mapping to delete.
101
+ # @param target_locale_code [String] The locale code of the target language of the mapping to delete.
102
+ # @param [Hash] opts the optional parameters
103
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
104
+ # @return [Array<(Response, Integer, Hash)>] Response<(nil, response status code and response headers
105
+ def machine_translation_locale_provider_mappings_destroy_with_http_info(account_id, source_locale_code, target_locale_code, opts = {})
106
+ if @api_client.config.debugging
107
+ @api_client.config.logger.debug 'Calling API: MachineTranslationApi.machine_translation_locale_provider_mappings_destroy ...'
108
+ end
109
+ # verify the required parameter 'account_id' is set
110
+ if @api_client.config.client_side_validation && account_id.nil?
111
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling MachineTranslationApi.machine_translation_locale_provider_mappings_destroy"
112
+ end
113
+ # verify the required parameter 'source_locale_code' is set
114
+ if @api_client.config.client_side_validation && source_locale_code.nil?
115
+ fail ArgumentError, "Missing the required parameter 'source_locale_code' when calling MachineTranslationApi.machine_translation_locale_provider_mappings_destroy"
116
+ end
117
+ # verify the required parameter 'target_locale_code' is set
118
+ if @api_client.config.client_side_validation && target_locale_code.nil?
119
+ fail ArgumentError, "Missing the required parameter 'target_locale_code' when calling MachineTranslationApi.machine_translation_locale_provider_mappings_destroy"
120
+ end
121
+ # resource path
122
+ local_var_path = '/accounts/{account_id}/machine_translation_locale_provider_mappings'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s))
123
+
124
+ # query parameters
125
+ query_params = opts[:query_params] || {}
126
+ query_params[:'source_locale_code'] = source_locale_code
127
+ query_params[:'target_locale_code'] = target_locale_code
128
+
129
+ # header parameters
130
+ header_params = opts[:header_params] || {}
131
+ header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
132
+
133
+ # form parameters
134
+ form_params = opts[:form_params] || {}
135
+
136
+ # http body (model)
137
+ post_body = opts[:body]
138
+
139
+ # return_type
140
+ return_type = opts[:return_type]
141
+
142
+ # auth_names
143
+ auth_names = opts[:auth_names] || ['Basic', 'Token']
144
+
145
+ new_options = opts.merge(
146
+ :header_params => header_params,
147
+ :query_params => query_params,
148
+ :form_params => form_params,
149
+ :body => post_body,
150
+ :auth_names => auth_names,
151
+ :return_type => return_type
152
+ )
153
+
154
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
155
+ if @api_client.config.debugging
156
+ @api_client.config.logger.debug "API called: MachineTranslationApi#machine_translation_locale_provider_mappings_destroy\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
157
+ end
158
+ response = ::Phrase::Response.new(data, headers)
159
+ return response, status_code, headers
160
+ end
161
+
162
+ # Get machine translation settings
163
+ # Returns the machine translation configuration for the account, including the default translation service, current machine translation unit usage, and any locale-pair-specific provider mappings.
164
+ # @param account_id [String] Account ID
165
+ # @param [Hash] opts the optional parameters
166
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
167
+ # @return [MachineTranslationSettings]
168
+ def machine_translation_settings_show(account_id, opts = {})
169
+ data, _status_code, _headers = machine_translation_settings_show_with_http_info(account_id, opts)
170
+ data
171
+ end
172
+
173
+ # Get machine translation settings
174
+ # Returns the machine translation configuration for the account, including the default translation service, current machine translation unit usage, and any locale-pair-specific provider mappings.
175
+ # @param account_id [String] Account ID
176
+ # @param [Hash] opts the optional parameters
177
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
178
+ # @return [Array<(Response<(MachineTranslationSettings)>, Integer, Hash)>] Response<(MachineTranslationSettings)> data, response status code and response headers
179
+ def machine_translation_settings_show_with_http_info(account_id, opts = {})
180
+ if @api_client.config.debugging
181
+ @api_client.config.logger.debug 'Calling API: MachineTranslationApi.machine_translation_settings_show ...'
182
+ end
183
+ # verify the required parameter 'account_id' is set
184
+ if @api_client.config.client_side_validation && account_id.nil?
185
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling MachineTranslationApi.machine_translation_settings_show"
186
+ end
187
+ # resource path
188
+ local_var_path = '/accounts/{account_id}/machine_translation_settings'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s))
189
+
190
+ # query parameters
191
+ query_params = opts[:query_params] || {}
192
+
193
+ # header parameters
194
+ header_params = opts[:header_params] || {}
195
+ # HTTP header 'Accept' (if needed)
196
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
197
+ header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
198
+
199
+ # form parameters
200
+ form_params = opts[:form_params] || {}
201
+
202
+ # http body (model)
203
+ post_body = opts[:body]
204
+
205
+ # return_type
206
+ return_type = opts[:return_type] || 'MachineTranslationSettings'
207
+
208
+ # auth_names
209
+ auth_names = opts[:auth_names] || ['Basic', 'Token']
210
+
211
+ new_options = opts.merge(
212
+ :header_params => header_params,
213
+ :query_params => query_params,
214
+ :form_params => form_params,
215
+ :body => post_body,
216
+ :auth_names => auth_names,
217
+ :return_type => return_type
218
+ )
219
+
220
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
221
+ if @api_client.config.debugging
222
+ @api_client.config.logger.debug "API called: MachineTranslationApi#machine_translation_settings_show\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
223
+ end
224
+ response = ::Phrase::Response.new(data, headers)
225
+ return response, status_code, headers
226
+ end
227
+
228
+ # Update machine translation settings
229
+ # Sets the default machine translation service for the account. Requires write access to the account's machine translation settings. Passing an empty or absent value for `default_service` resets the account to its plan default (Microsoft Translate).
230
+ # @param account_id [String] Account ID
231
+ # @param machine_translation_settings_update_parameters [MachineTranslationSettingsUpdateParameters]
232
+ # @param [Hash] opts the optional parameters
233
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
234
+ # @return [MachineTranslationSettings]
235
+ def machine_translation_settings_update(account_id, machine_translation_settings_update_parameters, opts = {})
236
+ data, _status_code, _headers = machine_translation_settings_update_with_http_info(account_id, machine_translation_settings_update_parameters, opts)
237
+ data
238
+ end
239
+
240
+ # Update machine translation settings
241
+ # Sets the default machine translation service for the account. Requires write access to the account&#39;s machine translation settings. Passing an empty or absent value for &#x60;default_service&#x60; resets the account to its plan default (Microsoft Translate).
242
+ # @param account_id [String] Account ID
243
+ # @param machine_translation_settings_update_parameters [MachineTranslationSettingsUpdateParameters]
244
+ # @param [Hash] opts the optional parameters
245
+ # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
246
+ # @return [Array<(Response<(MachineTranslationSettings)>, Integer, Hash)>] Response<(MachineTranslationSettings)> data, response status code and response headers
247
+ def machine_translation_settings_update_with_http_info(account_id, machine_translation_settings_update_parameters, opts = {})
248
+ if @api_client.config.debugging
249
+ @api_client.config.logger.debug 'Calling API: MachineTranslationApi.machine_translation_settings_update ...'
250
+ end
251
+ # verify the required parameter 'account_id' is set
252
+ if @api_client.config.client_side_validation && account_id.nil?
253
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling MachineTranslationApi.machine_translation_settings_update"
254
+ end
255
+ # verify the required parameter 'machine_translation_settings_update_parameters' is set
256
+ if @api_client.config.client_side_validation && machine_translation_settings_update_parameters.nil?
257
+ fail ArgumentError, "Missing the required parameter 'machine_translation_settings_update_parameters' when calling MachineTranslationApi.machine_translation_settings_update"
258
+ end
259
+ # resource path
260
+ local_var_path = '/accounts/{account_id}/machine_translation_settings'.sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s))
261
+
262
+ # query parameters
263
+ query_params = opts[:query_params] || {}
264
+
265
+ # header parameters
266
+ header_params = opts[:header_params] || {}
267
+ # HTTP header 'Accept' (if needed)
268
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
269
+ # HTTP header 'Content-Type'
270
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
271
+ header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?
272
+
273
+ # form parameters
274
+ form_params = opts[:form_params] || {}
275
+
276
+ # http body (model)
277
+ post_body = opts[:body] || @api_client.object_to_http_body(machine_translation_settings_update_parameters)
278
+
279
+ # return_type
280
+ return_type = opts[:return_type] || 'MachineTranslationSettings'
281
+
282
+ # auth_names
283
+ auth_names = opts[:auth_names] || ['Basic', 'Token']
284
+
285
+ new_options = opts.merge(
286
+ :header_params => header_params,
287
+ :query_params => query_params,
288
+ :form_params => form_params,
289
+ :body => post_body,
290
+ :auth_names => auth_names,
291
+ :return_type => return_type
292
+ )
293
+
294
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
295
+ if @api_client.config.debugging
296
+ @api_client.config.logger.debug "API called: MachineTranslationApi#machine_translation_settings_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
297
+ end
298
+ response = ::Phrase::Response.new(data, headers)
299
+ return response, status_code, headers
300
+ end
301
+ end
302
+ end
@@ -8,10 +8,10 @@ module Phrase
8
8
  @api_client = api_client
9
9
  end
10
10
  # Upload a new file
11
- # Upload a new language file. Creates necessary resources in your project. Note: be aware of [upload limits](https://support.phrase.com/hc/en-us/articles/8548271212188-Phrase-Strings-Limits#file-size-upload-limits-0-0).
11
+ # Upload a new language file. Creates necessary resources in your project. The upload is processed asynchronously: this endpoint returns `201 Created` once the file has been accepted and enqueued, not once processing has finished. Poll `GET /projects/{project_id}/uploads/{id}` and check the `state` field — `error` means processing failed (for example, an unparseable file or a `file_format` that doesn't match the file's actual content). Note: be aware of [upload limits](https://support.phrase.com/hc/en-us/articles/8548271212188-Phrase-Strings-Limits#file-size-upload-limits-0-0).
12
12
  # @param project_id [String] Project ID
13
13
  # @param file [File] File to be imported
14
- # @param file_format [String] File format. Auto-detected when possible and not specified.
14
+ # @param file_format [String] File format of the uploaded file, given as a format&#39;s &#x60;api_name&#x60;. See our [Formats API Endpoint](/en/api/strings/formats/list-formats) for the full list of supported formats. Optional. When omitted, Phrase tries to auto-detect the format from the file&#39;s content. This is not always possible for JSON files, since several JSON-based formats (e.g. &#x60;json&#x60;, &#x60;simple_json&#x60;, &#x60;nested_json&#x60;) share the same structure.
15
15
  # @param locale_id [String] Locale of the file&#39;s content. Can be the name or id of the locale. Preferred is id.
16
16
  # @param [Hash] opts the optional parameters
17
17
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
@@ -42,10 +42,10 @@ module Phrase
42
42
  end
43
43
 
44
44
  # Upload a new file
45
- # Upload a new language file. Creates necessary resources in your project. Note: be aware of [upload limits](https://support.phrase.com/hc/en-us/articles/8548271212188-Phrase-Strings-Limits#file-size-upload-limits-0-0).
45
+ # Upload a new language file. Creates necessary resources in your project. The upload is processed asynchronously: this endpoint returns &#x60;201 Created&#x60; once the file has been accepted and enqueued, not once processing has finished. Poll &#x60;GET /projects/{project_id}/uploads/{id}&#x60; and check the &#x60;state&#x60; field — &#x60;error&#x60; means processing failed (for example, an unparseable file or a &#x60;file_format&#x60; that doesn&#39;t match the file&#39;s actual content). Note: be aware of [upload limits](https://support.phrase.com/hc/en-us/articles/8548271212188-Phrase-Strings-Limits#file-size-upload-limits-0-0).
46
46
  # @param project_id [String] Project ID
47
47
  # @param file [File] File to be imported
48
- # @param file_format [String] File format. Auto-detected when possible and not specified.
48
+ # @param file_format [String] File format of the uploaded file, given as a format&#39;s &#x60;api_name&#x60;. See our [Formats API Endpoint](/en/api/strings/formats/list-formats) for the full list of supported formats. Optional. When omitted, Phrase tries to auto-detect the format from the file&#39;s content. This is not always possible for JSON files, since several JSON-based formats (e.g. &#x60;json&#x60;, &#x60;simple_json&#x60;, &#x60;nested_json&#x60;) share the same structure.
49
49
  # @param locale_id [String] Locale of the file&#39;s content. Can be the name or id of the locale. Preferred is id.
50
50
  # @param [Hash] opts the optional parameters
51
51
  # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
@@ -157,7 +157,7 @@ module Phrase
157
157
  end
158
158
 
159
159
  # Get a single upload
160
- # View details and summary for a single upload.
160
+ # View details and summary for a single upload. Use this endpoint to poll for the outcome of an upload created via `POST /projects/{project_id}/uploads` — check the `state` field.
161
161
  # @param project_id [String] Project ID
162
162
  # @param id [String] ID
163
163
  # @param [Hash] opts the optional parameters
@@ -170,7 +170,7 @@ module Phrase
170
170
  end
171
171
 
172
172
  # Get a single upload
173
- # View details and summary for a single upload.
173
+ # View details and summary for a single upload. Use this endpoint to poll for the outcome of an upload created via &#x60;POST /projects/{project_id}/uploads&#x60; — check the &#x60;state&#x60; field.
174
174
  # @param project_id [String] Project ID
175
175
  # @param id [String] ID
176
176
  # @param [Hash] opts the optional parameters
@@ -0,0 +1,319 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class CheckIssue
5
+ attr_accessor :id
6
+
7
+ # Identifier of the check that reported this issue. One of: `translation_content_length`, `translation_placeholder_usage`, `translation_glossary_usage`.
8
+ attr_accessor :check_name
9
+
10
+ # Current state of the check issue. One of: `active`, `solved`, `dismissed`.
11
+ attr_accessor :state
12
+
13
+ # Human-readable description of the reported issue, always in English. This message is intended for display only. Its wording may change at any time and it should not be parsed or relied upon programmatically.
14
+ attr_accessor :description
15
+
16
+ attr_accessor :dismissed_at
17
+
18
+ attr_accessor :solved_at
19
+
20
+ attr_accessor :created_at
21
+
22
+ attr_accessor :updated_at
23
+
24
+ attr_accessor :translation
25
+
26
+ class EnumAttributeValidator
27
+ attr_reader :datatype
28
+ attr_reader :allowable_values
29
+
30
+ def initialize(datatype, allowable_values)
31
+ @allowable_values = allowable_values.map do |value|
32
+ case datatype.to_s
33
+ when /Integer/i
34
+ value.to_i
35
+ when /Float/i
36
+ value.to_f
37
+ else
38
+ value
39
+ end
40
+ end
41
+ end
42
+
43
+ def valid?(value)
44
+ !value || allowable_values.include?(value)
45
+ end
46
+ end
47
+
48
+ # Attribute mapping from ruby-style variable name to JSON key.
49
+ def self.attribute_map
50
+ {
51
+ :'id' => :'id',
52
+ :'check_name' => :'check_name',
53
+ :'state' => :'state',
54
+ :'description' => :'description',
55
+ :'dismissed_at' => :'dismissed_at',
56
+ :'solved_at' => :'solved_at',
57
+ :'created_at' => :'created_at',
58
+ :'updated_at' => :'updated_at',
59
+ :'translation' => :'translation'
60
+ }
61
+ end
62
+
63
+ # Attribute type mapping.
64
+ def self.openapi_types
65
+ {
66
+ :'id' => :'String',
67
+ :'check_name' => :'String',
68
+ :'state' => :'String',
69
+ :'description' => :'String',
70
+ :'dismissed_at' => :'DateTime',
71
+ :'solved_at' => :'DateTime',
72
+ :'created_at' => :'DateTime',
73
+ :'updated_at' => :'DateTime',
74
+ :'translation' => :'Translation'
75
+ }
76
+ end
77
+
78
+ # List of attributes with nullable: true
79
+ def self.openapi_nullable
80
+ Set.new([
81
+ :'dismissed_at',
82
+ :'solved_at',
83
+ ])
84
+ end
85
+
86
+ # Initializes the object
87
+ # @param [Hash] attributes Model attributes in the form of hash
88
+ def initialize(attributes = {})
89
+ if (!attributes.is_a?(Hash))
90
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::CheckIssue` initialize method"
91
+ end
92
+
93
+ # check to see if the attribute exists and convert string to symbol for hash key
94
+ attributes = attributes.each_with_object({}) { |(k, v), h|
95
+ if (!self.class.attribute_map.key?(k.to_sym))
96
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::CheckIssue`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
97
+ end
98
+ h[k.to_sym] = v
99
+ }
100
+
101
+ if attributes.key?(:'id')
102
+ self.id = attributes[:'id']
103
+ end
104
+
105
+ if attributes.key?(:'check_name')
106
+ self.check_name = attributes[:'check_name']
107
+ end
108
+
109
+ if attributes.key?(:'state')
110
+ self.state = attributes[:'state']
111
+ end
112
+
113
+ if attributes.key?(:'description')
114
+ self.description = attributes[:'description']
115
+ end
116
+
117
+ if attributes.key?(:'dismissed_at')
118
+ self.dismissed_at = attributes[:'dismissed_at']
119
+ end
120
+
121
+ if attributes.key?(:'solved_at')
122
+ self.solved_at = attributes[:'solved_at']
123
+ end
124
+
125
+ if attributes.key?(:'created_at')
126
+ self.created_at = attributes[:'created_at']
127
+ end
128
+
129
+ if attributes.key?(:'updated_at')
130
+ self.updated_at = attributes[:'updated_at']
131
+ end
132
+
133
+ if attributes.key?(:'translation')
134
+ self.translation = attributes[:'translation']
135
+ end
136
+ end
137
+
138
+ # Show invalid properties with the reasons. Usually used together with valid?
139
+ # @return Array for valid properties with the reasons
140
+ def list_invalid_properties
141
+ invalid_properties = Array.new
142
+ invalid_properties
143
+ end
144
+
145
+ # Check to see if the all the properties in the model are valid
146
+ # @return true if the model is valid
147
+ def valid?
148
+ check_name_validator = EnumAttributeValidator.new('String', ["translation_content_length", "translation_placeholder_usage", "translation_glossary_usage"])
149
+ return false unless check_name_validator.valid?(@check_name)
150
+ state_validator = EnumAttributeValidator.new('String', ["active", "solved", "dismissed"])
151
+ return false unless state_validator.valid?(@state)
152
+ true
153
+ end
154
+
155
+ # Custom attribute writer method checking allowed values (enum).
156
+ # @param [Object] check_name Object to be assigned
157
+ def check_name=(check_name)
158
+ validator = EnumAttributeValidator.new('String', ["translation_content_length", "translation_placeholder_usage", "translation_glossary_usage"])
159
+ unless validator.valid?(check_name)
160
+ fail ArgumentError, "invalid value for \"check_name\", must be one of #{validator.allowable_values}."
161
+ end
162
+ @check_name = check_name
163
+ end
164
+
165
+ # Custom attribute writer method checking allowed values (enum).
166
+ # @param [Object] state Object to be assigned
167
+ def state=(state)
168
+ validator = EnumAttributeValidator.new('String', ["active", "solved", "dismissed"])
169
+ unless validator.valid?(state)
170
+ fail ArgumentError, "invalid value for \"state\", must be one of #{validator.allowable_values}."
171
+ end
172
+ @state = state
173
+ end
174
+
175
+ # Checks equality by comparing each attribute.
176
+ # @param [Object] Object to be compared
177
+ def ==(o)
178
+ return true if self.equal?(o)
179
+ self.class == o.class &&
180
+ id == o.id &&
181
+ check_name == o.check_name &&
182
+ state == o.state &&
183
+ description == o.description &&
184
+ dismissed_at == o.dismissed_at &&
185
+ solved_at == o.solved_at &&
186
+ created_at == o.created_at &&
187
+ updated_at == o.updated_at &&
188
+ translation == o.translation
189
+ end
190
+
191
+ # @see the `==` method
192
+ # @param [Object] Object to be compared
193
+ def eql?(o)
194
+ self == o
195
+ end
196
+
197
+ # Calculates hash code according to all attributes.
198
+ # @return [Integer] Hash code
199
+ def hash
200
+ [id, check_name, state, description, dismissed_at, solved_at, created_at, updated_at, translation].hash
201
+ end
202
+
203
+ # Builds the object from hash
204
+ # @param [Hash] attributes Model attributes in the form of hash
205
+ # @return [Object] Returns the model itself
206
+ def self.build_from_hash(attributes)
207
+ new.build_from_hash(attributes)
208
+ end
209
+
210
+ # Builds the object from hash
211
+ # @param [Hash] attributes Model attributes in the form of hash
212
+ # @return [Object] Returns the model itself
213
+ def build_from_hash(attributes)
214
+ return nil unless attributes.is_a?(Hash)
215
+ self.class.openapi_types.each_pair do |key, type|
216
+ if type =~ /\AArray<(.*)>/i
217
+ # check to ensure the input is an array given that the attribute
218
+ # is documented as an array but the input is not
219
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
220
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
221
+ end
222
+ elsif !attributes[self.class.attribute_map[key]].nil?
223
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
224
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
225
+ end
226
+
227
+ self
228
+ end
229
+
230
+ # Deserializes the data based on type
231
+ # @param string type Data type
232
+ # @param string value Value to be deserialized
233
+ # @return [Object] Deserialized data
234
+ def _deserialize(type, value)
235
+ case type.to_sym
236
+ when :DateTime
237
+ DateTime.parse(value)
238
+ when :Date
239
+ Date.parse(value)
240
+ when :Time
241
+ Time.parse(value)
242
+ when :String
243
+ value.to_s
244
+ when :Integer
245
+ value.to_i
246
+ when :Float
247
+ value.to_f
248
+ when :Boolean
249
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
250
+ true
251
+ else
252
+ false
253
+ end
254
+ when :Object
255
+ # generic object (usually a Hash), return directly
256
+ value
257
+ when /\AArray<(?<inner_type>.+)>\z/
258
+ inner_type = Regexp.last_match[:inner_type]
259
+ value.map { |v| _deserialize(inner_type, v) }
260
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
261
+ k_type = Regexp.last_match[:k_type]
262
+ v_type = Regexp.last_match[:v_type]
263
+ {}.tap do |hash|
264
+ value.each do |k, v|
265
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
266
+ end
267
+ end
268
+ else # model
269
+ Phrase.const_get(type).build_from_hash(value)
270
+ end
271
+ end
272
+
273
+ # Returns the string representation of the object
274
+ # @return [String] String presentation of the object
275
+ def to_s
276
+ to_hash.to_s
277
+ end
278
+
279
+ # to_body is an alias to to_hash (backward compatibility)
280
+ # @return [Hash] Returns the object in the form of hash
281
+ def to_body
282
+ to_hash
283
+ end
284
+
285
+ # Returns the object in the form of hash
286
+ # @return [Hash] Returns the object in the form of hash
287
+ def to_hash
288
+ hash = {}
289
+ self.class.attribute_map.each_pair do |attr, param|
290
+ value = self.send(attr)
291
+ if value.nil?
292
+ is_nullable = self.class.openapi_nullable.include?(attr)
293
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
294
+ end
295
+
296
+ hash[param] = _to_hash(value)
297
+ end
298
+ hash
299
+ end
300
+
301
+ # Outputs non-array value in the form of hash
302
+ # For object, use to_hash. Otherwise, just return the value
303
+ # @param [Object] value Any valid value
304
+ # @return [Hash] Returns the value in the form of hash
305
+ def _to_hash(value)
306
+ if value.is_a?(Array)
307
+ value.compact.map { |v| _to_hash(v) }
308
+ elsif value.is_a?(Hash)
309
+ {}.tap do |hash|
310
+ value.each { |k, v| hash[k] = _to_hash(v) }
311
+ end
312
+ elsif value.respond_to? :to_hash
313
+ value.to_hash
314
+ else
315
+ value
316
+ end
317
+ end
318
+ end
319
+ end
@@ -20,7 +20,7 @@ module Phrase
20
20
  # URL to a ticket for this job (e.g. Jira, Trello)
21
21
  attr_accessor :ticket_url
22
22
 
23
- # tags of keys that should be included within the job
23
+ # tags of keys that should be included within the job. *Note: a tag matches every key currently carrying that tag, not just the ones you just tagged. For example, if hundreds of pre-existing keys already share the tag `myUploadTag`, adding it here pulls in every one of them, not only the key you just tagged. Use `translation_key_ids` to scope the job to specific keys instead.*
24
24
  attr_accessor :tags
25
25
 
26
26
  # ids of keys that should be included within the job