phrase 2.20.0 → 2.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -0
  3. data/README.md +16 -5
  4. data/docs/CustomMetadataApi.md +353 -0
  5. data/docs/CustomMetadataDataType.md +16 -0
  6. data/docs/CustomMetadataProperty.md +33 -0
  7. data/docs/CustomMetadataPropertyCreate422Response.md +19 -0
  8. data/docs/{InvitationCreate422ResponseErrorsInner.md → CustomMetadataPropertyCreate422ResponseErrorsInner.md} +2 -2
  9. data/docs/KeyCreateParameters.md +4 -2
  10. data/docs/KeyUpdateParameters.md +4 -2
  11. data/docs/KeysApi.md +2 -2
  12. data/docs/KeysSearchParameters.md +1 -1
  13. data/docs/LocaleReport.md +43 -0
  14. data/docs/LocalesApi.md +3 -1
  15. data/docs/ProjectCreateParameters.md +1 -1
  16. data/docs/ProjectReport.md +31 -0
  17. data/docs/ProjectUpdateParameters.md +1 -1
  18. data/docs/ReportsApi.md +144 -0
  19. data/docs/ScreenshotUpdateParameters.md +1 -1
  20. data/docs/TranslationKeyDetails.md +3 -1
  21. data/docs/Upload.md +2 -0
  22. data/lib/phrase/api/custom_metadata_api.rb +409 -0
  23. data/lib/phrase/api/keys_api.rb +2 -2
  24. data/lib/phrase/api/locales_api.rb +3 -0
  25. data/lib/phrase/api/reports_api.rb +160 -0
  26. data/lib/phrase/models/custom_metadata_data_type.rb +30 -0
  27. data/lib/phrase/models/custom_metadata_property.rb +294 -0
  28. data/lib/phrase/models/{invitation_create422_response.rb → custom_metadata_property_create422_response.rb} +4 -4
  29. data/lib/phrase/models/{invitation_create422_response_errors_inner.rb → custom_metadata_property_create422_response_errors_inner.rb} +3 -3
  30. data/lib/phrase/models/key_create_parameters.rb +14 -4
  31. data/lib/phrase/models/key_update_parameters.rb +14 -4
  32. data/lib/phrase/models/keys_search_parameters.rb +1 -1
  33. data/lib/phrase/models/locale_report.rb +313 -0
  34. data/lib/phrase/models/project_report.rb +259 -0
  35. data/lib/phrase/models/translation_key_details.rb +15 -4
  36. data/lib/phrase/models/upload.rb +11 -1
  37. data/lib/phrase/version.rb +1 -1
  38. data/lib/phrase.rb +8 -2
  39. data/spec/api/custom_metadata_api_spec.rb +106 -0
  40. data/spec/api/keys_api_spec.rb +1 -1
  41. data/spec/api/reports_api_spec.rb +55 -0
  42. data/spec/models/custom_metadata_data_type_spec.rb +23 -0
  43. data/spec/models/{invitation_create422_response_errors_inner_spec.rb → custom_metadata_property_create422_response_errors_inner_spec.rb} +6 -6
  44. data/spec/models/{invitation_create422_response_spec.rb → custom_metadata_property_create422_response_spec.rb} +6 -6
  45. data/spec/models/custom_metadata_property_spec.rb +77 -0
  46. data/spec/models/key_create_parameters_spec.rb +6 -0
  47. data/spec/models/key_update_parameters_spec.rb +6 -0
  48. data/spec/models/locale_report_spec.rb +107 -0
  49. data/spec/models/project_report_spec.rb +71 -0
  50. data/spec/models/translation_key_details_spec.rb +6 -0
  51. data/spec/models/upload_spec.rb +6 -0
  52. metadata +236 -212
  53. data/docs/InvitationCreate422Response.md +0 -19
