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.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +35 -0
  3. data/README.md +19 -4
  4. data/docs/AutomationEvent.md +33 -0
  5. data/docs/AutomationEventProject.md +19 -0
  6. data/docs/AutomationEventsApi.md +168 -0
  7. data/docs/AutomationsCreateParameters.md +1 -1
  8. data/docs/AutomationsCreateParameters1.md +1 -1
  9. data/docs/BranchComparison.md +23 -0
  10. data/docs/BranchComparisonChange.md +19 -0
  11. data/docs/BranchComparisonDiff.md +21 -0
  12. data/docs/BranchComparisonDiffConflictsValue.md +19 -0
  13. data/docs/BranchesApi.md +5 -4
  14. data/docs/DocumentsApi.md +4 -4
  15. data/docs/Format.md +20 -20
  16. data/docs/FormatsApi.md +1 -1
  17. data/docs/ICUApi.md +1 -1
  18. data/docs/IcuSkeletonError.md +17 -0
  19. data/docs/IcuSkeletonParameters.md +11 -11
  20. data/docs/Job.md +3 -1
  21. data/docs/JobDetails.md +2 -0
  22. data/docs/JobsApi.md +2 -2
  23. data/docs/KeyCreateParameters.md +1 -1
  24. data/docs/KeyFormatAnnotationsApi.md +74 -0
  25. data/docs/KeyFormatAnnotationsList200ResponseInner.md +19 -0
  26. data/docs/KeyLinksBatchDestroyParameters.md +6 -4
  27. data/docs/KeyLinksCreateParameters.md +2 -2
  28. data/docs/KeyUpdateParameters.md +1 -1
  29. data/docs/LinkedKeysApi.md +14 -13
  30. data/docs/Locale.md +2 -0
  31. data/docs/LocaleCreateParameters.md +3 -1
  32. data/docs/LocaleDetails.md +2 -0
  33. data/docs/LocaleDownloadCreateParameters.md +4 -0
  34. data/docs/LocaleUpdateParameters.md +3 -1
  35. data/docs/LocalesApi.md +2 -2
  36. data/docs/PreTranslation.md +29 -0
  37. data/docs/PreTranslationCreateParameters.md +19 -0
  38. data/docs/PreTranslationsApi.md +210 -0
  39. data/docs/ProjectCreateParameters.md +1 -1
  40. data/docs/ProjectUpdateParameters.md +1 -1
  41. data/docs/RepoSync.md +2 -0
  42. data/docs/RepoSyncCreateParameters.md +2 -0
  43. data/docs/ScreenshotUpdateParameters.md +1 -1
  44. data/docs/ScreenshotsApi.md +11 -11
  45. data/lib/phrase/api/automation_events_api.rb +215 -0
  46. data/lib/phrase/api/branches_api.rb +5 -3
  47. data/lib/phrase/api/documents_api.rb +6 -6
  48. data/lib/phrase/api/formats_api.rb +2 -2
  49. data/lib/phrase/api/icu_api.rb +2 -6
  50. data/lib/phrase/api/key_format_annotations_api.rb +85 -0
  51. data/lib/phrase/api/linked_keys_api.rb +19 -23
  52. data/lib/phrase/api/locales_api.rb +2 -2
  53. data/lib/phrase/api/pre_translations_api.rb +240 -0
  54. data/lib/phrase/api/screenshots_api.rb +20 -16
  55. data/lib/phrase/models/automation_event.rb +325 -0
  56. data/lib/phrase/models/automation_event_project.rb +208 -0
  57. data/lib/phrase/models/automations_create_parameters.rb +1 -1
  58. data/lib/phrase/models/automations_create_parameters1.rb +1 -1
  59. data/lib/phrase/models/branch_comparison.rb +224 -0
  60. data/lib/phrase/models/branch_comparison_change.rb +212 -0
  61. data/lib/phrase/models/branch_comparison_diff.rb +223 -0
  62. data/lib/phrase/models/branch_comparison_diff_conflicts_value.rb +209 -0
  63. data/lib/phrase/models/format.rb +60 -0
  64. data/lib/phrase/models/{key_links_index400_response.rb → icu_skeleton_error.rb} +11 -10
  65. data/lib/phrase/models/icu_skeleton_parameters.rb +6 -6
  66. data/lib/phrase/models/job.rb +16 -5
  67. data/lib/phrase/models/job_details.rb +12 -1
  68. data/lib/phrase/models/key_format_annotations_list200_response_inner.rb +207 -0
  69. data/lib/phrase/models/key_links_batch_destroy_parameters.rb +52 -6
  70. data/lib/phrase/models/key_links_create_parameters.rb +1 -1
  71. data/lib/phrase/models/locale.rb +10 -1
  72. data/lib/phrase/models/locale_create_parameters.rb +14 -4
  73. data/lib/phrase/models/locale_details.rb +10 -1
  74. data/lib/phrase/models/locale_download_create_parameters.rb +21 -1
  75. data/lib/phrase/models/locale_update_parameters.rb +14 -4
  76. data/lib/phrase/models/pre_translation.rb +301 -0
  77. data/lib/phrase/models/pre_translation_create_parameters.rb +241 -0
  78. data/lib/phrase/models/repo_sync.rb +29 -1
  79. data/lib/phrase/models/repo_sync_create_parameters.rb +27 -1
  80. data/lib/phrase/response.rb +2 -2
  81. data/lib/phrase/version.rb +1 -1
  82. data/lib/phrase.rb +13 -1
  83. data/phrase.gemspec +1 -1
  84. data/spec/api/automation_events_api_spec.rb +67 -0
  85. data/spec/api/branches_api_spec.rb +1 -1
  86. data/spec/api/documents_api_spec.rb +3 -3
  87. data/spec/api/formats_api_spec.rb +1 -1
  88. data/spec/api/icu_api_spec.rb +1 -1
  89. data/spec/api/key_format_annotations_api_spec.rb +38 -0
  90. data/spec/api/linked_keys_api_spec.rb +7 -7
  91. data/spec/api/pre_translations_api_spec.rb +70 -0
  92. data/spec/api/screenshots_api_spec.rb +6 -6
  93. data/spec/models/automation_event_project_spec.rb +35 -0
  94. data/spec/models/automation_event_spec.rb +85 -0
  95. data/spec/models/branch_comparison_change_spec.rb +35 -0
  96. data/spec/models/branch_comparison_diff_conflicts_value_spec.rb +35 -0
  97. data/spec/models/branch_comparison_diff_spec.rb +41 -0
  98. data/spec/models/branch_comparison_spec.rb +47 -0
  99. data/spec/models/{key_links_index400_response_spec.rb → icu_skeleton_error_spec.rb} +7 -7
  100. data/spec/models/job_details_spec.rb +6 -0
  101. data/spec/models/job_spec.rb +6 -0
  102. data/spec/models/key_format_annotations_list200_response_inner_spec.rb +35 -0
  103. data/spec/models/key_links_batch_destroy_parameters_spec.rb +10 -0
  104. data/spec/models/locale_create_parameters_spec.rb +6 -0
  105. data/spec/models/locale_details_spec.rb +6 -0
  106. data/spec/models/locale_download_create_parameters_spec.rb +12 -0
  107. data/spec/models/locale_spec.rb +6 -0
  108. data/spec/models/locale_update_parameters_spec.rb +6 -0
  109. data/spec/models/pre_translation_create_parameters_spec.rb +39 -0
  110. data/spec/models/pre_translation_spec.rb +73 -0
  111. data/spec/models/repo_sync_create_parameters_spec.rb +6 -0
  112. data/spec/models/repo_sync_spec.rb +6 -0
  113. data/spec/response_spec.rb +53 -0
  114. metadata +304 -254
  115. data/docs/KeyLinksIndex400Response.md +0 -17
