phrase 4.25.0 → 4.26.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -0
- data/README.md +15 -4
- data/docs/AutomationEvent.md +33 -0
- data/docs/AutomationEventProject.md +19 -0
- data/docs/AutomationEventsApi.md +168 -0
- data/docs/AutomationsCreateParameters.md +1 -1
- data/docs/AutomationsCreateParameters1.md +1 -1
- data/docs/DocumentsApi.md +4 -4
- data/docs/ICUApi.md +1 -1
- data/docs/IcuSkeletonError.md +17 -0
- data/docs/IcuSkeletonParameters.md +11 -11
- data/docs/JobsApi.md +2 -2
- data/docs/KeyCreateParameters.md +1 -1
- data/docs/KeyFormatAnnotationsApi.md +74 -0
- data/docs/KeyFormatAnnotationsList200ResponseInner.md +19 -0
- data/docs/KeyLinksBatchDestroyParameters.md +6 -4
- data/docs/KeyLinksCreateParameters.md +2 -2
- data/docs/KeyUpdateParameters.md +1 -1
- data/docs/LinkedKeysApi.md +14 -13
- data/docs/PreTranslation.md +29 -0
- data/docs/PreTranslationCreateParameters.md +19 -0
- data/docs/PreTranslationsApi.md +210 -0
- data/docs/ProjectCreateParameters.md +1 -1
- data/docs/ProjectUpdateParameters.md +1 -1
- data/docs/ScreenshotUpdateParameters.md +1 -1
- data/docs/ScreenshotsApi.md +2 -2
- data/lib/phrase/api/automation_events_api.rb +215 -0
- data/lib/phrase/api/documents_api.rb +6 -6
- data/lib/phrase/api/icu_api.rb +2 -6
- data/lib/phrase/api/key_format_annotations_api.rb +85 -0
- data/lib/phrase/api/linked_keys_api.rb +19 -23
- data/lib/phrase/api/pre_translations_api.rb +240 -0
- data/lib/phrase/api/screenshots_api.rb +4 -4
- data/lib/phrase/models/automation_event.rb +325 -0
- data/lib/phrase/models/automation_event_project.rb +208 -0
- data/lib/phrase/models/automations_create_parameters.rb +1 -1
- data/lib/phrase/models/automations_create_parameters1.rb +1 -1
- data/lib/phrase/models/{key_links_index400_response.rb → icu_skeleton_error.rb} +11 -10
- data/lib/phrase/models/icu_skeleton_parameters.rb +6 -6
- data/lib/phrase/models/key_format_annotations_list200_response_inner.rb +207 -0
- data/lib/phrase/models/key_links_batch_destroy_parameters.rb +52 -6
- data/lib/phrase/models/key_links_create_parameters.rb +1 -1
- data/lib/phrase/models/pre_translation.rb +301 -0
- data/lib/phrase/models/pre_translation_create_parameters.rb +241 -0
- data/lib/phrase/response.rb +2 -2
- data/lib/phrase/version.rb +1 -1
- data/lib/phrase.rb +9 -1
- data/phrase.gemspec +1 -1
- data/spec/api/automation_events_api_spec.rb +67 -0
- data/spec/api/documents_api_spec.rb +3 -3
- data/spec/api/icu_api_spec.rb +1 -1
- data/spec/api/key_format_annotations_api_spec.rb +38 -0
- data/spec/api/linked_keys_api_spec.rb +7 -7
- data/spec/api/pre_translations_api_spec.rb +70 -0
- data/spec/api/screenshots_api_spec.rb +2 -2
- data/spec/models/automation_event_project_spec.rb +35 -0
- data/spec/models/automation_event_spec.rb +85 -0
- data/spec/models/{key_links_index400_response_spec.rb → icu_skeleton_error_spec.rb} +7 -7
- data/spec/models/key_format_annotations_list200_response_inner_spec.rb +35 -0
- data/spec/models/key_links_batch_destroy_parameters_spec.rb +10 -0
- data/spec/models/pre_translation_create_parameters_spec.rb +39 -0
- data/spec/models/pre_translation_spec.rb +73 -0
- data/spec/response_spec.rb +53 -0
- metadata +291 -257
- data/docs/KeyLinksIndex400Response.md +0 -17
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
require 'date'
|
|
2
|
+
|
|
3
|
+
module Phrase
|
|
4
|
+
class AutomationEvent
|
|
5
|
+
# Unique identifier of the automation event.
|
|
6
|
+
attr_accessor :id
|
|
7
|
+
|
|
8
|
+
# Identifier of the automation that produced this event.
|
|
9
|
+
attr_accessor :automation_id
|
|
10
|
+
|
|
11
|
+
# Outcome of the automation run.
|
|
12
|
+
attr_accessor :state
|
|
13
|
+
|
|
14
|
+
# What caused the automation to run.
|
|
15
|
+
attr_accessor :triggered_by
|
|
16
|
+
|
|
17
|
+
# Timestamp when the event was created.
|
|
18
|
+
attr_accessor :created_at
|
|
19
|
+
|
|
20
|
+
# Number of jobs created during this automation run.
|
|
21
|
+
attr_accessor :jobs_created
|
|
22
|
+
|
|
23
|
+
# Identifiers of the jobs created during this automation run.
|
|
24
|
+
attr_accessor :job_ids
|
|
25
|
+
|
|
26
|
+
attr_accessor :project
|
|
27
|
+
|
|
28
|
+
# Error message describing the failure when state is `failure`; null otherwise.
|
|
29
|
+
attr_accessor :details
|
|
30
|
+
|
|
31
|
+
class EnumAttributeValidator
|
|
32
|
+
attr_reader :datatype
|
|
33
|
+
attr_reader :allowable_values
|
|
34
|
+
|
|
35
|
+
def initialize(datatype, allowable_values)
|
|
36
|
+
@allowable_values = allowable_values.map do |value|
|
|
37
|
+
case datatype.to_s
|
|
38
|
+
when /Integer/i
|
|
39
|
+
value.to_i
|
|
40
|
+
when /Float/i
|
|
41
|
+
value.to_f
|
|
42
|
+
else
|
|
43
|
+
value
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def valid?(value)
|
|
49
|
+
!value || allowable_values.include?(value)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
54
|
+
def self.attribute_map
|
|
55
|
+
{
|
|
56
|
+
:'id' => :'id',
|
|
57
|
+
:'automation_id' => :'automation_id',
|
|
58
|
+
:'state' => :'state',
|
|
59
|
+
:'triggered_by' => :'triggered_by',
|
|
60
|
+
:'created_at' => :'created_at',
|
|
61
|
+
:'jobs_created' => :'jobs_created',
|
|
62
|
+
:'job_ids' => :'job_ids',
|
|
63
|
+
:'project' => :'project',
|
|
64
|
+
:'details' => :'details'
|
|
65
|
+
}
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Attribute type mapping.
|
|
69
|
+
def self.openapi_types
|
|
70
|
+
{
|
|
71
|
+
:'id' => :'String',
|
|
72
|
+
:'automation_id' => :'String',
|
|
73
|
+
:'state' => :'String',
|
|
74
|
+
:'triggered_by' => :'String',
|
|
75
|
+
:'created_at' => :'DateTime',
|
|
76
|
+
:'jobs_created' => :'Integer',
|
|
77
|
+
:'job_ids' => :'Array<String>',
|
|
78
|
+
:'project' => :'AutomationEventProject',
|
|
79
|
+
:'details' => :'String'
|
|
80
|
+
}
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# List of attributes with nullable: true
|
|
84
|
+
def self.openapi_nullable
|
|
85
|
+
Set.new([
|
|
86
|
+
:'details'
|
|
87
|
+
])
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Initializes the object
|
|
91
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
92
|
+
def initialize(attributes = {})
|
|
93
|
+
if (!attributes.is_a?(Hash))
|
|
94
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::AutomationEvent` initialize method"
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
98
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
99
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
100
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::AutomationEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
101
|
+
end
|
|
102
|
+
h[k.to_sym] = v
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if attributes.key?(:'id')
|
|
106
|
+
self.id = attributes[:'id']
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
if attributes.key?(:'automation_id')
|
|
110
|
+
self.automation_id = attributes[:'automation_id']
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
if attributes.key?(:'state')
|
|
114
|
+
self.state = attributes[:'state']
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
if attributes.key?(:'triggered_by')
|
|
118
|
+
self.triggered_by = attributes[:'triggered_by']
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
if attributes.key?(:'created_at')
|
|
122
|
+
self.created_at = attributes[:'created_at']
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
if attributes.key?(:'jobs_created')
|
|
126
|
+
self.jobs_created = attributes[:'jobs_created']
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
if attributes.key?(:'job_ids')
|
|
130
|
+
if (value = attributes[:'job_ids']).is_a?(Array)
|
|
131
|
+
self.job_ids = value
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
if attributes.key?(:'project')
|
|
136
|
+
self.project = attributes[:'project']
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
if attributes.key?(:'details')
|
|
140
|
+
self.details = attributes[:'details']
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
145
|
+
# @return Array for valid properties with the reasons
|
|
146
|
+
def list_invalid_properties
|
|
147
|
+
invalid_properties = Array.new
|
|
148
|
+
invalid_properties
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# Check to see if the all the properties in the model are valid
|
|
152
|
+
# @return true if the model is valid
|
|
153
|
+
def valid?
|
|
154
|
+
state_validator = EnumAttributeValidator.new('String', ["success", "failure", "in_progress"])
|
|
155
|
+
return false unless state_validator.valid?(@state)
|
|
156
|
+
triggered_by_validator = EnumAttributeValidator.new('String', ["manual", "schedule", "upload", "upload_batch"])
|
|
157
|
+
return false unless triggered_by_validator.valid?(@triggered_by)
|
|
158
|
+
true
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
162
|
+
# @param [Object] state Object to be assigned
|
|
163
|
+
def state=(state)
|
|
164
|
+
validator = EnumAttributeValidator.new('String', ["success", "failure", "in_progress"])
|
|
165
|
+
unless validator.valid?(state)
|
|
166
|
+
fail ArgumentError, "invalid value for \"state\", must be one of #{validator.allowable_values}."
|
|
167
|
+
end
|
|
168
|
+
@state = state
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
172
|
+
# @param [Object] triggered_by Object to be assigned
|
|
173
|
+
def triggered_by=(triggered_by)
|
|
174
|
+
validator = EnumAttributeValidator.new('String', ["manual", "schedule", "upload", "upload_batch"])
|
|
175
|
+
unless validator.valid?(triggered_by)
|
|
176
|
+
fail ArgumentError, "invalid value for \"triggered_by\", must be one of #{validator.allowable_values}."
|
|
177
|
+
end
|
|
178
|
+
@triggered_by = triggered_by
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
# Checks equality by comparing each attribute.
|
|
182
|
+
# @param [Object] Object to be compared
|
|
183
|
+
def ==(o)
|
|
184
|
+
return true if self.equal?(o)
|
|
185
|
+
self.class == o.class &&
|
|
186
|
+
id == o.id &&
|
|
187
|
+
automation_id == o.automation_id &&
|
|
188
|
+
state == o.state &&
|
|
189
|
+
triggered_by == o.triggered_by &&
|
|
190
|
+
created_at == o.created_at &&
|
|
191
|
+
jobs_created == o.jobs_created &&
|
|
192
|
+
job_ids == o.job_ids &&
|
|
193
|
+
project == o.project &&
|
|
194
|
+
details == o.details
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
# @see the `==` method
|
|
198
|
+
# @param [Object] Object to be compared
|
|
199
|
+
def eql?(o)
|
|
200
|
+
self == o
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
# Calculates hash code according to all attributes.
|
|
204
|
+
# @return [Integer] Hash code
|
|
205
|
+
def hash
|
|
206
|
+
[id, automation_id, state, triggered_by, created_at, jobs_created, job_ids, project, details].hash
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
# Builds the object from hash
|
|
210
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
211
|
+
# @return [Object] Returns the model itself
|
|
212
|
+
def self.build_from_hash(attributes)
|
|
213
|
+
new.build_from_hash(attributes)
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
# Builds the object from hash
|
|
217
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
218
|
+
# @return [Object] Returns the model itself
|
|
219
|
+
def build_from_hash(attributes)
|
|
220
|
+
return nil unless attributes.is_a?(Hash)
|
|
221
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
222
|
+
if type =~ /\AArray<(.*)>/i
|
|
223
|
+
# check to ensure the input is an array given that the attribute
|
|
224
|
+
# is documented as an array but the input is not
|
|
225
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
226
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
227
|
+
end
|
|
228
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
229
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
230
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
self
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
# Deserializes the data based on type
|
|
237
|
+
# @param string type Data type
|
|
238
|
+
# @param string value Value to be deserialized
|
|
239
|
+
# @return [Object] Deserialized data
|
|
240
|
+
def _deserialize(type, value)
|
|
241
|
+
case type.to_sym
|
|
242
|
+
when :DateTime
|
|
243
|
+
DateTime.parse(value)
|
|
244
|
+
when :Date
|
|
245
|
+
Date.parse(value)
|
|
246
|
+
when :Time
|
|
247
|
+
Time.parse(value)
|
|
248
|
+
when :String
|
|
249
|
+
value.to_s
|
|
250
|
+
when :Integer
|
|
251
|
+
value.to_i
|
|
252
|
+
when :Float
|
|
253
|
+
value.to_f
|
|
254
|
+
when :Boolean
|
|
255
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
256
|
+
true
|
|
257
|
+
else
|
|
258
|
+
false
|
|
259
|
+
end
|
|
260
|
+
when :Object
|
|
261
|
+
# generic object (usually a Hash), return directly
|
|
262
|
+
value
|
|
263
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
264
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
265
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
266
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
267
|
+
k_type = Regexp.last_match[:k_type]
|
|
268
|
+
v_type = Regexp.last_match[:v_type]
|
|
269
|
+
{}.tap do |hash|
|
|
270
|
+
value.each do |k, v|
|
|
271
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
272
|
+
end
|
|
273
|
+
end
|
|
274
|
+
else # model
|
|
275
|
+
Phrase.const_get(type).build_from_hash(value)
|
|
276
|
+
end
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
# Returns the string representation of the object
|
|
280
|
+
# @return [String] String presentation of the object
|
|
281
|
+
def to_s
|
|
282
|
+
to_hash.to_s
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
286
|
+
# @return [Hash] Returns the object in the form of hash
|
|
287
|
+
def to_body
|
|
288
|
+
to_hash
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
# Returns the object in the form of hash
|
|
292
|
+
# @return [Hash] Returns the object in the form of hash
|
|
293
|
+
def to_hash
|
|
294
|
+
hash = {}
|
|
295
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
296
|
+
value = self.send(attr)
|
|
297
|
+
if value.nil?
|
|
298
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
299
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
hash[param] = _to_hash(value)
|
|
303
|
+
end
|
|
304
|
+
hash
|
|
305
|
+
end
|
|
306
|
+
|
|
307
|
+
# Outputs non-array value in the form of hash
|
|
308
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
309
|
+
# @param [Object] value Any valid value
|
|
310
|
+
# @return [Hash] Returns the value in the form of hash
|
|
311
|
+
def _to_hash(value)
|
|
312
|
+
if value.is_a?(Array)
|
|
313
|
+
value.compact.map { |v| _to_hash(v) }
|
|
314
|
+
elsif value.is_a?(Hash)
|
|
315
|
+
{}.tap do |hash|
|
|
316
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
317
|
+
end
|
|
318
|
+
elsif value.respond_to? :to_hash
|
|
319
|
+
value.to_hash
|
|
320
|
+
else
|
|
321
|
+
value
|
|
322
|
+
end
|
|
323
|
+
end
|
|
324
|
+
end
|
|
325
|
+
end
|
|
@@ -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.
|
|
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.
|
|
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
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
require 'date'
|
|
2
2
|
|
|
3
3
|
module Phrase
|
|
4
|
-
class
|
|
5
|
-
|
|
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
|
-
:'
|
|
11
|
+
:'error' => :'error'
|
|
11
12
|
}
|
|
12
13
|
end
|
|
13
14
|
|
|
14
15
|
# Attribute type mapping.
|
|
15
16
|
def self.openapi_types
|
|
16
17
|
{
|
|
17
|
-
:'
|
|
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::
|
|
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::
|
|
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?(:'
|
|
43
|
-
self.
|
|
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
|
-
|
|
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
|
-
[
|
|
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
|
|
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
|
-
#
|
|
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
|
-
#
|
|
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
|
-
#
|
|
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
|
-
#
|
|
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.
|