@@ -0,0 +1,313 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class LocaleReport
5
+ attr_accessor :keys_count
6
+
7
+ attr_accessor :translated_translations_percentage
8
+
9
+ attr_accessor :unverified_translations_percentage
10
+
11
+ attr_accessor :reviewed_translations_percentage
12
+
13
+ attr_accessor :untranslated_keys_percentage
14
+
15
+ attr_accessor :completed_translations_count
16
+
17
+ attr_accessor :untranslated_keys_count
18
+
19
+ attr_accessor :unverified_translations_count
20
+
21
+ attr_accessor :reviewed_translations_count
22
+
23
+ attr_accessor :source_word_count
24
+
25
+ attr_accessor :word_count
26
+
27
+ attr_accessor :word_count_unverified
28
+
29
+ attr_accessor :word_count_missing
30
+
31
+ attr_accessor :locale
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'keys_count' => :'keys_count',
37
+ :'translated_translations_percentage' => :'translated_translations_percentage',
38
+ :'unverified_translations_percentage' => :'unverified_translations_percentage',
39
+ :'reviewed_translations_percentage' => :'reviewed_translations_percentage',
40
+ :'untranslated_keys_percentage' => :'untranslated_keys_percentage',
41
+ :'completed_translations_count' => :'completed_translations_count',
42
+ :'untranslated_keys_count' => :'untranslated_keys_count',
43
+ :'unverified_translations_count' => :'unverified_translations_count',
44
+ :'reviewed_translations_count' => :'reviewed_translations_count',
45
+ :'source_word_count' => :'source_word_count',
46
+ :'word_count' => :'word_count',
47
+ :'word_count_unverified' => :'word_count_unverified',
48
+ :'word_count_missing' => :'word_count_missing',
49
+ :'locale' => :'locale'
50
+ }
51
+ end
52
+
53
+ # Attribute type mapping.
54
+ def self.openapi_types
55
+ {
56
+ :'keys_count' => :'Integer',
57
+ :'translated_translations_percentage' => :'Integer',
58
+ :'unverified_translations_percentage' => :'Integer',
59
+ :'reviewed_translations_percentage' => :'Integer',
60
+ :'untranslated_keys_percentage' => :'Integer',
61
+ :'completed_translations_count' => :'Integer',
62
+ :'untranslated_keys_count' => :'Integer',
63
+ :'unverified_translations_count' => :'Integer',
64
+ :'reviewed_translations_count' => :'Integer',
65
+ :'source_word_count' => :'Integer',
66
+ :'word_count' => :'Integer',
67
+ :'word_count_unverified' => :'Integer',
68
+ :'word_count_missing' => :'Integer',
69
+ :'locale' => :'LocalePreview'
70
+ }
71
+ end
72
+
73
+ # List of attributes with nullable: true
74
+ def self.openapi_nullable
75
+ Set.new([
76
+ ])
77
+ end
78
+
79
+ # Initializes the object
80
+ # @param [Hash] attributes Model attributes in the form of hash
81
+ def initialize(attributes = {})
82
+ if (!attributes.is_a?(Hash))
83
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::LocaleReport` initialize method"
84
+ end
85
+
86
+ # check to see if the attribute exists and convert string to symbol for hash key
87
+ attributes = attributes.each_with_object({}) { |(k, v), h|
88
+ if (!self.class.attribute_map.key?(k.to_sym))
89
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::LocaleReport`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
90
+ end
91
+ h[k.to_sym] = v
92
+ }
93
+
94
+ if attributes.key?(:'keys_count')
95
+ self.keys_count = attributes[:'keys_count']
96
+ end
97
+
98
+ if attributes.key?(:'translated_translations_percentage')
99
+ self.translated_translations_percentage = attributes[:'translated_translations_percentage']
100
+ end
101
+
102
+ if attributes.key?(:'unverified_translations_percentage')
103
+ self.unverified_translations_percentage = attributes[:'unverified_translations_percentage']
104
+ end
105
+
106
+ if attributes.key?(:'reviewed_translations_percentage')
107
+ self.reviewed_translations_percentage = attributes[:'reviewed_translations_percentage']
108
+ end
109
+
110
+ if attributes.key?(:'untranslated_keys_percentage')
111
+ self.untranslated_keys_percentage = attributes[:'untranslated_keys_percentage']
112
+ end
113
+
114
+ if attributes.key?(:'completed_translations_count')
115
+ self.completed_translations_count = attributes[:'completed_translations_count']
116
+ end
117
+
118
+ if attributes.key?(:'untranslated_keys_count')
119
+ self.untranslated_keys_count = attributes[:'untranslated_keys_count']
120
+ end
121
+
122
+ if attributes.key?(:'unverified_translations_count')
123
+ self.unverified_translations_count = attributes[:'unverified_translations_count']
124
+ end
125
+
126
+ if attributes.key?(:'reviewed_translations_count')
127
+ self.reviewed_translations_count = attributes[:'reviewed_translations_count']
128
+ end
129
+
130
+ if attributes.key?(:'source_word_count')
131
+ self.source_word_count = attributes[:'source_word_count']
132
+ end
133
+
134
+ if attributes.key?(:'word_count')
135
+ self.word_count = attributes[:'word_count']
136
+ end
137
+
138
+ if attributes.key?(:'word_count_unverified')
139
+ self.word_count_unverified = attributes[:'word_count_unverified']
140
+ end
141
+
142
+ if attributes.key?(:'word_count_missing')
143
+ self.word_count_missing = attributes[:'word_count_missing']
144
+ end
145
+
146
+ if attributes.key?(:'locale')
147
+ self.locale = attributes[:'locale']
148
+ end
149
+ end
150
+
151
+ # Show invalid properties with the reasons. Usually used together with valid?
152
+ # @return Array for valid properties with the reasons
153
+ def list_invalid_properties
154
+ invalid_properties = Array.new
155
+ invalid_properties
156
+ end
157
+
158
+ # Check to see if the all the properties in the model are valid
159
+ # @return true if the model is valid
160
+ def valid?
161
+ true
162
+ end
163
+
164
+ # Checks equality by comparing each attribute.
165
+ # @param [Object] Object to be compared
166
+ def ==(o)
167
+ return true if self.equal?(o)
168
+ self.class == o.class &&
169
+ keys_count == o.keys_count &&
170
+ translated_translations_percentage == o.translated_translations_percentage &&
171
+ unverified_translations_percentage == o.unverified_translations_percentage &&
172
+ reviewed_translations_percentage == o.reviewed_translations_percentage &&
173
+ untranslated_keys_percentage == o.untranslated_keys_percentage &&
174
+ completed_translations_count == o.completed_translations_count &&
175
+ untranslated_keys_count == o.untranslated_keys_count &&
176
+ unverified_translations_count == o.unverified_translations_count &&
177
+ reviewed_translations_count == o.reviewed_translations_count &&
178
+ source_word_count == o.source_word_count &&
179
+ word_count == o.word_count &&
180
+ word_count_unverified == o.word_count_unverified &&
181
+ word_count_missing == o.word_count_missing &&
182
+ locale == o.locale
183
+ end
184
+
185
+ # @see the `==` method
186
+ # @param [Object] Object to be compared
187
+ def eql?(o)
188
+ self == o
189
+ end
190
+
191
+ # Calculates hash code according to all attributes.
192
+ # @return [Integer] Hash code
193
+ def hash
194
+ [keys_count, translated_translations_percentage, unverified_translations_percentage, reviewed_translations_percentage, untranslated_keys_percentage, completed_translations_count, untranslated_keys_count, unverified_translations_count, reviewed_translations_count, source_word_count, word_count, word_count_unverified, word_count_missing, locale].hash
195
+ end
196
+
197
+ # Builds the object from hash
198
+ # @param [Hash] attributes Model attributes in the form of hash
199
+ # @return [Object] Returns the model itself
200
+ def self.build_from_hash(attributes)
201
+ new.build_from_hash(attributes)
202
+ end
203
+
204
+ # Builds the object from hash
205
+ # @param [Hash] attributes Model attributes in the form of hash
206
+ # @return [Object] Returns the model itself
207
+ def build_from_hash(attributes)
208
+ return nil unless attributes.is_a?(Hash)
209
+ self.class.openapi_types.each_pair do |key, type|
210
+ if type =~ /\AArray<(.*)>/i
211
+ # check to ensure the input is an array given that the attribute
212
+ # is documented as an array but the input is not
213
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
214
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
215
+ end
216
+ elsif !attributes[self.class.attribute_map[key]].nil?
217
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
218
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
219
+ end
220
+
221
+ self
222
+ end
223
+
224
+ # Deserializes the data based on type
225
+ # @param string type Data type
226
+ # @param string value Value to be deserialized
227
+ # @return [Object] Deserialized data
228
+ def _deserialize(type, value)
229
+ case type.to_sym
230
+ when :DateTime
231
+ DateTime.parse(value)
232
+ when :Date
233
+ Date.parse(value)
234
+ when :Time
235
+ Time.parse(value)
236
+ when :String
237
+ value.to_s
238
+ when :Integer
239
+ value.to_i
240
+ when :Float
241
+ value.to_f
242
+ when :Boolean
243
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
244
+ true
245
+ else
246
+ false
247
+ end
248
+ when :Object
249
+ # generic object (usually a Hash), return directly
250
+ value
251
+ when /\AArray<(?<inner_type>.+)>\z/
252
+ inner_type = Regexp.last_match[:inner_type]
253
+ value.map { |v| _deserialize(inner_type, v) }
254
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
255
+ k_type = Regexp.last_match[:k_type]
256
+ v_type = Regexp.last_match[:v_type]
257
+ {}.tap do |hash|
258
+ value.each do |k, v|
259
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
260
+ end
261
+ end
262
+ else # model
263
+ Phrase.const_get(type).build_from_hash(value)
264
+ end
265
+ end
266
+
267
+ # Returns the string representation of the object
268
+ # @return [String] String presentation of the object
269
+ def to_s
270
+ to_hash.to_s
271
+ end
272
+
273
+ # to_body is an alias to to_hash (backward compatibility)
274
+ # @return [Hash] Returns the object in the form of hash
275
+ def to_body
276
+ to_hash
277
+ end
278
+
279
+ # Returns the object in the form of hash
280
+ # @return [Hash] Returns the object in the form of hash
281
+ def to_hash
282
+ hash = {}
283
+ self.class.attribute_map.each_pair do |attr, param|
284
+ value = self.send(attr)
285
+ if value.nil?
286
+ is_nullable = self.class.openapi_nullable.include?(attr)
287
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
288
+ end
289
+
290
+ hash[param] = _to_hash(value)
291
+ end
292
+ hash
293
+ end
294
+
295
+ # Outputs non-array value in the form of hash
296
+ # For object, use to_hash. Otherwise, just return the value
297
+ # @param [Object] value Any valid value
298
+ # @return [Hash] Returns the value in the form of hash
299
+ def _to_hash(value)
300
+ if value.is_a?(Array)
301
+ value.compact.map { |v| _to_hash(v) }
302
+ elsif value.is_a?(Hash)
303
+ {}.tap do |hash|
304
+ value.each { |k, v| hash[k] = _to_hash(v) }
305
+ end
306
+ elsif value.respond_to? :to_hash
307
+ value.to_hash
308
+ else
309
+ value
310
+ end
311
+ end
312
+ end
313
+ end
@@ -0,0 +1,259 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class ProjectReport
5
+ attr_accessor :locales_count
6
+
7
+ attr_accessor :keys_count
8
+
9
+ attr_accessor :translations_count
10
+
11
+ attr_accessor :untranslated_keys_count
12
+
13
+ attr_accessor :unverified_translations_count
14
+
15
+ attr_accessor :reviewed_translations_count
16
+
17
+ attr_accessor :managed_words_count
18
+
19
+ attr_accessor :project
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'locales_count' => :'locales_count',
25
+ :'keys_count' => :'keys_count',
26
+ :'translations_count' => :'translations_count',
27
+ :'untranslated_keys_count' => :'untranslated_keys_count',
28
+ :'unverified_translations_count' => :'unverified_translations_count',
29
+ :'reviewed_translations_count' => :'reviewed_translations_count',
30
+ :'managed_words_count' => :'managed_words_count',
31
+ :'project' => :'project'
32
+ }
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'locales_count' => :'Integer',
39
+ :'keys_count' => :'Integer',
40
+ :'translations_count' => :'Integer',
41
+ :'untranslated_keys_count' => :'Integer',
42
+ :'unverified_translations_count' => :'Integer',
43
+ :'reviewed_translations_count' => :'Integer',
44
+ :'managed_words_count' => :'Integer',
45
+ :'project' => :'ProjectShort'
46
+ }
47
+ end
48
+
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ ])
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::ProjectReport` initialize method"
60
+ end
61
+
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!self.class.attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::ProjectReport`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'locales_count')
71
+ self.locales_count = attributes[:'locales_count']
72
+ end
73
+
74
+ if attributes.key?(:'keys_count')
75
+ self.keys_count = attributes[:'keys_count']
76
+ end
77
+
78
+ if attributes.key?(:'translations_count')
79
+ self.translations_count = attributes[:'translations_count']
80
+ end
81
+
82
+ if attributes.key?(:'untranslated_keys_count')
83
+ self.untranslated_keys_count = attributes[:'untranslated_keys_count']
84
+ end
85
+
86
+ if attributes.key?(:'unverified_translations_count')
87
+ self.unverified_translations_count = attributes[:'unverified_translations_count']
88
+ end
89
+
90
+ if attributes.key?(:'reviewed_translations_count')
91
+ self.reviewed_translations_count = attributes[:'reviewed_translations_count']
92
+ end
93
+
94
+ if attributes.key?(:'managed_words_count')
95
+ self.managed_words_count = attributes[:'managed_words_count']
96
+ end
97
+
98
+ if attributes.key?(:'project')
99
+ self.project = attributes[:'project']
100
+ end
101
+ end
102
+
103
+ # Show invalid properties with the reasons. Usually used together with valid?
104
+ # @return Array for valid properties with the reasons
105
+ def list_invalid_properties
106
+ invalid_properties = Array.new
107
+ invalid_properties
108
+ end
109
+
110
+ # Check to see if the all the properties in the model are valid
111
+ # @return true if the model is valid
112
+ def valid?
113
+ true
114
+ end
115
+
116
+ # Checks equality by comparing each attribute.
117
+ # @param [Object] Object to be compared
118
+ def ==(o)
119
+ return true if self.equal?(o)
120
+ self.class == o.class &&
121
+ locales_count == o.locales_count &&
122
+ keys_count == o.keys_count &&
123
+ translations_count == o.translations_count &&
124
+ untranslated_keys_count == o.untranslated_keys_count &&
125
+ unverified_translations_count == o.unverified_translations_count &&
126
+ reviewed_translations_count == o.reviewed_translations_count &&
127
+ managed_words_count == o.managed_words_count &&
128
+ project == o.project
129
+ end
130
+
131
+ # @see the `==` method
132
+ # @param [Object] Object to be compared
133
+ def eql?(o)
134
+ self == o
135
+ end
136
+
137
+ # Calculates hash code according to all attributes.
138
+ # @return [Integer] Hash code
139
+ def hash
140
+ [locales_count, keys_count, translations_count, untranslated_keys_count, unverified_translations_count, reviewed_translations_count, managed_words_count, project].hash
141
+ end
142
+
143
+ # Builds the object from hash
144
+ # @param [Hash] attributes Model attributes in the form of hash
145
+ # @return [Object] Returns the model itself
146
+ def self.build_from_hash(attributes)
147
+ new.build_from_hash(attributes)
148
+ end
149
+
150
+ # Builds the object from hash
151
+ # @param [Hash] attributes Model attributes in the form of hash
152
+ # @return [Object] Returns the model itself
153
+ def build_from_hash(attributes)
154
+ return nil unless attributes.is_a?(Hash)
155
+ self.class.openapi_types.each_pair do |key, type|
156
+ if type =~ /\AArray<(.*)>/i
157
+ # check to ensure the input is an array given that the attribute
158
+ # is documented as an array but the input is not
159
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
160
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
161
+ end
162
+ elsif !attributes[self.class.attribute_map[key]].nil?
163
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
164
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
165
+ end
166
+
167
+ self
168
+ end
169
+
170
+ # Deserializes the data based on type
171
+ # @param string type Data type
172
+ # @param string value Value to be deserialized
173
+ # @return [Object] Deserialized data
174
+ def _deserialize(type, value)
175
+ case type.to_sym
176
+ when :DateTime
177
+ DateTime.parse(value)
178
+ when :Date
179
+ Date.parse(value)
180
+ when :Time
181
+ Time.parse(value)
182
+ when :String
183
+ value.to_s
184
+ when :Integer
185
+ value.to_i
186
+ when :Float
187
+ value.to_f
188
+ when :Boolean
189
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
190
+ true
191
+ else
192
+ false
193
+ end
194
+ when :Object
195
+ # generic object (usually a Hash), return directly
196
+ value
197
+ when /\AArray<(?<inner_type>.+)>\z/
198
+ inner_type = Regexp.last_match[:inner_type]
199
+ value.map { |v| _deserialize(inner_type, v) }
200
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
201
+ k_type = Regexp.last_match[:k_type]
202
+ v_type = Regexp.last_match[:v_type]
203
+ {}.tap do |hash|
204
+ value.each do |k, v|
205
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
206
+ end
207
+ end
208
+ else # model
209
+ Phrase.const_get(type).build_from_hash(value)
210
+ end
211
+ end
212
+
213
+ # Returns the string representation of the object
214
+ # @return [String] String presentation of the object
215
+ def to_s
216
+ to_hash.to_s
217
+ end
218
+
219
+ # to_body is an alias to to_hash (backward compatibility)
220
+ # @return [Hash] Returns the object in the form of hash
221
+ def to_body
222
+ to_hash
223
+ end
224
+
225
+ # Returns the object in the form of hash
226
+ # @return [Hash] Returns the object in the form of hash
227
+ def to_hash
228
+ hash = {}
229
+ self.class.attribute_map.each_pair do |attr, param|
230
+ value = self.send(attr)
231
+ if value.nil?
232
+ is_nullable = self.class.openapi_nullable.include?(attr)
233
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
234
+ end
235
+
236
+ hash[param] = _to_hash(value)
237
+ end
238
+ hash
239
+ end
240
+
241
+ # Outputs non-array value in the form of hash
242
+ # For object, use to_hash. Otherwise, just return the value
243
+ # @param [Object] value Any valid value
244
+ # @return [Hash] Returns the value in the form of hash
245
+ def _to_hash(value)
246
+ if value.is_a?(Array)
247
+ value.compact.map { |v| _to_hash(v) }
248
+ elsif value.is_a?(Hash)
249
+ {}.tap do |hash|
250
+ value.each { |k, v| hash[k] = _to_hash(v) }
251
+ end
252
+ elsif value.respond_to? :to_hash
253
+ value.to_hash
254
+ else
255
+ value
256
+ end
257
+ end
258
+ end
259
+ end
@@ -38,6 +38,8 @@ module Phrase
38
38
 
