phrase 4.9.0 → 4.11.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 +15 -0
- data/README.md +15 -3
- data/docs/Automation.md +41 -0
- data/docs/AutomationsApi.md +455 -0
- data/docs/AutomationsCreateParameters.md +31 -0
- data/docs/AutomationsCreateParameters1.md +31 -0
- data/docs/BranchMergeParameters.md +1 -1
- data/docs/BranchSyncParameters.md +17 -0
- data/docs/BranchesApi.md +66 -1
- data/docs/KeyCreateParameters.md +1 -1
- data/docs/KeyUpdateParameters.md +1 -1
- data/docs/ProjectCreateParameters.md +1 -1
- data/docs/ProjectUpdateParameters.md +1 -1
- data/docs/ScreenshotUpdateParameters.md +1 -1
- data/docs/TranslationUpdateParameters.md +3 -1
- data/docs/UploadsApi.md +2 -2
- data/lib/phrase/api/automations_api.rb +518 -0
- data/lib/phrase/api/branches_api.rb +80 -2
- data/lib/phrase/api/uploads_api.rb +2 -2
- data/lib/phrase/models/automation.rb +355 -0
- data/lib/phrase/models/automations_create_parameters.rb +326 -0
- data/lib/phrase/models/automations_create_parameters1.rb +326 -0
- data/lib/phrase/models/branch_merge_parameters.rb +1 -1
- data/lib/phrase/models/branch_sync_parameters.rb +197 -0
- data/lib/phrase/models/translation_update_parameters.rb +14 -4
- data/lib/phrase/version.rb +1 -1
- data/lib/phrase.rb +5 -0
- data/spec/api/automations_api_spec.rb +121 -0
- data/spec/api/branches_api_spec.rb +16 -1
- data/spec/models/automation_spec.rb +113 -0
- data/spec/models/automations_create_parameters1_spec.rb +79 -0
- data/spec/models/automations_create_parameters_spec.rb +79 -0
- data/spec/models/branch_sync_parameters_spec.rb +29 -0
- data/spec/models/translation_update_parameters_spec.rb +6 -0
- metadata +251 -231
@@ -0,0 +1,326 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module Phrase
|
4
|
+
class AutomationsCreateParameters1
|
5
|
+
# name of the automation
|
6
|
+
attr_accessor :name
|
7
|
+
|
8
|
+
attr_accessor :trigger
|
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.
|
11
|
+
attr_accessor :project_ids
|
12
|
+
|
13
|
+
# id of job template that the automation uses to create jobs from
|
14
|
+
attr_accessor :job_template_id
|
15
|
+
|
16
|
+
# translation key statuses used to filter keys that are added to jobs
|
17
|
+
attr_accessor :status_filters
|
18
|
+
|
19
|
+
# used to filter which keys are added to jobs
|
20
|
+
attr_accessor :tags
|
21
|
+
|
22
|
+
# along with time_zone, specifies when the scheduled automation is supposed to run
|
23
|
+
attr_accessor :cron_schedule
|
24
|
+
|
25
|
+
# along with cron_schedule, specifies when the scheduled automation is supposed to run
|
26
|
+
attr_accessor :time_zone
|
27
|
+
|
28
|
+
class EnumAttributeValidator
|
29
|
+
attr_reader :datatype
|
30
|
+
attr_reader :allowable_values
|
31
|
+
|
32
|
+
def initialize(datatype, allowable_values)
|
33
|
+
@allowable_values = allowable_values.map do |value|
|
34
|
+
case datatype.to_s
|
35
|
+
when /Integer/i
|
36
|
+
value.to_i
|
37
|
+
when /Float/i
|
38
|
+
value.to_f
|
39
|
+
else
|
40
|
+
value
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def valid?(value)
|
46
|
+
!value || allowable_values.include?(value)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
51
|
+
def self.attribute_map
|
52
|
+
{
|
53
|
+
:'name' => :'name',
|
54
|
+
:'trigger' => :'trigger',
|
55
|
+
:'project_ids' => :'project_ids',
|
56
|
+
:'job_template_id' => :'job_template_id',
|
57
|
+
:'status_filters' => :'status_filters',
|
58
|
+
:'tags' => :'tags',
|
59
|
+
:'cron_schedule' => :'cron_schedule',
|
60
|
+
:'time_zone' => :'time_zone'
|
61
|
+
}
|
62
|
+
end
|
63
|
+
|
64
|
+
# Attribute type mapping.
|
65
|
+
def self.openapi_types
|
66
|
+
{
|
67
|
+
:'name' => :'String',
|
68
|
+
:'trigger' => :'String',
|
69
|
+
:'project_ids' => :'Array<String>',
|
70
|
+
:'job_template_id' => :'String',
|
71
|
+
:'status_filters' => :'Array<String>',
|
72
|
+
:'tags' => :'Array<String>',
|
73
|
+
:'cron_schedule' => :'String',
|
74
|
+
:'time_zone' => :'String'
|
75
|
+
}
|
76
|
+
end
|
77
|
+
|
78
|
+
# List of attributes with nullable: true
|
79
|
+
def self.openapi_nullable
|
80
|
+
Set.new([
|
81
|
+
])
|
82
|
+
end
|
83
|
+
|
84
|
+
# Initializes the object
|
85
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
86
|
+
def initialize(attributes = {})
|
87
|
+
if (!attributes.is_a?(Hash))
|
88
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::AutomationsCreateParameters1` initialize method"
|
89
|
+
end
|
90
|
+
|
91
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
92
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
93
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
94
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::AutomationsCreateParameters1`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
95
|
+
end
|
96
|
+
h[k.to_sym] = v
|
97
|
+
}
|
98
|
+
|
99
|
+
if attributes.key?(:'name')
|
100
|
+
self.name = attributes[:'name']
|
101
|
+
end
|
102
|
+
|
103
|
+
if attributes.key?(:'trigger')
|
104
|
+
self.trigger = attributes[:'trigger']
|
105
|
+
end
|
106
|
+
|
107
|
+
if attributes.key?(:'project_ids')
|
108
|
+
if (value = attributes[:'project_ids']).is_a?(Array)
|
109
|
+
self.project_ids = value
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
if attributes.key?(:'job_template_id')
|
114
|
+
self.job_template_id = attributes[:'job_template_id']
|
115
|
+
end
|
116
|
+
|
117
|
+
if attributes.key?(:'status_filters')
|
118
|
+
if (value = attributes[:'status_filters']).is_a?(Array)
|
119
|
+
self.status_filters = value
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
if attributes.key?(:'tags')
|
124
|
+
if (value = attributes[:'tags']).is_a?(Array)
|
125
|
+
self.tags = value
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
if attributes.key?(:'cron_schedule')
|
130
|
+
self.cron_schedule = attributes[:'cron_schedule']
|
131
|
+
end
|
132
|
+
|
133
|
+
if attributes.key?(:'time_zone')
|
134
|
+
self.time_zone = attributes[:'time_zone']
|
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
|
+
if @name.nil?
|
143
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
144
|
+
end
|
145
|
+
|
146
|
+
if @trigger.nil?
|
147
|
+
invalid_properties.push('invalid value for "trigger", trigger cannot be nil.')
|
148
|
+
end
|
149
|
+
|
150
|
+
if @project_ids.nil?
|
151
|
+
invalid_properties.push('invalid value for "project_ids", project_ids cannot be nil.')
|
152
|
+
end
|
153
|
+
|
154
|
+
if @status_filters.nil?
|
155
|
+
invalid_properties.push('invalid value for "status_filters", status_filters cannot be nil.')
|
156
|
+
end
|
157
|
+
|
158
|
+
invalid_properties
|
159
|
+
end
|
160
|
+
|
161
|
+
# Check to see if the all the properties in the model are valid
|
162
|
+
# @return true if the model is valid
|
163
|
+
def valid?
|
164
|
+
return false if @name.nil?
|
165
|
+
return false if @trigger.nil?
|
166
|
+
trigger_validator = EnumAttributeValidator.new('String', ["schedule", "upload"])
|
167
|
+
return false unless trigger_validator.valid?(@trigger)
|
168
|
+
return false if @project_ids.nil?
|
169
|
+
return false if @status_filters.nil?
|
170
|
+
true
|
171
|
+
end
|
172
|
+
|
173
|
+
# Custom attribute writer method checking allowed values (enum).
|
174
|
+
# @param [Object] trigger Object to be assigned
|
175
|
+
def trigger=(trigger)
|
176
|
+
validator = EnumAttributeValidator.new('String', ["schedule", "upload"])
|
177
|
+
unless validator.valid?(trigger)
|
178
|
+
fail ArgumentError, "invalid value for \"trigger\", must be one of #{validator.allowable_values}."
|
179
|
+
end
|
180
|
+
@trigger = trigger
|
181
|
+
end
|
182
|
+
|
183
|
+
# Checks equality by comparing each attribute.
|
184
|
+
# @param [Object] Object to be compared
|
185
|
+
def ==(o)
|
186
|
+
return true if self.equal?(o)
|
187
|
+
self.class == o.class &&
|
188
|
+
name == o.name &&
|
189
|
+
trigger == o.trigger &&
|
190
|
+
project_ids == o.project_ids &&
|
191
|
+
job_template_id == o.job_template_id &&
|
192
|
+
status_filters == o.status_filters &&
|
193
|
+
tags == o.tags &&
|
194
|
+
cron_schedule == o.cron_schedule &&
|
195
|
+
time_zone == o.time_zone
|
196
|
+
end
|
197
|
+
|
198
|
+
# @see the `==` method
|
199
|
+
# @param [Object] Object to be compared
|
200
|
+
def eql?(o)
|
201
|
+
self == o
|
202
|
+
end
|
203
|
+
|
204
|
+
# Calculates hash code according to all attributes.
|
205
|
+
# @return [Integer] Hash code
|
206
|
+
def hash
|
207
|
+
[name, trigger, project_ids, job_template_id, status_filters, tags, cron_schedule, time_zone].hash
|
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 self.build_from_hash(attributes)
|
214
|
+
new.build_from_hash(attributes)
|
215
|
+
end
|
216
|
+
|
217
|
+
# Builds the object from hash
|
218
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
219
|
+
# @return [Object] Returns the model itself
|
220
|
+
def build_from_hash(attributes)
|
221
|
+
return nil unless attributes.is_a?(Hash)
|
222
|
+
self.class.openapi_types.each_pair do |key, type|
|
223
|
+
if type =~ /\AArray<(.*)>/i
|
224
|
+
# check to ensure the input is an array given that the attribute
|
225
|
+
# is documented as an array but the input is not
|
226
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
227
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
228
|
+
end
|
229
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
230
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
231
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
232
|
+
end
|
233
|
+
|
234
|
+
self
|
235
|
+
end
|
236
|
+
|
237
|
+
# Deserializes the data based on type
|
238
|
+
# @param string type Data type
|
239
|
+
# @param string value Value to be deserialized
|
240
|
+
# @return [Object] Deserialized data
|
241
|
+
def _deserialize(type, value)
|
242
|
+
case type.to_sym
|
243
|
+
when :DateTime
|
244
|
+
DateTime.parse(value)
|
245
|
+
when :Date
|
246
|
+
Date.parse(value)
|
247
|
+
when :Time
|
248
|
+
Time.parse(value)
|
249
|
+
when :String
|
250
|
+
value.to_s
|
251
|
+
when :Integer
|
252
|
+
value.to_i
|
253
|
+
when :Float
|
254
|
+
value.to_f
|
255
|
+
when :Boolean
|
256
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
257
|
+
true
|
258
|
+
else
|
259
|
+
false
|
260
|
+
end
|
261
|
+
when :Object
|
262
|
+
# generic object (usually a Hash), return directly
|
263
|
+
value
|
264
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
265
|
+
inner_type = Regexp.last_match[:inner_type]
|
266
|
+
value.map { |v| _deserialize(inner_type, v) }
|
267
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
268
|
+
k_type = Regexp.last_match[:k_type]
|
269
|
+
v_type = Regexp.last_match[:v_type]
|
270
|
+
{}.tap do |hash|
|
271
|
+
value.each do |k, v|
|
272
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
273
|
+
end
|
274
|
+
end
|
275
|
+
else # model
|
276
|
+
Phrase.const_get(type).build_from_hash(value)
|
277
|
+
end
|
278
|
+
end
|
279
|
+
|
280
|
+
# Returns the string representation of the object
|
281
|
+
# @return [String] String presentation of the object
|
282
|
+
def to_s
|
283
|
+
to_hash.to_s
|
284
|
+
end
|
285
|
+
|
286
|
+
# to_body is an alias to to_hash (backward compatibility)
|
287
|
+
# @return [Hash] Returns the object in the form of hash
|
288
|
+
def to_body
|
289
|
+
to_hash
|
290
|
+
end
|
291
|
+
|
292
|
+
# Returns the object in the form of hash
|
293
|
+
# @return [Hash] Returns the object in the form of hash
|
294
|
+
def to_hash
|
295
|
+
hash = {}
|
296
|
+
self.class.attribute_map.each_pair do |attr, param|
|
297
|
+
value = self.send(attr)
|
298
|
+
if value.nil?
|
299
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
300
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
301
|
+
end
|
302
|
+
|
303
|
+
hash[param] = _to_hash(value)
|
304
|
+
end
|
305
|
+
hash
|
306
|
+
end
|
307
|
+
|
308
|
+
# Outputs non-array value in the form of hash
|
309
|
+
# For object, use to_hash. Otherwise, just return the value
|
310
|
+
# @param [Object] value Any valid value
|
311
|
+
# @return [Hash] Returns the value in the form of hash
|
312
|
+
def _to_hash(value)
|
313
|
+
if value.is_a?(Array)
|
314
|
+
value.compact.map { |v| _to_hash(v) }
|
315
|
+
elsif value.is_a?(Hash)
|
316
|
+
{}.tap do |hash|
|
317
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
318
|
+
end
|
319
|
+
elsif value.respond_to? :to_hash
|
320
|
+
value.to_hash
|
321
|
+
else
|
322
|
+
value
|
323
|
+
end
|
324
|
+
end
|
325
|
+
end
|
326
|
+
end
|
@@ -2,7 +2,7 @@ require 'date'
|
|
2
2
|
|
3
3
|
module Phrase
|
4
4
|
class BranchMergeParameters
|
5
|
-
# strategy used for merge
|
5
|
+
# strategy used for merge conflicts, use_main or use_branch
|
6
6
|
attr_accessor :strategy
|
7
7
|
|
8
8
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -0,0 +1,197 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module Phrase
|
4
|
+
class BranchSyncParameters
|
5
|
+
# strategy used for conflicts, use_main or use_branch
|
6
|
+
attr_accessor :strategy
|
7
|
+
|
8
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
9
|
+
def self.attribute_map
|
10
|
+
{
|
11
|
+
:'strategy' => :'strategy'
|
12
|
+
}
|
13
|
+
end
|
14
|
+
|
15
|
+
# Attribute type mapping.
|
16
|
+
def self.openapi_types
|
17
|
+
{
|
18
|
+
:'strategy' => :'String'
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
# List of attributes with nullable: true
|
23
|
+
def self.openapi_nullable
|
24
|
+
Set.new([
|
25
|
+
])
|
26
|
+
end
|
27
|
+
|
28
|
+
# Initializes the object
|
29
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
30
|
+
def initialize(attributes = {})
|
31
|
+
if (!attributes.is_a?(Hash))
|
32
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::BranchSyncParameters` initialize method"
|
33
|
+
end
|
34
|
+
|
35
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
36
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
37
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
38
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::BranchSyncParameters`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
39
|
+
end
|
40
|
+
h[k.to_sym] = v
|
41
|
+
}
|
42
|
+
|
43
|
+
if attributes.key?(:'strategy')
|
44
|
+
self.strategy = attributes[:'strategy']
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
49
|
+
# @return Array for valid properties with the reasons
|
50
|
+
def list_invalid_properties
|
51
|
+
invalid_properties = Array.new
|
52
|
+
invalid_properties
|
53
|
+
end
|
54
|
+
|
55
|
+
# Check to see if the all the properties in the model are valid
|
56
|
+
# @return true if the model is valid
|
57
|
+
def valid?
|
58
|
+
true
|
59
|
+
end
|
60
|
+
|
61
|
+
# Checks equality by comparing each attribute.
|
62
|
+
# @param [Object] Object to be compared
|
63
|
+
def ==(o)
|
64
|
+
return true if self.equal?(o)
|
65
|
+
self.class == o.class &&
|
66
|
+
strategy == o.strategy
|
67
|
+
end
|
68
|
+
|
69
|
+
# @see the `==` method
|
70
|
+
# @param [Object] Object to be compared
|
71
|
+
def eql?(o)
|
72
|
+
self == o
|
73
|
+
end
|
74
|
+
|
75
|
+
# Calculates hash code according to all attributes.
|
76
|
+
# @return [Integer] Hash code
|
77
|
+
def hash
|
78
|
+
[strategy].hash
|
79
|
+
end
|
80
|
+
|
81
|
+
# Builds the object from hash
|
82
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
83
|
+
# @return [Object] Returns the model itself
|
84
|
+
def self.build_from_hash(attributes)
|
85
|
+
new.build_from_hash(attributes)
|
86
|
+
end
|
87
|
+
|
88
|
+
# Builds the object from hash
|
89
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
90
|
+
# @return [Object] Returns the model itself
|
91
|
+
def build_from_hash(attributes)
|
92
|
+
return nil unless attributes.is_a?(Hash)
|
93
|
+
self.class.openapi_types.each_pair do |key, type|
|
94
|
+
if type =~ /\AArray<(.*)>/i
|
95
|
+
# check to ensure the input is an array given that the attribute
|
96
|
+
# is documented as an array but the input is not
|
97
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
98
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
99
|
+
end
|
100
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
101
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
102
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
103
|
+
end
|
104
|
+
|
105
|
+
self
|
106
|
+
end
|
107
|
+
|
108
|
+
# Deserializes the data based on type
|
109
|
+
# @param string type Data type
|
110
|
+
# @param string value Value to be deserialized
|
111
|
+
# @return [Object] Deserialized data
|
112
|
+
def _deserialize(type, value)
|
113
|
+
case type.to_sym
|
114
|
+
when :DateTime
|
115
|
+
DateTime.parse(value)
|
116
|
+
when :Date
|
117
|
+
Date.parse(value)
|
118
|
+
when :Time
|
119
|
+
Time.parse(value)
|
120
|
+
when :String
|
121
|
+
value.to_s
|
122
|
+
when :Integer
|
123
|
+
value.to_i
|
124
|
+
when :Float
|
125
|
+
value.to_f
|
126
|
+
when :Boolean
|
127
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
128
|
+
true
|
129
|
+
else
|
130
|
+
false
|
131
|
+
end
|
132
|
+
when :Object
|
133
|
+
# generic object (usually a Hash), return directly
|
134
|
+
value
|
135
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
136
|
+
inner_type = Regexp.last_match[:inner_type]
|
137
|
+
value.map { |v| _deserialize(inner_type, v) }
|
138
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
139
|
+
k_type = Regexp.last_match[:k_type]
|
140
|
+
v_type = Regexp.last_match[:v_type]
|
141
|
+
{}.tap do |hash|
|
142
|
+
value.each do |k, v|
|
143
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
else # model
|
147
|
+
Phrase.const_get(type).build_from_hash(value)
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
# Returns the string representation of the object
|
152
|
+
# @return [String] String presentation of the object
|
153
|
+
def to_s
|
154
|
+
to_hash.to_s
|
155
|
+
end
|
156
|
+
|
157
|
+
# to_body is an alias to to_hash (backward compatibility)
|
158
|
+
# @return [Hash] Returns the object in the form of hash
|
159
|
+
def to_body
|
160
|
+
to_hash
|
161
|
+
end
|
162
|
+
|
163
|
+
# Returns the object in the form of hash
|
164
|
+
# @return [Hash] Returns the object in the form of hash
|
165
|
+
def to_hash
|
166
|
+
hash = {}
|
167
|
+
self.class.attribute_map.each_pair do |attr, param|
|
168
|
+
value = self.send(attr)
|
169
|
+
if value.nil?
|
170
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
171
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
172
|
+
end
|
173
|
+
|
174
|
+
hash[param] = _to_hash(value)
|
175
|
+
end
|
176
|
+
hash
|
177
|
+
end
|
178
|
+
|
179
|
+
# Outputs non-array value in the form of hash
|
180
|
+
# For object, use to_hash. Otherwise, just return the value
|
181
|
+
# @param [Object] value Any valid value
|
182
|
+
# @return [Hash] Returns the value in the form of hash
|
183
|
+
def _to_hash(value)
|
184
|
+
if value.is_a?(Array)
|
185
|
+
value.compact.map { |v| _to_hash(v) }
|
186
|
+
elsif value.is_a?(Hash)
|
187
|
+
{}.tap do |hash|
|
188
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
189
|
+
end
|
190
|
+
elsif value.respond_to? :to_hash
|
191
|
+
value.to_hash
|
192
|
+
else
|
193
|
+
value
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
@@ -20,6 +20,9 @@ module Phrase
|
|
20
20
|
# Indicates whether the translation should be auto-translated. Responses with status 422 if provided for translation within a non-default locale or the project does not have the Autopilot feature enabled.
|
21
21
|
attr_accessor :autotranslate
|
22
22
|
|
23
|
+
# When set to `true`, the translation will be marked as reviewed.
|
24
|
+
attr_accessor :reviewed
|
25
|
+
|
23
26
|
# Attribute mapping from ruby-style variable name to JSON key.
|
24
27
|
def self.attribute_map
|
25
28
|
{
|
@@ -28,7 +31,8 @@ module Phrase
|
|
28
31
|
:'plural_suffix' => :'plural_suffix',
|
29
32
|
:'unverified' => :'unverified',
|
30
33
|
:'excluded' => :'excluded',
|
31
|
-
:'autotranslate' => :'autotranslate'
|
34
|
+
:'autotranslate' => :'autotranslate',
|
35
|
+
:'reviewed' => :'reviewed'
|
32
36
|
}
|
33
37
|
end
|
34
38
|
|
@@ -40,7 +44,8 @@ module Phrase
|
|
40
44
|
:'plural_suffix' => :'String',
|
41
45
|
:'unverified' => :'Boolean',
|
42
46
|
:'excluded' => :'Boolean',
|
43
|
-
:'autotranslate' => :'Boolean'
|
47
|
+
:'autotranslate' => :'Boolean',
|
48
|
+
:'reviewed' => :'Boolean'
|
44
49
|
}
|
45
50
|
end
|
46
51
|
|
@@ -88,6 +93,10 @@ module Phrase
|
|
88
93
|
if attributes.key?(:'autotranslate')
|
89
94
|
self.autotranslate = attributes[:'autotranslate']
|
90
95
|
end
|
96
|
+
|
97
|
+
if attributes.key?(:'reviewed')
|
98
|
+
self.reviewed = attributes[:'reviewed']
|
99
|
+
end
|
91
100
|
end
|
92
101
|
|
93
102
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -113,7 +122,8 @@ module Phrase
|
|
113
122
|
plural_suffix == o.plural_suffix &&
|
114
123
|
unverified == o.unverified &&
|
115
124
|
excluded == o.excluded &&
|
116
|
-
autotranslate == o.autotranslate
|
125
|
+
autotranslate == o.autotranslate &&
|
126
|
+
reviewed == o.reviewed
|
117
127
|
end
|
118
128
|
|
119
129
|
# @see the `==` method
|
@@ -125,7 +135,7 @@ module Phrase
|
|
125
135
|
# Calculates hash code according to all attributes.
|
126
136
|
# @return [Integer] Hash code
|
127
137
|
def hash
|
128
|
-
[branch, content, plural_suffix, unverified, excluded, autotranslate].hash
|
138
|
+
[branch, content, plural_suffix, unverified, excluded, autotranslate, reviewed].hash
|
129
139
|
end
|
130
140
|
|
131
141
|
# Builds the object from hash
|
data/lib/phrase/version.rb
CHANGED
data/lib/phrase.rb
CHANGED
@@ -17,6 +17,9 @@ require 'phrase/models/authorization'
|
|
17
17
|
require 'phrase/models/authorization_create_parameters'
|
18
18
|
require 'phrase/models/authorization_update_parameters'
|
19
19
|
require 'phrase/models/authorization_with_token'
|
20
|
+
require 'phrase/models/automation'
|
21
|
+
require 'phrase/models/automations_create_parameters'
|
22
|
+
require 'phrase/models/automations_create_parameters1'
|
20
23
|
require 'phrase/models/blacklisted_key'
|
21
24
|
require 'phrase/models/blacklisted_key_create_parameters'
|
22
25
|
require 'phrase/models/blacklisted_key_update_parameters'
|
@@ -24,6 +27,7 @@ require 'phrase/models/branch'
|
|
24
27
|
require 'phrase/models/branch_create_parameters'
|
25
28
|
require 'phrase/models/branch_merge_parameters'
|
26
29
|
require 'phrase/models/branch_name'
|
30
|
+
require 'phrase/models/branch_sync_parameters'
|
27
31
|
require 'phrase/models/branch_update_parameters'
|
28
32
|
require 'phrase/models/comment'
|
29
33
|
require 'phrase/models/comment_create_parameters'
|
@@ -227,6 +231,7 @@ require 'phrase/models/webhook_update_parameters'
|
|
227
231
|
# APIs
|
228
232
|
require 'phrase/api/accounts_api'
|
229
233
|
require 'phrase/api/authorizations_api'
|
234
|
+
require 'phrase/api/automations_api'
|
230
235
|
require 'phrase/api/blacklisted_keys_api'
|
231
236
|
require 'phrase/api/branches_api'
|
232
237
|
require 'phrase/api/comment_reactions_api'
|