phrase 4.25.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 (113) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +29 -0
  3. data/README.md +26 -4
  4. data/docs/AutomationEvent.md +33 -0
  5. data/docs/AutomationEventProject.md +19 -0
  6. data/docs/AutomationEventsApi.md +168 -0
  7. data/docs/AutomationsCreateParameters.md +1 -1
  8. data/docs/AutomationsCreateParameters1.md +1 -1
  9. data/docs/CheckIssue.md +33 -0
  10. data/docs/ChecksApi.md +146 -0
  11. data/docs/DocumentsApi.md +4 -4
  12. data/docs/ICUApi.md +1 -1
  13. data/docs/IcuSkeletonError.md +17 -0
  14. data/docs/IcuSkeletonParameters.md +11 -11
  15. data/docs/JobCreateParameters.md +1 -1
  16. data/docs/JobsApi.md +2 -2
  17. data/docs/KeyCreateParameters.md +1 -1
  18. data/docs/KeyFormatAnnotationsApi.md +74 -0
  19. data/docs/KeyFormatAnnotationsList200ResponseInner.md +19 -0
  20. data/docs/KeyLinksBatchDestroyParameters.md +6 -4
  21. data/docs/KeyLinksCreateParameters.md +2 -2
  22. data/docs/KeyUpdateParameters.md +1 -1
  23. data/docs/LinkedKeysApi.md +14 -13
  24. data/docs/Locale.md +6 -0
  25. data/docs/LocaleCreateParameters.md +2 -0
  26. data/docs/LocaleDetails.md +6 -0
  27. data/docs/LocaleUpdateParameters.md +2 -0
  28. data/docs/MachineTranslationApi.md +263 -0
  29. data/docs/MachineTranslationLocaleProviderMapping.md +21 -0
  30. data/docs/MachineTranslationLocaleProviderMappingsCreateParameters.md +21 -0
  31. data/docs/MachineTranslationSettings.md +23 -0
  32. data/docs/MachineTranslationSettingsUpdateParameters.md +17 -0
  33. data/docs/PreTranslation.md +29 -0
  34. data/docs/PreTranslationCreateParameters.md +19 -0
  35. data/docs/PreTranslationsApi.md +210 -0
  36. data/docs/ProjectCreateParameters.md +8 -2
  37. data/docs/ProjectDetails.md +3 -1
  38. data/docs/ProjectUpdateParameters.md +8 -2
  39. data/docs/ScreenshotUpdateParameters.md +1 -1
  40. data/docs/ScreenshotsApi.md +2 -2
  41. data/docs/Upload.md +3 -1
  42. data/docs/UploadsApi.md +4 -4
  43. data/lib/phrase/api/automation_events_api.rb +215 -0
  44. data/lib/phrase/api/checks_api.rb +174 -0
  45. data/lib/phrase/api/documents_api.rb +6 -6
  46. data/lib/phrase/api/icu_api.rb +2 -6
  47. data/lib/phrase/api/key_format_annotations_api.rb +85 -0
  48. data/lib/phrase/api/linked_keys_api.rb +19 -23
  49. data/lib/phrase/api/machine_translation_api.rb +302 -0
  50. data/lib/phrase/api/pre_translations_api.rb +240 -0
  51. data/lib/phrase/api/screenshots_api.rb +4 -4
  52. data/lib/phrase/api/uploads_api.rb +6 -6
  53. data/lib/phrase/models/automation_event.rb +325 -0
  54. data/lib/phrase/models/automation_event_project.rb +208 -0
  55. data/lib/phrase/models/automations_create_parameters.rb +1 -1
  56. data/lib/phrase/models/automations_create_parameters1.rb +1 -1
  57. data/lib/phrase/models/check_issue.rb +319 -0
  58. data/lib/phrase/models/{key_links_index400_response.rb → icu_skeleton_error.rb} +11 -10
  59. data/lib/phrase/models/icu_skeleton_parameters.rb +6 -6
  60. data/lib/phrase/models/job_create_parameters.rb +1 -1
  61. data/lib/phrase/models/key_format_annotations_list200_response_inner.rb +207 -0
  62. data/lib/phrase/models/key_links_batch_destroy_parameters.rb +52 -6
  63. data/lib/phrase/models/key_links_create_parameters.rb +1 -1
  64. data/lib/phrase/models/locale.rb +31 -1
  65. data/lib/phrase/models/locale_create_parameters.rb +11 -1
  66. data/lib/phrase/models/locale_details.rb +31 -1
  67. data/lib/phrase/models/locale_update_parameters.rb +11 -1
  68. data/lib/phrase/models/machine_translation_locale_provider_mapping.rb +217 -0
  69. data/lib/phrase/models/machine_translation_locale_provider_mappings_create_parameters.rb +232 -0
  70. data/lib/phrase/models/machine_translation_settings.rb +230 -0
  71. data/lib/phrase/models/machine_translation_settings_update_parameters.rb +198 -0
  72. data/lib/phrase/models/pre_translation.rb +301 -0
  73. data/lib/phrase/models/pre_translation_create_parameters.rb +241 -0
  74. data/lib/phrase/models/project_create_parameters.rb +35 -1
  75. data/lib/phrase/models/project_details.rb +10 -1
  76. data/lib/phrase/models/project_update_parameters.rb +35 -1
  77. data/lib/phrase/models/upload.rb +13 -1
  78. data/lib/phrase/response.rb +2 -2
  79. data/lib/phrase/version.rb +1 -1
  80. data/lib/phrase.rb +16 -1
  81. data/phrase.gemspec +1 -1
  82. data/spec/api/automation_events_api_spec.rb +67 -0
  83. data/spec/api/checks_api_spec.rb +56 -0
  84. data/spec/api/documents_api_spec.rb +3 -3
  85. data/spec/api/icu_api_spec.rb +1 -1
  86. data/spec/api/key_format_annotations_api_spec.rb +38 -0
  87. data/spec/api/linked_keys_api_spec.rb +7 -7
  88. data/spec/api/machine_translation_api_spec.rb +79 -0
  89. data/spec/api/pre_translations_api_spec.rb +70 -0
  90. data/spec/api/screenshots_api_spec.rb +2 -2
  91. data/spec/models/automation_event_project_spec.rb +35 -0
  92. data/spec/models/automation_event_spec.rb +85 -0
  93. data/spec/models/check_issue_spec.rb +85 -0
  94. data/spec/models/{key_links_index400_response_spec.rb → icu_skeleton_error_spec.rb} +7 -7
  95. data/spec/models/key_format_annotations_list200_response_inner_spec.rb +35 -0
  96. data/spec/models/key_links_batch_destroy_parameters_spec.rb +10 -0
  97. data/spec/models/locale_create_parameters_spec.rb +6 -0
  98. data/spec/models/locale_details_spec.rb +18 -0
  99. data/spec/models/locale_spec.rb +18 -0
  100. data/spec/models/locale_update_parameters_spec.rb +6 -0
  101. data/spec/models/machine_translation_locale_provider_mapping_spec.rb +41 -0
  102. data/spec/models/machine_translation_locale_provider_mappings_create_parameters_spec.rb +41 -0
  103. data/spec/models/machine_translation_settings_spec.rb +47 -0
  104. data/spec/models/machine_translation_settings_update_parameters_spec.rb +29 -0
  105. data/spec/models/pre_translation_create_parameters_spec.rb +39 -0
  106. data/spec/models/pre_translation_spec.rb +73 -0
  107. data/spec/models/project_create_parameters_spec.rb +18 -0
  108. data/spec/models/project_details_spec.rb +6 -0
  109. data/spec/models/project_update_parameters_spec.rb +18 -0
  110. data/spec/models/upload_spec.rb +6 -0
  111. data/spec/response_spec.rb +53 -0
  112. metadata +313 -251
  113. data/docs/KeyLinksIndex400Response.md +0 -17