39
39
  attr_accessor :creator
40
40
 
41
+ attr_accessor :custom_metadata
42
+
41
43
  # Attribute mapping from ruby-style variable name to JSON key.
42
44
  def self.attribute_map
43
45
  {
@@ -58,7 +60,8 @@ module Phrase
58
60
  :'xml_space_preserve' => :'xml_space_preserve',
59
61
  :'original_file' => :'original_file',
60
62
  :'format_value_type' => :'format_value_type',
61
- :'creator' => :'creator'
63
+ :'creator' => :'creator',
64
+ :'custom_metadata' => :'custom_metadata'
62
65
  }
63
66
  end
64
67
 
@@ -82,7 +85,8 @@ module Phrase
82
85
  :'xml_space_preserve' => :'Boolean',
83
86
  :'original_file' => :'String',
84
87
  :'format_value_type' => :'String',
85
- :'creator' => :'UserPreview'
88
+ :'creator' => :'UserPreview',
89
+ :'custom_metadata' => :'Hash<String, String>'
86
90
  }
87
91
  end
88
92
 
@@ -187,6 +191,12 @@ module Phrase
187
191
  if attributes.key?(:'creator')
188
192
  self.creator = attributes[:'creator']
189
193
  end
194
+
195
+ if attributes.key?(:'custom_metadata')
196
+ if (value = attributes[:'custom_metadata']).is_a?(Hash)
197
+ self.custom_metadata = value
198
+ end
199
+ end
190
200
  end