@@ -0,0 +1,301 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class PreTranslation
5
+ attr_accessor :id
6
+
7
+ # Current execution state of the pre-translation job. Jobs start as `pending` while queued, transition to `running` while executing, and settle to `success` or `error`.
8
+ attr_accessor :status
9
+
10
+ # Resource type that was pre-translated.
11
+ attr_accessor :translatable_type
12
+
13
+ # ID of the targeted resource (locale ID, job ID, key ID, or upload ID).
14
+ attr_accessor :translatable_id
15
+
16
+ # Error message. `null` unless the job's status is `error`.
17
+ attr_accessor :error
18
+
19
+ attr_accessor :created_at
20
+
21
+ attr_accessor :updated_at
22
+
23
+ class EnumAttributeValidator
24
+ attr_reader :datatype
25
+ attr_reader :allowable_values
26
+
27
+ def initialize(datatype, allowable_values)
28
+ @allowable_values = allowable_values.map do |value|
29
+ case datatype.to_s
30
+ when /Integer/i
31
+ value.to_i
32
+ when /Float/i
33
+ value.to_f
34
+ else
35
+ value
36
+ end
37
+ end
38
+ end
39
+
40
+ def valid?(value)
41
+ !value || allowable_values.include?(value)
42
+ end
43
+ end
44
+
45
+ # Attribute mapping from ruby-style variable name to JSON key.
46
+ def self.attribute_map
47
+ {
48
+ :'id' => :'id',
49
+ :'status' => :'status',
50
+ :'translatable_type' => :'translatable_type',
51
+ :'translatable_id' => :'translatable_id',
52
+ :'error' => :'error',
53
+ :'created_at' => :'created_at',
54
+ :'updated_at' => :'updated_at'
55
+ }
56
+ end
57
+
58
+ # Attribute type mapping.
59
+ def self.openapi_types
60
+ {
61
+ :'id' => :'String',
62
+ :'status' => :'String',
63
+ :'translatable_type' => :'String',
64
+ :'translatable_id' => :'String',
65
+ :'error' => :'String',
66
+ :'created_at' => :'DateTime',
67
+ :'updated_at' => :'DateTime'
68
+ }
69
+ end
70
+
71
+ # List of attributes with nullable: true
72
+ def self.openapi_nullable
73
+ Set.new([
74
+ :'error',
75
+ ])
76
+ end
77
+
78
+ # Initializes the object
79
+ # @param [Hash] attributes Model attributes in the form of hash
80
+ def initialize(attributes = {})
81
+ if (!attributes.is_a?(Hash))
82
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::PreTranslation` initialize method"
83
+ end
84
+
85
+ # check to see if the attribute exists and convert string to symbol for hash key
86
+ attributes = attributes.each_with_object({}) { |(k, v), h|
87
+ if (!self.class.attribute_map.key?(k.to_sym))
88
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::PreTranslation`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
89
+ end
90
+ h[k.to_sym] = v
91
+ }
92
+
93
+ if attributes.key?(:'id')
94
+ self.id = attributes[:'id']
95
+ end
96
+
97
+ if attributes.key?(:'status')
98
+ self.status = attributes[:'status']
99
+ end
100
+
101
+ if attributes.key?(:'translatable_type')
102
+ self.translatable_type = attributes[:'translatable_type']
103
+ end
104
+
105
+ if attributes.key?(:'translatable_id')
106
+ self.translatable_id = attributes[:'translatable_id']
107
+ end
108
+
109
+ if attributes.key?(:'error')
110
+ self.error = attributes[:'error']
111
+ end
112
+
113
+ if attributes.key?(:'created_at')
114
+ self.created_at = attributes[:'created_at']
115
+ end
116
+
117
+ if attributes.key?(:'updated_at')
118
+ self.updated_at = attributes[:'updated_at']
119
+ end
120
+ end
121
+
122
+ # Show invalid properties with the reasons. Usually used together with valid?
123
+ # @return Array for valid properties with the reasons
124
+ def list_invalid_properties
125
+ invalid_properties = Array.new
126
+ invalid_properties
127
+ end
128
+
129
+ # Check to see if the all the properties in the model are valid
130
+ # @return true if the model is valid
131
+ def valid?
132
+ status_validator = EnumAttributeValidator.new('String', ["pending", "running", "success", "error"])
133
+ return false unless status_validator.valid?(@status)
134
+ translatable_type_validator = EnumAttributeValidator.new('String', ["locale", "job", "translation_key", "upload"])
135
+ return false unless translatable_type_validator.valid?(@translatable_type)
136
+ true
137
+ end
138
+
139
+ # Custom attribute writer method checking allowed values (enum).
140
+ # @param [Object] status Object to be assigned
141
+ def status=(status)
142
+ validator = EnumAttributeValidator.new('String', ["pending", "running", "success", "error"])
143
+ unless validator.valid?(status)
144
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
145
+ end
146
+ @status = status
147
+ end
148
+
149
+ # Custom attribute writer method checking allowed values (enum).
150
+ # @param [Object] translatable_type Object to be assigned
151
+ def translatable_type=(translatable_type)
152
+ validator = EnumAttributeValidator.new('String', ["locale", "job", "translation_key", "upload"])
153
+ unless validator.valid?(translatable_type)
154
+ fail ArgumentError, "invalid value for \"translatable_type\", must be one of #{validator.allowable_values}."
155
+ end
156
+ @translatable_type = translatable_type
157
+ end
158
+
159
+ # Checks equality by comparing each attribute.
160
+ # @param [Object] Object to be compared
161
+ def ==(o)
162
+ return true if self.equal?(o)
163
+ self.class == o.class &&
164
+ id == o.id &&
165
+ status == o.status &&
166
+ translatable_type == o.translatable_type &&
167
+ translatable_id == o.translatable_id &&
168
+ error == o.error &&
169
+ created_at == o.created_at &&
170
+ updated_at == o.updated_at
171
+ end
172
+
173
+ # @see the `==` method
174
+ # @param [Object] Object to be compared
175
+ def eql?(o)
176
+ self == o
177
+ end
178
+
179
+ # Calculates hash code according to all attributes.
180
+ # @return [Integer] Hash code
181
+ def hash
182
+ [id, status, translatable_type, translatable_id, error, created_at, updated_at].hash
183
+ end
184
+
185
+ # Builds the object from hash
186
+ # @param [Hash] attributes Model attributes in the form of hash
187
+ # @return [Object] Returns the model itself
188
+ def self.build_from_hash(attributes)
189
+ new.build_from_hash(attributes)
190
+ end
191
+
192
+ # Builds the object from hash
193
+ # @param [Hash] attributes Model attributes in the form of hash
194
+ # @return [Object] Returns the model itself
195
+ def build_from_hash(attributes)
196
+ return nil unless attributes.is_a?(Hash)
197
+ self.class.openapi_types.each_pair do |key, type|
198
+ if type =~ /\AArray<(.*)>/i
199
+ # check to ensure the input is an array given that the attribute
200
+ # is documented as an array but the input is not
201
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
202
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
203
+ end
204
+ elsif !attributes[self.class.attribute_map[key]].nil?
205
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
206
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
207
+ end
208
+
209
+ self
210
+ end
211
+
212
+ # Deserializes the data based on type
213
+ # @param string type Data type
214
+ # @param string value Value to be deserialized
215
+ # @return [Object] Deserialized data
216
+ def _deserialize(type, value)
217
+ case type.to_sym
218
+ when :DateTime
219
+ DateTime.parse(value)
220
+ when :Date
221
+ Date.parse(value)
222
+ when :Time
223
+ Time.parse(value)
224
+ when :String
225
+ value.to_s
226
+ when :Integer
227
+ value.to_i
228
+ when :Float
229
+ value.to_f
230
+ when :Boolean
231
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
232
+ true
233
+ else
234
+ false
235
+ end
236
+ when :Object
237
+ # generic object (usually a Hash), return directly
238
+ value
239
+ when /\AArray<(?<inner_type>.+)>\z/
240
+ inner_type = Regexp.last_match[:inner_type]
241
+ value.map { |v| _deserialize(inner_type, v) }
242
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
243
+ k_type = Regexp.last_match[:k_type]
244
+ v_type = Regexp.last_match[:v_type]
245
+ {}.tap do |hash|
246
+ value.each do |k, v|
247
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
248
+ end
249
+ end
250
+ else # model
251
+ Phrase.const_get(type).build_from_hash(value)
252
+ end
253
+ end
254
+
255
+ # Returns the string representation of the object
256
+ # @return [String] String presentation of the object
257
+ def to_s
258
+ to_hash.to_s
259
+ end
260
+
261
+ # to_body is an alias to to_hash (backward compatibility)
262
+ # @return [Hash] Returns the object in the form of hash
263
+ def to_body
264
+ to_hash
265
+ end
266
+
267
+ # Returns the object in the form of hash
268
+ # @return [Hash] Returns the object in the form of hash
269
+ def to_hash
270
+ hash = {}
271
+ self.class.attribute_map.each_pair do |attr, param|
272
+ value = self.send(attr)
273
+ if value.nil?
274
+ is_nullable = self.class.openapi_nullable.include?(attr)
275
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
276
+ end
277
+
278
+ hash[param] = _to_hash(value)
279
+ end
280
+ hash
281
+ end
282
+
283
+ # Outputs non-array value in the form of hash
284
+ # For object, use to_hash. Otherwise, just return the value
285
+ # @param [Object] value Any valid value
286
+ # @return [Hash] Returns the value in the form of hash
287
+ def _to_hash(value)
288
+ if value.is_a?(Array)
289
+ value.compact.map { |v| _to_hash(v) }
290
+ elsif value.is_a?(Hash)
291
+ {}.tap do |hash|
292
+ value.each { |k, v| hash[k] = _to_hash(v) }
293
+ end
294
+ elsif value.respond_to? :to_hash
295
+ value.to_hash
296
+ else
297
+ value
298
+ end
299
+ end
300
+ end
301
+ end
@@ -0,0 +1,241 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class PreTranslationCreateParameters
5
+ # Resource type to pre-translate.
6
+ attr_accessor :translatable_type
7
+
8
+ # ID of the targeted resource: locale ID for `locale`, job ID for `job`, key ID for `translation_key`, upload ID for `upload`.
9
+ attr_accessor :translatable_id
10
+
11
+ class EnumAttributeValidator
12
+ attr_reader :datatype
13
+ attr_reader :allowable_values
14
+
15
+ def initialize(datatype, allowable_values)
16
+ @allowable_values = allowable_values.map do |value|
17
+ case datatype.to_s
18
+ when /Integer/i
19
+ value.to_i
20
+ when /Float/i
21
+ value.to_f
22
+ else
23
+ value
24
+ end
25
+ end
26
+ end
27
+
28
+ def valid?(value)
29
+ !value || allowable_values.include?(value)
30
+ end
31
+ end
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'translatable_type' => :'translatable_type',
37
+ :'translatable_id' => :'translatable_id'
38
+ }
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'translatable_type' => :'String',
45
+ :'translatable_id' => :'String'
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::PreTranslationCreateParameters` 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::PreTranslationCreateParameters`. 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?(:'translatable_type')
71
+ self.translatable_type = attributes[:'translatable_type']
72
+ end
73
+
74
+ if attributes.key?(:'translatable_id')
75
+ self.translatable_id = attributes[:'translatable_id']
76
+ end
77
+ end
78
+
79
+ # Show invalid properties with the reasons. Usually used together with valid?
80
+ # @return Array for valid properties with the reasons
81
+ def list_invalid_properties
82
+ invalid_properties = Array.new
83
+ invalid_properties
84
+ end
85
+
86
+ # Check to see if the all the properties in the model are valid
87
+ # @return true if the model is valid
88
+ def valid?
89
+ translatable_type_validator = EnumAttributeValidator.new('String', ["locale", "job", "translation_key", "upload"])
90
+ return false unless translatable_type_validator.valid?(@translatable_type)
91
+ true
92
+ end
93
+
94
+ # Custom attribute writer method checking allowed values (enum).
95
+ # @param [Object] translatable_type Object to be assigned
96
+ def translatable_type=(translatable_type)
97
+ validator = EnumAttributeValidator.new('String', ["locale", "job", "translation_key", "upload"])
98
+ unless validator.valid?(translatable_type)
99
+ fail ArgumentError, "invalid value for \"translatable_type\", must be one of #{validator.allowable_values}."
100
+ end
101
+ @translatable_type = translatable_type
102
+ end
103
+
104
+ # Checks equality by comparing each attribute.
105
+ # @param [Object] Object to be compared
106
+ def ==(o)
107
+ return true if self.equal?(o)
108
+ self.class == o.class &&
109
+ translatable_type == o.translatable_type &&
110
+ translatable_id == o.translatable_id
111
+ end
112
+
113
+ # @see the `==` method
114
+ # @param [Object] Object to be compared
115
+ def eql?(o)
116
+ self == o
117
+ end
118
+
119
+ # Calculates hash code according to all attributes.
120
+ # @return [Integer] Hash code
121
+ def hash
122
+ [translatable_type, translatable_id].hash
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def self.build_from_hash(attributes)
129
+ new.build_from_hash(attributes)
130
+ end
131
+
132
+ # Builds the object from hash
133
+ # @param [Hash] attributes Model attributes in the form of hash
134
+ # @return [Object] Returns the model itself
135
+ def build_from_hash(attributes)
136
+ return nil unless attributes.is_a?(Hash)
137
+ self.class.openapi_types.each_pair do |key, type|
138
+ if type =~ /\AArray<(.*)>/i
139
+ # check to ensure the input is an array given that the attribute
140
+ # is documented as an array but the input is not
141
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
142
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
143
+ end
144
+ elsif !attributes[self.class.attribute_map[key]].nil?
145
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
146
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
147
+ end
148
+
149
+ self
150
+ end
151
+
152
+ # Deserializes the data based on type
153
+ # @param string type Data type
154
+ # @param string value Value to be deserialized
155
+ # @return [Object] Deserialized data
156
+ def _deserialize(type, value)
157
+ case type.to_sym
158
+ when :DateTime
159
+ DateTime.parse(value)
160
+ when :Date
161
+ Date.parse(value)
162
+ when :Time
163
+ Time.parse(value)
164
+ when :String
165
+ value.to_s
166
+ when :Integer
167
+ value.to_i
168
+ when :Float
169
+ value.to_f
170
+ when :Boolean
171
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
172
+ true
173
+ else
174
+ false
175
+ end
176
+ when :Object
177
+ # generic object (usually a Hash), return directly
178
+ value
179
+ when /\AArray<(?<inner_type>.+)>\z/
180
+ inner_type = Regexp.last_match[:inner_type]
181
+ value.map { |v| _deserialize(inner_type, v) }
182
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
183
+ k_type = Regexp.last_match[:k_type]
184
+ v_type = Regexp.last_match[:v_type]
185
+ {}.tap do |hash|
186
+ value.each do |k, v|
187
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
188
+ end
189
+ end
190
+ else # model
191
+ Phrase.const_get(type).build_from_hash(value)
192
+ end
193
+ end
194
+
195
+ # Returns the string representation of the object
196
+ # @return [String] String presentation of the object
197
+ def to_s
198
+ to_hash.to_s
199
+ end
200
+
201
+ # to_body is an alias to to_hash (backward compatibility)
202
+ # @return [Hash] Returns the object in the form of hash
203
+ def to_body
204
+ to_hash
205
+ end
206
+
207
+ # Returns the object in the form of hash
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_hash
210
+ hash = {}
211
+ self.class.attribute_map.each_pair do |attr, param|
212
+ value = self.send(attr)
213
+ if value.nil?
214
+ is_nullable = self.class.openapi_nullable.include?(attr)
215
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
216
+ end
217
+
218
+ hash[param] = _to_hash(value)
219
+ end
220
+ hash
221
+ end
222
+
223
+ # Outputs non-array value in the form of hash
224
+ # For object, use to_hash. Otherwise, just return the value
225
+ # @param [Object] value Any valid value
226
+ # @return [Hash] Returns the value in the form of hash
227
+ def _to_hash(value)
228
+ if value.is_a?(Array)
229
+ value.compact.map { |v| _to_hash(v) }
230
+ elsif value.is_a?(Hash)
231
+ {}.tap do |hash|
232
+ value.each { |k, v| hash[k] = _to_hash(v) }
233
+ end
234
+ elsif value.respond_to? :to_hash
235
+ value.to_hash
236
+ else
237
+ value
238
+ end
239
+ end
240
+ end
241
+ end
@@ -4,6 +4,9 @@ module Phrase
4
4
  class RepoSync