@@ -0,0 +1,208 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ # The project associated with this automation event. Null when no project is set.
5
+ class AutomationEventProject
6
+ # Project identifier.
7
+ attr_accessor :id
8
+
9
+ # Project name.
10
+ attr_accessor :name
11
+
12
+ # Attribute mapping from ruby-style variable name to JSON key.
13
+ def self.attribute_map
14
+ {
15
+ :'id' => :'id',
16
+ :'name' => :'name'
17
+ }
18
+ end
19
+
20
+ # Attribute type mapping.
21
+ def self.openapi_types
22
+ {
23
+ :'id' => :'String',
24
+ :'name' => :'String'
25
+ }
26
+ end
27
+
28
+ # List of attributes with nullable: true
29
+ def self.openapi_nullable
30
+ Set.new([
31
+ ])
32
+ end
33
+
34
+ # Initializes the object
35
+ # @param [Hash] attributes Model attributes in the form of hash
36
+ def initialize(attributes = {})
37
+ if (!attributes.is_a?(Hash))
38
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::AutomationEventProject` initialize method"
39
+ end
40
+
41
+ # check to see if the attribute exists and convert string to symbol for hash key
42
+ attributes = attributes.each_with_object({}) { |(k, v), h|
43
+ if (!self.class.attribute_map.key?(k.to_sym))
44
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::AutomationEventProject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
45
+ end
46
+ h[k.to_sym] = v
47
+ }
48
+
49
+ if attributes.key?(:'id')
50
+ self.id = attributes[:'id']
51
+ end
52
+
53
+ if attributes.key?(:'name')
54
+ self.name = attributes[:'name']
55
+ end
56
+ end
57
+
58
+ # Show invalid properties with the reasons. Usually used together with valid?
59
+ # @return Array for valid properties with the reasons
60
+ def list_invalid_properties
61
+ invalid_properties = Array.new
62
+ invalid_properties
63
+ end
64
+
65
+ # Check to see if the all the properties in the model are valid
66
+ # @return true if the model is valid
67
+ def valid?
68
+ true
69
+ end
70
+
71
+ # Checks equality by comparing each attribute.
72
+ # @param [Object] Object to be compared
73
+ def ==(o)
74
+ return true if self.equal?(o)
75
+ self.class == o.class &&
76
+ id == o.id &&
77
+ name == o.name
78
+ end
79
+
80
+ # @see the `==` method
81
+ # @param [Object] Object to be compared
82
+ def eql?(o)
83
+ self == o
84
+ end
85
+
86
+ # Calculates hash code according to all attributes.
87
+ # @return [Integer] Hash code
88
+ def hash
89
+ [id, name].hash
90
+ end
91
+
92
+ # Builds the object from hash
93
+ # @param [Hash] attributes Model attributes in the form of hash
94
+ # @return [Object] Returns the model itself
95
+ def self.build_from_hash(attributes)
96
+ new.build_from_hash(attributes)
97
+ end
98
+
99
+ # Builds the object from hash
100
+ # @param [Hash] attributes Model attributes in the form of hash
101
+ # @return [Object] Returns the model itself
102
+ def build_from_hash(attributes)
103
+ return nil unless attributes.is_a?(Hash)
104
+ self.class.openapi_types.each_pair do |key, type|
105
+ if type =~ /\AArray<(.*)>/i
106
+ # check to ensure the input is an array given that the attribute
107
+ # is documented as an array but the input is not
108
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
109
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
110
+ end
111
+ elsif !attributes[self.class.attribute_map[key]].nil?
112
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
113
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
114
+ end
115
+
116
+ self
117
+ end
118
+
119
+ # Deserializes the data based on type
120
+ # @param string type Data type
121
+ # @param string value Value to be deserialized
122
+ # @return [Object] Deserialized data
123
+ def _deserialize(type, value)
124
+ case type.to_sym
125
+ when :DateTime
126
+ DateTime.parse(value)
127
+ when :Date
128
+ Date.parse(value)
129
+ when :Time
130
+ Time.parse(value)
131
+ when :String
132
+ value.to_s
133
+ when :Integer
134
+ value.to_i
135
+ when :Float
136
+ value.to_f
137
+ when :Boolean
138
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
139
+ true
140
+ else
141
+ false
142
+ end
143
+ when :Object
144
+ # generic object (usually a Hash), return directly
145
+ value
146
+ when /\AArray<(?<inner_type>.+)>\z/
147
+ inner_type = Regexp.last_match[:inner_type]
148
+ value.map { |v| _deserialize(inner_type, v) }
149
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
150
+ k_type = Regexp.last_match[:k_type]
151
+ v_type = Regexp.last_match[:v_type]
152
+ {}.tap do |hash|
153
+ value.each do |k, v|
154
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
155
+ end
156
+ end
157
+ else # model
158
+ Phrase.const_get(type).build_from_hash(value)
159
+ end
160
+ end
161
+
162
+ # Returns the string representation of the object
163
+ # @return [String] String presentation of the object
164
+ def to_s
165
+ to_hash.to_s
166
+ end
167
+
168
+ # to_body is an alias to to_hash (backward compatibility)
169
+ # @return [Hash] Returns the object in the form of hash
170
+ def to_body
171
+ to_hash
172
+ end
173
+
174
+ # Returns the object in the form of hash
175
+ # @return [Hash] Returns the object in the form of hash
176
+ def to_hash
177
+ hash = {}
178
+ self.class.attribute_map.each_pair do |attr, param|
179
+ value = self.send(attr)
180
+ if value.nil?
181
+ is_nullable = self.class.openapi_nullable.include?(attr)
182
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
183
+ end
184
+
185
+ hash[param] = _to_hash(value)
186
+ end
187
+ hash
188
+ end
189
+
190
+ # Outputs non-array value in the form of hash
191
+ # For object, use to_hash. Otherwise, just return the value
192
+ # @param [Object] value Any valid value
193
+ # @return [Hash] Returns the value in the form of hash
194
+ def _to_hash(value)
195
+ if value.is_a?(Array)
196
+ value.compact.map { |v| _to_hash(v) }
197
+ elsif value.is_a?(Hash)
198
+ {}.tap do |hash|
199
+ value.each { |k, v| hash[k] = _to_hash(v) }
200
+ end
201
+ elsif value.respond_to? :to_hash
202
+ value.to_hash
203
+ else
204
+ value
205
+ end
206
+ end
207
+ end
208
+ end
@@ -7,7 +7,7 @@ module Phrase
7
7
 
8
8
  attr_accessor :trigger
9
9
 
10
- # List of project IDs to associate with the automation. Currently, only the first ID in the array is used. The array format leaves room for future support of multiple projects.
10
+ # List of project IDs to associate with the automation. Providing more than one project ID requires the `advanced_job_automation` plan feature; accounts without this feature receive a 422 response with error field `project_ids`.
11
11
  attr_accessor :project_ids
12
12
 
13
13
  # id of job template that the automation uses to create jobs from
@@ -7,7 +7,7 @@ module Phrase
7
7
 
8
8
  attr_accessor :trigger
9
9
 
10
- # List of project IDs to associate with the automation. Currently, only the first ID in the array is used. The array format leaves room for future support of multiple projects.
10
+ # List of project IDs to associate with the automation. Providing more than one project ID requires the `advanced_job_automation` plan feature; accounts without this feature receive a 422 response with error field `project_ids`.
11
11
  attr_accessor :project_ids
12
12
 
13
13
  # id of job template that the automation uses to create jobs from
@@ -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
@@ -1,20 +1,21 @@
1
1
  require 'date'
2
2
 
3
3
  module Phrase
4
- class KeyLinksIndex400Response
5
- attr_accessor :message
4
+ class IcuSkeletonError
5
+ # Human-readable description of the ICU message format parse failure.
6
+ attr_accessor :error
6
7
 
7
8
  # Attribute mapping from ruby-style variable name to JSON key.
8
9
  def self.attribute_map
9
10
  {
10
- :'message' => :'message'
11
+ :'error' => :'error'
11
12
  }
12
13
  end
13
14
 
14
15
  # Attribute type mapping.
15
16
  def self.openapi_types
16
17
  {
17
- :'message' => :'String'
18
+ :'error' => :'String'
18
19
  }
19
20
  end
20
21
 
@@ -28,19 +29,19 @@ module Phrase
28
29
  # @param [Hash] attributes Model attributes in the form of hash
29
30
  def initialize(attributes = {})
30
31
  if (!attributes.is_a?(Hash))
31
- fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::KeyLinksIndex400Response` initialize method"
32
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::IcuSkeletonError` initialize method"
32
33
  end
33
34
 
34
35
  # check to see if the attribute exists and convert string to symbol for hash key
35
36
  attributes = attributes.each_with_object({}) { |(k, v), h|
36
37
  if (!self.class.attribute_map.key?(k.to_sym))
37
- fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::KeyLinksIndex400Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
38
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::IcuSkeletonError`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
38
39
  end
