phrase 4.24.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 +35 -0
- data/README.md +19 -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/BranchComparison.md +23 -0
- data/docs/BranchComparisonChange.md +19 -0
- data/docs/BranchComparisonDiff.md +21 -0
- data/docs/BranchComparisonDiffConflictsValue.md +19 -0
- data/docs/BranchesApi.md +5 -4
- data/docs/DocumentsApi.md +4 -4
- data/docs/Format.md +20 -20
- data/docs/FormatsApi.md +1 -1
- data/docs/ICUApi.md +1 -1
- data/docs/IcuSkeletonError.md +17 -0
- data/docs/IcuSkeletonParameters.md +11 -11
- data/docs/Job.md +3 -1
- data/docs/JobDetails.md +2 -0
- 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/Locale.md +2 -0
- data/docs/LocaleCreateParameters.md +3 -1
- data/docs/LocaleDetails.md +2 -0
- data/docs/LocaleDownloadCreateParameters.md +4 -0
- data/docs/LocaleUpdateParameters.md +3 -1
- data/docs/LocalesApi.md +2 -2
- 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/RepoSync.md +2 -0
- data/docs/RepoSyncCreateParameters.md +2 -0
- data/docs/ScreenshotUpdateParameters.md +1 -1
- data/docs/ScreenshotsApi.md +11 -11
- data/lib/phrase/api/automation_events_api.rb +215 -0
- data/lib/phrase/api/branches_api.rb +5 -3
- data/lib/phrase/api/documents_api.rb +6 -6
- data/lib/phrase/api/formats_api.rb +2 -2
- 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/locales_api.rb +2 -2
- data/lib/phrase/api/pre_translations_api.rb +240 -0
- data/lib/phrase/api/screenshots_api.rb +20 -16
- 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/branch_comparison.rb +224 -0
- data/lib/phrase/models/branch_comparison_change.rb +212 -0
- data/lib/phrase/models/branch_comparison_diff.rb +223 -0
- data/lib/phrase/models/branch_comparison_diff_conflicts_value.rb +209 -0
- data/lib/phrase/models/format.rb +60 -0
- 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/job.rb +16 -5
- data/lib/phrase/models/job_details.rb +12 -1
- 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/locale.rb +10 -1
- data/lib/phrase/models/locale_create_parameters.rb +14 -4
- data/lib/phrase/models/locale_details.rb +10 -1
- data/lib/phrase/models/locale_download_create_parameters.rb +21 -1
- data/lib/phrase/models/locale_update_parameters.rb +14 -4
- data/lib/phrase/models/pre_translation.rb +301 -0
- data/lib/phrase/models/pre_translation_create_parameters.rb +241 -0
- data/lib/phrase/models/repo_sync.rb +29 -1
- data/lib/phrase/models/repo_sync_create_parameters.rb +27 -1
- data/lib/phrase/response.rb +2 -2
- data/lib/phrase/version.rb +1 -1
- data/lib/phrase.rb +13 -1
- data/phrase.gemspec +1 -1
- data/spec/api/automation_events_api_spec.rb +67 -0
- data/spec/api/branches_api_spec.rb +1 -1
- data/spec/api/documents_api_spec.rb +3 -3
- data/spec/api/formats_api_spec.rb +1 -1
- 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 +6 -6
- data/spec/models/automation_event_project_spec.rb +35 -0
- data/spec/models/automation_event_spec.rb +85 -0
- data/spec/models/branch_comparison_change_spec.rb +35 -0
- data/spec/models/branch_comparison_diff_conflicts_value_spec.rb +35 -0
- data/spec/models/branch_comparison_diff_spec.rb +41 -0
- data/spec/models/branch_comparison_spec.rb +47 -0
- data/spec/models/{key_links_index400_response_spec.rb → icu_skeleton_error_spec.rb} +7 -7
- data/spec/models/job_details_spec.rb +6 -0
- data/spec/models/job_spec.rb +6 -0
- 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/locale_create_parameters_spec.rb +6 -0
- data/spec/models/locale_details_spec.rb +6 -0
- data/spec/models/locale_download_create_parameters_spec.rb +12 -0
- data/spec/models/locale_spec.rb +6 -0
- data/spec/models/locale_update_parameters_spec.rb +6 -0
- data/spec/models/pre_translation_create_parameters_spec.rb +39 -0
- data/spec/models/pre_translation_spec.rb +73 -0
- data/spec/models/repo_sync_create_parameters_spec.rb +6 -0
- data/spec/models/repo_sync_spec.rb +6 -0
- data/spec/response_spec.rb +53 -0
- metadata +304 -254
- 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
|