191
201
 
192
202
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -224,7 +234,8 @@ module Phrase
224
234
  xml_space_preserve == o.xml_space_preserve &&
225
235
  original_file == o.original_file &&
226
236
  format_value_type == o.format_value_type &&
227
- creator == o.creator
237
+ creator == o.creator &&
238
+ custom_metadata == o.custom_metadata
228
239
  end
229
240
 
230
241
  # @see the `==` method
@@ -236,7 +247,7 @@ module Phrase
236
247
  # Calculates hash code according to all attributes.
237
248
  # @return [Integer] Hash code
238
249
  def hash
239
- [id, name, description, name_hash, plural, tags, data_type, created_at, updated_at, name_plural, comments_count, max_characters_allowed, screenshot_url, unformatted, xml_space_preserve, original_file, format_value_type, creator].hash
250
+ [id, name, description, name_hash, plural, tags, data_type, created_at, updated_at, name_plural, comments_count, max_characters_allowed, screenshot_url, unformatted, xml_space_preserve, original_file, format_value_type, creator, custom_metadata].hash
240
251
  end
241
252
 
242
253
  # Builds the object from hash
@@ -12,6 +12,9 @@ module Phrase
12
12
 
13
13
  attr_accessor :tag
14
14
 
15
+ # The URL to the upload in Phrase Strings app.
16
+ attr_accessor :url
17
+
15
18
  attr_accessor :summary