39
40
  h[k.to_sym] = v
40
41
  }
41
42
 
42
- if attributes.key?(:'message')
43
- self.message = attributes[:'message']
43
+ if attributes.key?(:'error')
44
+ self.error = attributes[:'error']
44
45
  end
45
46
  end
46
47
 
@@ -62,7 +63,7 @@ module Phrase
62
63
  def ==(o)
63
64
  return true if self.equal?(o)
64
65
  self.class == o.class &&
65
- message == o.message
66
+ error == o.error
66
67
  end
67
68
 
68
69
  # @see the `==` method
@@ -74,7 +75,7 @@ module Phrase
74
75
  # Calculates hash code according to all attributes.
75
76
  # @return [Integer] Hash code
76
77
  def hash
77
- [message].hash
78
+ [error].hash
78
79
  end
79
80
 
80
81
  # Builds the object from hash
@@ -2,22 +2,22 @@ require 'date'
2
2
 
3
3
  module Phrase
4
4
  class IcuSkeletonParameters
5
- # Source content to derive skeletons from. Mutually exclusive with `id`; exactly one of the two must be provided.
5
+ # Source ICU message string to derive skeletons from. Mutually exclusive with `id`; exactly one of the two must be provided.
6
6
  attr_accessor :content
7
7
 
8
- # Translation code to source content from. Mutually exclusive with `content`; exactly one of the two must be provided.
8
+ # Code of an existing translation to source content from. Mutually exclusive with `content`; exactly one of the two must be provided. Returns 404 when the translation does not exist.
9
9
  attr_accessor :id
10
10
 
11
- # Locale codes
11
+ # Locale codes for which to generate skeletons. The pluralization rules of each locale determine which plural forms appear in the output.
12
12
  attr_accessor :locale_codes
13
13
 
14
- # Keep the content and add missing plural forms for each locale
14
+ # When true, preserves the existing translation text in each plural form and adds any missing forms for the locale rather than stripping all literal content.
15
15
  attr_accessor :keep_content
16
16
 
17
- # Indicates whether the zero form should be included or excluded in the returned skeletons
17
+ # When true, includes the zero plural form in the generated skeleton for locales that support it.
18
18
  attr_accessor :zero_form_enabled
19
19
 
20
- # Strings supports two CLDR variants, when it comes to pluralization rules. \\ You can choose which one you want to use when constructing the skeletons. Possible values \\ are `legacy` and `cldr_41`. Default value is `legacy`.
20
+ # Pluralization rule set to use when constructing skeletons. Pass `legacy` for pre-CLDR behaviour, or a CLDR version string such as `cldr48`. Defaults to the project's configured version when omitted.
21
21
  attr_accessor :cldr_version
22
22
 
23
23
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -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