phrase 4.16.0 → 4.17.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 +146 -123
- data/README.md +8 -3
- data/docs/KeyCreateParameters.md +1 -1
- data/docs/KeyUpdateParameters.md +1 -1
- data/docs/LocaleDownloadCreateParameters.md +2 -2
- data/docs/LocalePreview1.md +1 -3
- data/docs/ProjectCreateParameters.md +1 -1
- data/docs/ProjectUpdateParameters.md +1 -1
- data/docs/RepoSyncExportParameters.md +17 -0
- data/docs/RepoSyncImportParameters.md +17 -0
- data/docs/RepoSyncsApi.md +10 -4
- data/docs/ScreenshotUpdateParameters.md +1 -1
- data/docs/Translation.md +3 -1
- data/docs/TranslationDetails.md +3 -3
- data/docs/UploadBatch.md +29 -0
- data/docs/UploadBatchesApi.md +72 -0
- data/docs/UploadBatchesCreateParameters.md +21 -0
- data/docs/VersionsHistoryApi.md +5 -3
- data/lib/phrase/api/repo_syncs_api.rb +13 -2
- data/lib/phrase/api/upload_batches_api.rb +84 -0
- data/lib/phrase/api/versions_history_api.rb +6 -3
- data/lib/phrase/configuration.rb +5 -1
- data/lib/phrase/models/locale_download_create_parameters.rb +1 -1
- data/lib/phrase/models/locale_preview1.rb +4 -13
- data/lib/phrase/models/repo_sync_export_parameters.rb +197 -0
- data/lib/phrase/models/repo_sync_import_parameters.rb +197 -0
- data/lib/phrase/models/translation.rb +13 -4
- data/lib/phrase/models/translation_details.rb +13 -13
- data/lib/phrase/models/upload_batch.rb +288 -0
- data/lib/phrase/models/upload_batches_create_parameters.rb +224 -0
- data/lib/phrase/version.rb +1 -1
- data/lib/phrase.rb +5 -0
- data/spec/api/repo_syncs_api_spec.rb +3 -0
- data/spec/api/upload_batches_api_spec.rb +37 -0
- data/spec/api/versions_history_api_spec.rb +2 -1
- data/spec/models/locale_preview1_spec.rb +0 -6
- data/spec/models/repo_sync_export_parameters_spec.rb +29 -0
- data/spec/models/repo_sync_import_parameters_spec.rb +29 -0
- data/spec/models/translation_details_spec.rb +3 -3
- data/spec/models/translation_spec.rb +6 -0
- data/spec/models/upload_batch_spec.rb +69 -0
- data/spec/models/upload_batches_create_parameters_spec.rb +41 -0
- metadata +258 -238
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
require 'date'
|
|
2
|
+
|
|
3
|
+
module Phrase
|
|
4
|
+
class UploadBatch
|
|
5
|
+
# Processing state of the upload batch
|
|
6
|
+
attr_accessor :state
|
|
7
|
+
|
|
8
|
+
# Indicates whether unmentioned keys will be deleted after processing all uploads in the batch
|
|
9
|
+
attr_accessor :delete_unmentioned_keys
|
|
10
|
+
|
|
11
|
+
attr_accessor :created_at
|
|
12
|
+
|
|
13
|
+
attr_accessor :updated_at
|
|
14
|
+
|
|
15
|
+
attr_accessor :project
|
|
16
|
+
|
|
17
|
+
attr_accessor :user
|
|
18
|
+
|
|
19
|
+
attr_accessor :uploads
|
|
20
|
+
|
|
21
|
+
class EnumAttributeValidator
|
|
22
|
+
attr_reader :datatype
|
|
23
|
+
attr_reader :allowable_values
|
|
24
|
+
|
|
25
|
+
def initialize(datatype, allowable_values)
|
|
26
|
+
@allowable_values = allowable_values.map do |value|
|
|
27
|
+
case datatype.to_s
|
|
28
|
+
when /Integer/i
|
|
29
|
+
value.to_i
|
|
30
|
+
when /Float/i
|
|
31
|
+
value.to_f
|
|
32
|
+
else
|
|
33
|
+
value
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def valid?(value)
|
|
39
|
+
!value || allowable_values.include?(value)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
44
|
+
def self.attribute_map
|
|
45
|
+
{
|
|
46
|
+
:'state' => :'state',
|
|
47
|
+
:'delete_unmentioned_keys' => :'delete_unmentioned_keys',
|
|
48
|
+
:'created_at' => :'created_at',
|
|
49
|
+
:'updated_at' => :'updated_at',
|
|
50
|
+
:'project' => :'project',
|
|
51
|
+
:'user' => :'user',
|
|
52
|
+
:'uploads' => :'uploads'
|
|
53
|
+
}
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Attribute type mapping.
|
|
57
|
+
def self.openapi_types
|
|
58
|
+
{
|
|
59
|
+
:'state' => :'String',
|
|
60
|
+
:'delete_unmentioned_keys' => :'Boolean',
|
|
61
|
+
:'created_at' => :'DateTime',
|
|
62
|
+
:'updated_at' => :'DateTime',
|
|
63
|
+
:'project' => :'ProjectShort',
|
|
64
|
+
:'user' => :'UserPreview',
|
|
65
|
+
:'uploads' => :'Array<Upload>'
|
|
66
|
+
}
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# List of attributes with nullable: true
|
|
70
|
+
def self.openapi_nullable
|
|
71
|
+
Set.new([
|
|
72
|
+
])
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# Initializes the object
|
|
76
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
77
|
+
def initialize(attributes = {})
|
|
78
|
+
if (!attributes.is_a?(Hash))
|
|
79
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::UploadBatch` initialize method"
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
83
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
84
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
85
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::UploadBatch`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
86
|
+
end
|
|
87
|
+
h[k.to_sym] = v
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if attributes.key?(:'state')
|
|
91
|
+
self.state = attributes[:'state']
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
if attributes.key?(:'delete_unmentioned_keys')
|
|
95
|
+
self.delete_unmentioned_keys = attributes[:'delete_unmentioned_keys']
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
if attributes.key?(:'created_at')
|
|
99
|
+
self.created_at = attributes[:'created_at']
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
if attributes.key?(:'updated_at')
|
|
103
|
+
self.updated_at = attributes[:'updated_at']
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
if attributes.key?(:'project')
|
|
107
|
+
self.project = attributes[:'project']
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
if attributes.key?(:'user')
|
|
111
|
+
self.user = attributes[:'user']
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
if attributes.key?(:'uploads')
|
|
115
|
+
if (value = attributes[:'uploads']).is_a?(Array)
|
|
116
|
+
self.uploads = value
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
122
|
+
# @return Array for valid properties with the reasons
|
|
123
|
+
def list_invalid_properties
|
|
124
|
+
invalid_properties = Array.new
|
|
125
|
+
invalid_properties
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# Check to see if the all the properties in the model are valid
|
|
129
|
+
# @return true if the model is valid
|
|
130
|
+
def valid?
|
|
131
|
+
state_validator = EnumAttributeValidator.new('String', ["started", "done"])
|
|
132
|
+
return false unless state_validator.valid?(@state)
|
|
133
|
+
true
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
137
|
+
# @param [Object] state Object to be assigned
|
|
138
|
+
def state=(state)
|
|
139
|
+
validator = EnumAttributeValidator.new('String', ["started", "done"])
|
|
140
|
+
unless validator.valid?(state)
|
|
141
|
+
fail ArgumentError, "invalid value for \"state\", must be one of #{validator.allowable_values}."
|
|
142
|
+
end
|
|
143
|
+
@state = state
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# Checks equality by comparing each attribute.
|
|
147
|
+
# @param [Object] Object to be compared
|
|
148
|
+
def ==(o)
|
|
149
|
+
return true if self.equal?(o)
|
|
150
|
+
self.class == o.class &&
|
|
151
|
+
state == o.state &&
|
|
152
|
+
delete_unmentioned_keys == o.delete_unmentioned_keys &&
|
|
153
|
+
created_at == o.created_at &&
|
|
154
|
+
updated_at == o.updated_at &&
|
|
155
|
+
project == o.project &&
|
|
156
|
+
user == o.user &&
|
|
157
|
+
uploads == o.uploads
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
# @see the `==` method
|
|
161
|
+
# @param [Object] Object to be compared
|
|
162
|
+
def eql?(o)
|
|
163
|
+
self == o
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
# Calculates hash code according to all attributes.
|
|
167
|
+
# @return [Integer] Hash code
|
|
168
|
+
def hash
|
|
169
|
+
[state, delete_unmentioned_keys, created_at, updated_at, project, user, uploads].hash
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# Builds the object from hash
|
|
173
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
174
|
+
# @return [Object] Returns the model itself
|
|
175
|
+
def self.build_from_hash(attributes)
|
|
176
|
+
new.build_from_hash(attributes)
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
# Builds the object from hash
|
|
180
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
181
|
+
# @return [Object] Returns the model itself
|
|
182
|
+
def build_from_hash(attributes)
|
|
183
|
+
return nil unless attributes.is_a?(Hash)
|
|
184
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
185
|
+
if type =~ /\AArray<(.*)>/i
|
|
186
|
+
# check to ensure the input is an array given that the attribute
|
|
187
|
+
# is documented as an array but the input is not
|
|
188
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
189
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
190
|
+
end
|
|
191
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
192
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
193
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
self
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
# Deserializes the data based on type
|
|
200
|
+
# @param string type Data type
|
|
201
|
+
# @param string value Value to be deserialized
|
|
202
|
+
# @return [Object] Deserialized data
|
|
203
|
+
def _deserialize(type, value)
|
|
204
|
+
case type.to_sym
|
|
205
|
+
when :DateTime
|
|
206
|
+
DateTime.parse(value)
|
|
207
|
+
when :Date
|
|
208
|
+
Date.parse(value)
|
|
209
|
+
when :Time
|
|
210
|
+
Time.parse(value)
|
|
211
|
+
when :String
|
|
212
|
+
value.to_s
|
|
213
|
+
when :Integer
|
|
214
|
+
value.to_i
|
|
215
|
+
when :Float
|
|
216
|
+
value.to_f
|
|
217
|
+
when :Boolean
|
|
218
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
219
|
+
true
|
|
220
|
+
else
|
|
221
|
+
false
|
|
222
|
+
end
|
|
223
|
+
when :Object
|
|
224
|
+
# generic object (usually a Hash), return directly
|
|
225
|
+
value
|
|
226
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
227
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
228
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
229
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
230
|
+
k_type = Regexp.last_match[:k_type]
|
|
231
|
+
v_type = Regexp.last_match[:v_type]
|
|
232
|
+
{}.tap do |hash|
|
|
233
|
+
value.each do |k, v|
|
|
234
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
235
|
+
end
|
|
236
|
+
end
|
|
237
|
+
else # model
|
|
238
|
+
Phrase.const_get(type).build_from_hash(value)
|
|
239
|
+
end
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
# Returns the string representation of the object
|
|
243
|
+
# @return [String] String presentation of the object
|
|
244
|
+
def to_s
|
|
245
|
+
to_hash.to_s
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
249
|
+
# @return [Hash] Returns the object in the form of hash
|
|
250
|
+
def to_body
|
|
251
|
+
to_hash
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
# Returns the object in the form of hash
|
|
255
|
+
# @return [Hash] Returns the object in the form of hash
|
|
256
|
+
def to_hash
|
|
257
|
+
hash = {}
|
|
258
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
259
|
+
value = self.send(attr)
|
|
260
|
+
if value.nil?
|
|
261
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
262
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
hash[param] = _to_hash(value)
|
|
266
|
+
end
|
|
267
|
+
hash
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
# Outputs non-array value in the form of hash
|
|
271
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
272
|
+
# @param [Object] value Any valid value
|
|
273
|
+
# @return [Hash] Returns the value in the form of hash
|
|
274
|
+
def _to_hash(value)
|
|
275
|
+
if value.is_a?(Array)
|
|
276
|
+
value.compact.map { |v| _to_hash(v) }
|
|
277
|
+
elsif value.is_a?(Hash)
|
|
278
|
+
{}.tap do |hash|
|
|
279
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
280
|
+
end
|
|
281
|
+
elsif value.respond_to? :to_hash
|
|
282
|
+
value.to_hash
|
|
283
|
+
else
|
|
284
|
+
value
|
|
285
|
+
end
|
|
286
|
+
end
|
|
287
|
+
end
|
|
288
|
+
end
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
require 'date'
|
|
2
|
+
|
|
3
|
+
module Phrase
|
|
4
|
+
class UploadBatchesCreateParameters
|
|
5
|
+
# specify the branch to use
|
|
6
|
+
attr_accessor :branch
|
|
7
|
+
|
|
8
|
+
# If set to true, after all uploads in the batch are completed, translation keys that were not mentioned in any of the uploaded files will be deleted.
|
|
9
|
+
attr_accessor :delete_unmentioned_keys
|
|
10
|
+
|
|
11
|
+
# Array of upload IDs to include in the batch
|
|
12
|
+
attr_accessor :upload_ids
|
|
13
|
+
|
|
14
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
15
|
+
def self.attribute_map
|
|
16
|
+
{
|
|
17
|
+
:'branch' => :'branch',
|
|
18
|
+
:'delete_unmentioned_keys' => :'delete_unmentioned_keys',
|
|
19
|
+
:'upload_ids' => :'upload_ids'
|
|
20
|
+
}
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Attribute type mapping.
|
|
24
|
+
def self.openapi_types
|
|
25
|
+
{
|
|
26
|
+
:'branch' => :'String',
|
|
27
|
+
:'delete_unmentioned_keys' => :'Boolean',
|
|
28
|
+
:'upload_ids' => :'Array<String>'
|
|
29
|
+
}
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# List of attributes with nullable: true
|
|
33
|
+
def self.openapi_nullable
|
|
34
|
+
Set.new([
|
|
35
|
+
])
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Initializes the object
|
|
39
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
40
|
+
def initialize(attributes = {})
|
|
41
|
+
if (!attributes.is_a?(Hash))
|
|
42
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::UploadBatchesCreateParameters` initialize method"
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
46
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
47
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
48
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::UploadBatchesCreateParameters`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
49
|
+
end
|
|
50
|
+
h[k.to_sym] = v
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if attributes.key?(:'branch')
|
|
54
|
+
self.branch = attributes[:'branch']
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
if attributes.key?(:'delete_unmentioned_keys')
|
|
58
|
+
self.delete_unmentioned_keys = attributes[:'delete_unmentioned_keys']
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
if attributes.key?(:'upload_ids')
|
|
62
|
+
if (value = attributes[:'upload_ids']).is_a?(Array)
|
|
63
|
+
self.upload_ids = value
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
69
|
+
# @return Array for valid properties with the reasons
|
|
70
|
+
def list_invalid_properties
|
|
71
|
+
invalid_properties = Array.new
|
|
72
|
+
if @upload_ids.nil?
|
|
73
|
+
invalid_properties.push('invalid value for "upload_ids", upload_ids cannot be nil.')
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
invalid_properties
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Check to see if the all the properties in the model are valid
|
|
80
|
+
# @return true if the model is valid
|
|
81
|
+
def valid?
|
|
82
|
+
return false if @upload_ids.nil?
|
|
83
|
+
true
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Checks equality by comparing each attribute.
|
|
87
|
+
# @param [Object] Object to be compared
|
|
88
|
+
def ==(o)
|
|
89
|
+
return true if self.equal?(o)
|
|
90
|
+
self.class == o.class &&
|
|
91
|
+
branch == o.branch &&
|
|
92
|
+
delete_unmentioned_keys == o.delete_unmentioned_keys &&
|
|
93
|
+
upload_ids == o.upload_ids
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# @see the `==` method
|
|
97
|
+
# @param [Object] Object to be compared
|
|
98
|
+
def eql?(o)
|
|
99
|
+
self == o
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Calculates hash code according to all attributes.
|
|
103
|
+
# @return [Integer] Hash code
|
|
104
|
+
def hash
|
|
105
|
+
[branch, delete_unmentioned_keys, upload_ids].hash
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Builds the object from hash
|
|
109
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
110
|
+
# @return [Object] Returns the model itself
|
|
111
|
+
def self.build_from_hash(attributes)
|
|
112
|
+
new.build_from_hash(attributes)
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# Builds the object from hash
|
|
116
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
117
|
+
# @return [Object] Returns the model itself
|
|
118
|
+
def build_from_hash(attributes)
|
|
119
|
+
return nil unless attributes.is_a?(Hash)
|
|
120
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
121
|
+
if type =~ /\AArray<(.*)>/i
|
|
122
|
+
# check to ensure the input is an array given that the attribute
|
|
123
|
+
# is documented as an array but the input is not
|
|
124
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
125
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
126
|
+
end
|
|
127
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
128
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
129
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
self
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# Deserializes the data based on type
|
|
136
|
+
# @param string type Data type
|
|
137
|
+
# @param string value Value to be deserialized
|
|
138
|
+
# @return [Object] Deserialized data
|
|
139
|
+
def _deserialize(type, value)
|
|
140
|
+
case type.to_sym
|
|
141
|
+
when :DateTime
|
|
142
|
+
DateTime.parse(value)
|
|
143
|
+
when :Date
|
|
144
|
+
Date.parse(value)
|
|
145
|
+
when :Time
|
|
146
|
+
Time.parse(value)
|
|
147
|
+
when :String
|
|
148
|
+
value.to_s
|
|
149
|
+
when :Integer
|
|
150
|
+
value.to_i
|
|
151
|
+
when :Float
|
|
152
|
+
value.to_f
|
|
153
|
+
when :Boolean
|
|
154
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
155
|
+
true
|
|
156
|
+
else
|
|
157
|
+
false
|
|
158
|
+
end
|
|
159
|
+
when :Object
|
|
160
|
+
# generic object (usually a Hash), return directly
|
|
161
|
+
value
|
|
162
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
163
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
164
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
165
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
166
|
+
k_type = Regexp.last_match[:k_type]
|
|
167
|
+
v_type = Regexp.last_match[:v_type]
|
|
168
|
+
{}.tap do |hash|
|
|
169
|
+
value.each do |k, v|
|
|
170
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
else # model
|
|
174
|
+
Phrase.const_get(type).build_from_hash(value)
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
# Returns the string representation of the object
|
|
179
|
+
# @return [String] String presentation of the object
|
|
180
|
+
def to_s
|
|
181
|
+
to_hash.to_s
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
185
|
+
# @return [Hash] Returns the object in the form of hash
|
|
186
|
+
def to_body
|
|
187
|
+
to_hash
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
# Returns the object in the form of hash
|
|
191
|
+
# @return [Hash] Returns the object in the form of hash
|
|
192
|
+
def to_hash
|
|
193
|
+
hash = {}
|
|
194
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
195
|
+
value = self.send(attr)
|
|
196
|
+
if value.nil?
|
|
197
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
198
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
hash[param] = _to_hash(value)
|
|
202
|
+
end
|
|
203
|
+
hash
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
# Outputs non-array value in the form of hash
|
|
207
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
208
|
+
# @param [Object] value Any valid value
|
|
209
|
+
# @return [Hash] Returns the value in the form of hash
|
|
210
|
+
def _to_hash(value)
|
|
211
|
+
if value.is_a?(Array)
|
|
212
|
+
value.compact.map { |v| _to_hash(v) }
|
|
213
|
+
elsif value.is_a?(Hash)
|
|
214
|
+
{}.tap do |hash|
|
|
215
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
216
|
+
end
|
|
217
|
+
elsif value.respond_to? :to_hash
|
|
218
|
+
value.to_hash
|
|
219
|
+
else
|
|
220
|
+
value
|
|
221
|
+
end
|
|
222
|
+
end
|
|
223
|
+
end
|
|
224
|
+
end
|
data/lib/phrase/version.rb
CHANGED
data/lib/phrase.rb
CHANGED
|
@@ -164,6 +164,8 @@ require 'phrase/models/release_update_parameters'
|
|
|
164
164
|
require 'phrase/models/release_update_parameters1'
|
|
165
165
|
require 'phrase/models/repo_sync'
|
|
166
166
|
require 'phrase/models/repo_sync_event'
|
|
167
|
+
require 'phrase/models/repo_sync_export_parameters'
|
|
168
|
+
require 'phrase/models/repo_sync_import_parameters'
|
|
167
169
|
require 'phrase/models/screenshot'
|
|
168
170
|
require 'phrase/models/screenshot_marker'
|
|
169
171
|
require 'phrase/models/screenshot_marker_create_parameters'
|
|
@@ -218,6 +220,8 @@ require 'phrase/models/translations_unreview_parameters'
|
|
|
218
220
|
require 'phrase/models/translations_unverify_parameters'
|
|
219
221
|
require 'phrase/models/translations_verify_parameters'
|
|
220
222
|
require 'phrase/models/upload'
|
|
223
|
+
require 'phrase/models/upload_batch'
|
|
224
|
+
require 'phrase/models/upload_batches_create_parameters'
|
|
221
225
|
require 'phrase/models/upload_summary'
|
|
222
226
|
require 'phrase/models/user'
|
|
223
227
|
require 'phrase/models/user_preview'
|
|
@@ -280,6 +284,7 @@ require 'phrase/api/style_guides_api'
|
|
|
280
284
|
require 'phrase/api/tags_api'
|
|
281
285
|
require 'phrase/api/teams_api'
|
|
282
286
|
require 'phrase/api/translations_api'
|
|
287
|
+
require 'phrase/api/upload_batches_api'
|
|
283
288
|
require 'phrase/api/uploads_api'
|
|
284
289
|
require 'phrase/api/users_api'
|
|
285
290
|
require 'phrase/api/variables_api'
|
|
@@ -55,6 +55,7 @@ describe 'RepoSyncsApi' do
|
|
|
55
55
|
# @param id ID
|
|
56
56
|
# @param [Hash] opts the optional parameters
|
|
57
57
|
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
|
58
|
+
# @option opts [RepoSyncExportParameters] :repo_sync_export_parameters
|
|
58
59
|
# @return [RepoSyncEvent]
|
|
59
60
|
describe 'repo_sync_export test' do
|
|
60
61
|
it 'should work' do
|
|
@@ -69,6 +70,8 @@ describe 'RepoSyncsApi' do
|
|
|
69
70
|
# @param id ID
|
|
70
71
|
# @param [Hash] opts the optional parameters
|
|
71
72
|
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
|
73
|
+
# @option opts [String] :branch Branch to use
|
|
74
|
+
# @option opts [RepoSyncImportParameters] :repo_sync_import_parameters
|
|
72
75
|
# @return [RepoSyncEvent]
|
|
73
76
|
describe 'repo_sync_import test' do
|
|
74
77
|
it 'should work' do
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require 'json'
|
|
3
|
+
|
|
4
|
+
# Unit tests for Phrase::UploadBatchesApi
|
|
5
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
|
6
|
+
# Please update as you see appropriate
|
|
7
|
+
describe 'UploadBatchesApi' do
|
|
8
|
+
before do
|
|
9
|
+
# run before each test
|
|
10
|
+
@api_instance = Phrase::UploadBatchesApi.new
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
after do
|
|
14
|
+
# run after each test
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe 'test an instance of UploadBatchesApi' do
|
|
18
|
+
it 'should create an instance of UploadBatchesApi' do
|
|
19
|
+
expect(@api_instance).to be_instance_of(Phrase::UploadBatchesApi)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# unit tests for upload_batches_create
|
|
24
|
+
# Create upload batch
|
|
25
|
+
# Groups multiple file uploads into a single batch. Optionally, launches the deletion of unmentioned translation keys after all uploads in the batch are completed.
|
|
26
|
+
# @param project_id Project ID
|
|
27
|
+
# @param upload_batches_create_parameters
|
|
28
|
+
# @param [Hash] opts the optional parameters
|
|
29
|
+
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
|
30
|
+
# @return [UploadBatch]
|
|
31
|
+
describe 'upload_batches_create test' do
|
|
32
|
+
it 'should work' do
|
|
33
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
end
|
|
@@ -46,7 +46,8 @@ describe 'VersionsHistoryApi' do
|
|
|
46
46
|
# @option opts [Integer] :page Page number
|
|
47
47
|
# @option opts [Integer] :per_page Limit on the number of objects to be returned, between 1 and 100. 25 by default
|
|
48
48
|
# @option opts [String] :branch specify the branch to use
|
|
49
|
-
# @
|
|
49
|
+
# @option opts [Boolean] :only_content_updates Indicates whether only content updates should be returned
|
|
50
|
+
# @return [Array<TranslationVersionWithUser>]
|
|
50
51
|
describe 'versions_list test' do
|
|
51
52
|
it 'should work' do
|
|
52
53
|
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require 'json'
|
|
3
|
+
require 'date'
|
|
4
|
+
|
|
5
|
+
# Unit tests for Phrase::RepoSyncExportParameters
|
|
6
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
|
7
|
+
# Please update as you see appropriate
|
|
8
|
+
describe 'RepoSyncExportParameters' do
|
|
9
|
+
before do
|
|
10
|
+
# run before each test
|
|
11
|
+
@instance = Phrase::RepoSyncExportParameters.new
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
after do
|
|
15
|
+
# run after each test
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
describe 'test an instance of RepoSyncExportParameters' do
|
|
19
|
+
it 'should create an instance of RepoSyncExportParameters' do
|
|
20
|
+
expect(@instance).to be_instance_of(Phrase::RepoSyncExportParameters)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
describe 'test attribute "pr_branch"' do
|
|
24
|
+
it 'should work' do
|
|
25
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require 'json'
|
|
3
|
+
require 'date'
|
|
4
|
+
|
|
5
|
+
# Unit tests for Phrase::RepoSyncImportParameters
|
|
6
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
|
7
|
+
# Please update as you see appropriate
|
|
8
|
+
describe 'RepoSyncImportParameters' do
|
|
9
|
+
before do
|
|
10
|
+
# run before each test
|
|
11
|
+
@instance = Phrase::RepoSyncImportParameters.new
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
after do
|
|
15
|
+
# run after each test
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
describe 'test an instance of RepoSyncImportParameters' do
|
|
19
|
+
it 'should create an instance of RepoSyncImportParameters' do
|
|
20
|
+
expect(@instance).to be_instance_of(Phrase::RepoSyncImportParameters)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
describe 'test attribute "repository_branch"' do
|
|
24
|
+
it 'should work' do
|
|
25
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
end
|