5
5
  attr_accessor :id
6
6
 
7
+ # Optional custom display name for this repo sync. When null or blank, the sync is displayed using the associated project name.
8
+ attr_accessor :name
9
+
7
10
  attr_accessor :project
8
11
 
9
12
  attr_accessor :provider
@@ -27,6 +30,7 @@ module Phrase
27
30
  def self.attribute_map
28
31
  {
29
32
  :'id' => :'id',
33
+ :'name' => :'name',
30
34
  :'project' => :'project',
31
35
  :'provider' => :'provider',
32
36
  :'enabled' => :'enabled',
@@ -43,6 +47,7 @@ module Phrase
43
47
  def self.openapi_types
44
48
  {
45
49
  :'id' => :'String',
50
+ :'name' => :'String',
46
51
  :'project' => :'ProjectShort',
47
52
  :'provider' => :'String',
48
53
  :'enabled' => :'Boolean',
@@ -58,7 +63,10 @@ module Phrase
58
63
  # List of attributes with nullable: true
59
64
  def self.openapi_nullable
60
65
  Set.new([
66
+ :'name',
61
67
  :'pr_branch',
68
+ :'last_import_at',
69
+ :'last_export_at'
62
70
  ])
63
71
  end
64
72
 
@@ -81,6 +89,10 @@ module Phrase
81
89
  self.id = attributes[:'id']
82
90
  end
83
91
 
92
+ if attributes.key?(:'name')
93
+ self.name = attributes[:'name']
94
+ end
95
+
84
96
  if attributes.key?(:'project')
85
97
  self.project = attributes[:'project']
86
98
  end
@@ -122,21 +134,37 @@ module Phrase
122
134
  # @return Array for valid properties with the reasons
123
135
  def list_invalid_properties
124
136
  invalid_properties = Array.new
137
+ if !@name.nil? && @name.to_s.length > 100
138
+ invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 100.')
139
+ end
140
+
125
141
  invalid_properties
126
142
  end
127
143
 
128
144
  # Check to see if the all the properties in the model are valid
129
145
  # @return true if the model is valid
130
146
  def valid?
147
+ return false if !@name.nil? && @name.to_s.length > 100
131
148
  true
132
149
  end
133
150
 
151
+ # Custom attribute writer method with validation
152
+ # @param [Object] name Value to be assigned
153
+ def name=(name)
154
+ if !name.nil? && name.to_s.length > 100
155
+ fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 100.'
156
+ end
157
+
158
+ @name = name
159
+ end
160
+
134
161
  # Checks equality by comparing each attribute.
135
162
  # @param [Object] Object to be compared
136
163
  def ==(o)
137
164
  return true if self.equal?(o)
138
165
  self.class == o.class &&
139
166
  id == o.id &&
167
+ name == o.name &&
140
168
  project == o.project &&
141
169
  provider == o.provider &&
142
170
  enabled == o.enabled &&
@@ -157,7 +185,7 @@ module Phrase
157
185
  # Calculates hash code according to all attributes.
158
186
  # @return [Integer] Hash code
159
187
  def hash
160
- [id, project, provider, enabled, auto_import, repo_name, pr_branch, created_at, last_import_at, last_export_at].hash
188
+ [id, name, project, provider, enabled, auto_import, repo_name, pr_branch, created_at, last_import_at, last_export_at].hash
161
189
  end
162
190
 
163
191
  # Builds the object from hash