16
19
 
17
20
  attr_accessor :created_at
@@ -26,6 +29,7 @@ module Phrase
26
29
  :'format' => :'format',
27
30
  :'state' => :'state',
28
31
  :'tag' => :'tag',
32
+ :'url' => :'url',
29
33
  :'summary' => :'summary',
30
34
  :'created_at' => :'created_at',
31
35
  :'updated_at' => :'updated_at'
@@ -40,6 +44,7 @@ module Phrase
40
44
  :'format' => :'String',
41
45
  :'state' => :'String',
42
46
  :'tag' => :'String',
47
+ :'url' => :'String',
43
48
  :'summary' => :'UploadSummary',
44
49
  :'created_at' => :'DateTime',
45
50
  :'updated_at' => :'DateTime'
@@ -87,6 +92,10 @@ module Phrase
87
92
  self.tag = attributes[:'tag']
88
93
  end
89
94
 
95
+ if attributes.key?(:'url')
96
+ self.url = attributes[:'url']
97
+ end
98
+
90
99
  if attributes.key?(:'summary')
91
100
  self.summary = attributes[:'summary']
92
101
  end
@@ -123,6 +132,7 @@ module Phrase
123
132
  format == o.format &&
124
133
  state == o.state &&
125
134
  tag == o.tag &&
135
+ url == o.url &&
126
136
  summary == o.summary &&
127
137
  created_at == o.created_at &&
128
138
  updated_at == o.updated_at
@@ -137,7 +147,7 @@ module Phrase
137
147
  # Calculates hash code according to all attributes.
138
148
  # @return [Integer] Hash code
139
149
  def hash
140
- [id, filename, format, state, tag, summary, created_at, updated_at].hash
150
+ [id, filename, format, state, tag, url, summary, created_at, updated_at].hash
141
151
  end
142
152
 
143
153
  # Builds the object from hash
@@ -1,3 +1,3 @@
1
1
  module Phrase
2
- VERSION = '2.20.0'
2
+ VERSION = '2.21.0'
3
3
  end