phrase 2.8.7 → 2.10.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 (38) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +19 -3
  3. data/docs/OrganizationJobTemplate.md +25 -0
  4. data/docs/OrganizationJobTemplateCreateParameters.md +19 -0
  5. data/docs/OrganizationJobTemplateDetails.md +31 -0
  6. data/docs/OrganizationJobTemplateLocaleUpdateParameters.md +27 -0
  7. data/docs/OrganizationJobTemplateLocalesApi.md +341 -0
  8. data/docs/OrganizationJobTemplateLocalesCreateParameters.md +27 -0
  9. data/docs/OrganizationJobTemplateUpdateParameters.md +19 -0
  10. data/docs/OrganizationJobTemplatesApi.md +331 -0
  11. data/docs/Release.md +2 -0
  12. data/docs/ReleaseCreateParameters.md +2 -0
  13. data/docs/ReleasePreview.md +2 -0
  14. data/lib/phrase/api/organization_job_template_locales_api.rb +408 -0
  15. data/lib/phrase/api/organization_job_templates_api.rb +378 -0
  16. data/lib/phrase/models/organization_job_template.rb +230 -0
  17. data/lib/phrase/models/organization_job_template_create_parameters.rb +210 -0
  18. data/lib/phrase/models/organization_job_template_details.rb +267 -0
  19. data/lib/phrase/models/organization_job_template_locale_update_parameters.rb +253 -0
  20. data/lib/phrase/models/organization_job_template_locales_create_parameters.rb +263 -0
  21. data/lib/phrase/models/organization_job_template_update_parameters.rb +210 -0
  22. data/lib/phrase/models/release.rb +12 -1
  23. data/lib/phrase/models/release_create_parameters.rb +13 -1
  24. data/lib/phrase/models/release_preview.rb +12 -1
  25. data/lib/phrase/version.rb +1 -1
  26. data/lib/phrase.rb +8 -0
  27. data/spec/api/organization_job_template_locales_api_spec.rb +100 -0
  28. data/spec/api/organization_job_templates_api_spec.rb +95 -0
  29. data/spec/models/organization_job_template_create_parameters_spec.rb +35 -0
  30. data/spec/models/organization_job_template_details_spec.rb +71 -0
  31. data/spec/models/organization_job_template_locale_update_parameters_spec.rb +59 -0
  32. data/spec/models/organization_job_template_locales_create_parameters_spec.rb +59 -0
  33. data/spec/models/organization_job_template_spec.rb +53 -0
  34. data/spec/models/organization_job_template_update_parameters_spec.rb +35 -0
  35. data/spec/models/release_create_parameters_spec.rb +6 -0
  36. data/spec/models/release_preview_spec.rb +6 -0
  37. data/spec/models/release_spec.rb +6 -0
  38. metadata +240 -208
@@ -0,0 +1,253 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class OrganizationJobTemplateLocaleUpdateParameters
5
+ # locale name
6
+ attr_accessor :locale_name
7
+
8
+ # locale code
9
+ attr_accessor :locale_code
10
+
11
+ # Array of user ids to be assigned to the job template locale
12
+ attr_accessor :user_ids
13
+
14
+ # Array of reviewer ids to be assigned to the job template locale
15
+ attr_accessor :reviewer_ids
16
+
17
+ # Array of team ids to be assigned to the job locale as translators
18
+ attr_accessor :translator_team_ids
19
+
20
+ # Array of team ids to be assigned to the job locale as reviewers
21
+ attr_accessor :reviewer_team_ids
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'locale_name' => :'locale_name',
27
+ :'locale_code' => :'locale_code',
28
+ :'user_ids' => :'user_ids',
29
+ :'reviewer_ids' => :'reviewer_ids',
30
+ :'translator_team_ids' => :'translator_team_ids',
31
+ :'reviewer_team_ids' => :'reviewer_team_ids'
32
+ }
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'locale_name' => :'String',
39
+ :'locale_code' => :'String',
40
+ :'user_ids' => :'Array<String>',
41
+ :'reviewer_ids' => :'Array<String>',
42
+ :'translator_team_ids' => :'Array<String>',
43
+ :'reviewer_team_ids' => :'Array<String>'
44
+ }
45
+ end
46
+
47
+ # List of attributes with nullable: true
48
+ def self.openapi_nullable
49
+ Set.new([
50
+ ])
51
+ end
52
+
53
+ # Initializes the object
54
+ # @param [Hash] attributes Model attributes in the form of hash
55
+ def initialize(attributes = {})
56
+ if (!attributes.is_a?(Hash))
57
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::OrganizationJobTemplateLocaleUpdateParameters` initialize method"
58
+ end
59
+
60
+ # check to see if the attribute exists and convert string to symbol for hash key
61
+ attributes = attributes.each_with_object({}) { |(k, v), h|
62
+ if (!self.class.attribute_map.key?(k.to_sym))
63
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::OrganizationJobTemplateLocaleUpdateParameters`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
64
+ end
65
+ h[k.to_sym] = v
66
+ }
67
+
68
+ if attributes.key?(:'locale_name')
69
+ self.locale_name = attributes[:'locale_name']
70
+ end
71
+
72
+ if attributes.key?(:'locale_code')
73
+ self.locale_code = attributes[:'locale_code']
74
+ end
75
+
76
+ if attributes.key?(:'user_ids')
77
+ if (value = attributes[:'user_ids']).is_a?(Array)
78
+ self.user_ids = value
79
+ end
80
+ end
81
+
82
+ if attributes.key?(:'reviewer_ids')
83
+ if (value = attributes[:'reviewer_ids']).is_a?(Array)
84
+ self.reviewer_ids = value
85
+ end
86
+ end
87
+
88
+ if attributes.key?(:'translator_team_ids')
89
+ if (value = attributes[:'translator_team_ids']).is_a?(Array)
90
+ self.translator_team_ids = value
91
+ end
92
+ end
93
+
94
+ if attributes.key?(:'reviewer_team_ids')
95
+ if (value = attributes[:'reviewer_team_ids']).is_a?(Array)
96
+ self.reviewer_team_ids = value
97
+ end
98
+ end
99
+ end
100
+
101
+ # Show invalid properties with the reasons. Usually used together with valid?
102
+ # @return Array for valid properties with the reasons
103
+ def list_invalid_properties
104
+ invalid_properties = Array.new
105
+ invalid_properties
106
+ end
107
+
108
+ # Check to see if the all the properties in the model are valid
109
+ # @return true if the model is valid
110
+ def valid?
111
+ true
112
+ end
113
+
114
+ # Checks equality by comparing each attribute.
115
+ # @param [Object] Object to be compared
116
+ def ==(o)
117
+ return true if self.equal?(o)
118
+ self.class == o.class &&
119
+ locale_name == o.locale_name &&
120
+ locale_code == o.locale_code &&
121
+ user_ids == o.user_ids &&
122
+ reviewer_ids == o.reviewer_ids &&
123
+ translator_team_ids == o.translator_team_ids &&
124
+ reviewer_team_ids == o.reviewer_team_ids
125
+ end
126
+
127
+ # @see the `==` method
128
+ # @param [Object] Object to be compared
129
+ def eql?(o)
130
+ self == o
131
+ end
132
+
133
+ # Calculates hash code according to all attributes.
134
+ # @return [Integer] Hash code
135
+ def hash
136
+ [locale_name, locale_code, user_ids, reviewer_ids, translator_team_ids, reviewer_team_ids].hash
137
+ end
138
+
139
+ # Builds the object from hash
140
+ # @param [Hash] attributes Model attributes in the form of hash
141
+ # @return [Object] Returns the model itself
142
+ def self.build_from_hash(attributes)
143
+ new.build_from_hash(attributes)
144
+ end
145
+
146
+ # Builds the object from hash
147
+ # @param [Hash] attributes Model attributes in the form of hash
148
+ # @return [Object] Returns the model itself
149
+ def build_from_hash(attributes)
150
+ return nil unless attributes.is_a?(Hash)
151
+ self.class.openapi_types.each_pair do |key, type|
152
+ if type =~ /\AArray<(.*)>/i
153
+ # check to ensure the input is an array given that the attribute
154
+ # is documented as an array but the input is not
155
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
156
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
157
+ end
158
+ elsif !attributes[self.class.attribute_map[key]].nil?
159
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
160
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
161
+ end
162
+
163
+ self
164
+ end
165
+
166
+ # Deserializes the data based on type
167
+ # @param string type Data type
168
+ # @param string value Value to be deserialized
169
+ # @return [Object] Deserialized data
170
+ def _deserialize(type, value)
171
+ case type.to_sym
172
+ when :DateTime
173
+ DateTime.parse(value)
174
+ when :Date
175
+ Date.parse(value)
176
+ when :String
177
+ value.to_s
178
+ when :Integer
179
+ value.to_i
180
+ when :Float
181
+ value.to_f
182
+ when :Boolean
183
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
184
+ true
185
+ else
186
+ false
187
+ end
188
+ when :Object
189
+ # generic object (usually a Hash), return directly
190
+ value
191
+ when /\AArray<(?<inner_type>.+)>\z/
192
+ inner_type = Regexp.last_match[:inner_type]
193
+ value.map { |v| _deserialize(inner_type, v) }
194
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
195
+ k_type = Regexp.last_match[:k_type]
196
+ v_type = Regexp.last_match[:v_type]
197
+ {}.tap do |hash|
198
+ value.each do |k, v|
199
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
200
+ end
201
+ end
202
+ else # model
203
+ Phrase.const_get(type).build_from_hash(value)
204
+ end
205
+ end
206
+
207
+ # Returns the string representation of the object
208
+ # @return [String] String presentation of the object
209
+ def to_s
210
+ to_hash.to_s
211
+ end
212
+
213
+ # to_body is an alias to to_hash (backward compatibility)
214
+ # @return [Hash] Returns the object in the form of hash
215
+ def to_body
216
+ to_hash
217
+ end
218
+
219
+ # Returns the object in the form of hash
220
+ # @return [Hash] Returns the object in the form of hash
221
+ def to_hash
222
+ hash = {}
223
+ self.class.attribute_map.each_pair do |attr, param|
224
+ value = self.send(attr)
225
+ if value.nil?
226
+ is_nullable = self.class.openapi_nullable.include?(attr)
227
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
228
+ end
229
+
230
+ hash[param] = _to_hash(value)
231
+ end
232
+ hash
233
+ end
234
+
235
+ # Outputs non-array value in the form of hash
236
+ # For object, use to_hash. Otherwise, just return the value
237
+ # @param [Object] value Any valid value
238
+ # @return [Hash] Returns the value in the form of hash
239
+ def _to_hash(value)
240
+ if value.is_a?(Array)
241
+ value.compact.map { |v| _to_hash(v) }
242
+ elsif value.is_a?(Hash)
243
+ {}.tap do |hash|
244
+ value.each { |k, v| hash[k] = _to_hash(v) }
245
+ end
246
+ elsif value.respond_to? :to_hash
247
+ value.to_hash
248
+ else
249
+ value
250
+ end
251
+ end
252
+ end
253
+ end
@@ -0,0 +1,263 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class OrganizationJobTemplateLocalesCreateParameters
5
+ # locale name
6
+ attr_accessor :locale_name
7
+
8
+ # locale code
9
+ attr_accessor :locale_code
10
+
11
+ # Array of user ids to be assigned to the job template locale
12
+ attr_accessor :user_ids
13
+
14
+ # Array of reviewer ids to be assigned to the job template locale
15
+ attr_accessor :reviewer_ids
16
+
17
+ # Array of team ids to be assigned to the job locale as translators
18
+ attr_accessor :translator_team_ids
19
+
20
+ # Array of team ids to be assigned to the job locale as reviewers
21
+ attr_accessor :reviewer_team_ids
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'locale_name' => :'locale_name',
27
+ :'locale_code' => :'locale_code',
28
+ :'user_ids' => :'user_ids',
29
+ :'reviewer_ids' => :'reviewer_ids',
30
+ :'translator_team_ids' => :'translator_team_ids',
31
+ :'reviewer_team_ids' => :'reviewer_team_ids'
32
+ }
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'locale_name' => :'String',
39
+ :'locale_code' => :'String',
40
+ :'user_ids' => :'Array<String>',
41
+ :'reviewer_ids' => :'Array<String>',
42
+ :'translator_team_ids' => :'Array<String>',
43
+ :'reviewer_team_ids' => :'Array<String>'
44
+ }
45
+ end
46
+
47
+ # List of attributes with nullable: true
48
+ def self.openapi_nullable
49
+ Set.new([
50
+ ])
51
+ end
52
+
53
+ # Initializes the object
54
+ # @param [Hash] attributes Model attributes in the form of hash
55
+ def initialize(attributes = {})
56
+ if (!attributes.is_a?(Hash))
57
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::OrganizationJobTemplateLocalesCreateParameters` initialize method"
58
+ end
59
+
60
+ # check to see if the attribute exists and convert string to symbol for hash key
61
+ attributes = attributes.each_with_object({}) { |(k, v), h|
62
+ if (!self.class.attribute_map.key?(k.to_sym))
63
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::OrganizationJobTemplateLocalesCreateParameters`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
64
+ end
65
+ h[k.to_sym] = v
66
+ }
67
+
68
+ if attributes.key?(:'locale_name')
69
+ self.locale_name = attributes[:'locale_name']
70
+ end
71
+
72
+ if attributes.key?(:'locale_code')
73
+ self.locale_code = attributes[:'locale_code']
74
+ end
75
+
76
+ if attributes.key?(:'user_ids')
77
+ if (value = attributes[:'user_ids']).is_a?(Array)
78
+ self.user_ids = value
79
+ end
80
+ end
81
+
82
+ if attributes.key?(:'reviewer_ids')
83
+ if (value = attributes[:'reviewer_ids']).is_a?(Array)
84
+ self.reviewer_ids = value
85
+ end
86
+ end
87
+
88
+ if attributes.key?(:'translator_team_ids')
89
+ if (value = attributes[:'translator_team_ids']).is_a?(Array)
90
+ self.translator_team_ids = value
91
+ end
92
+ end
93
+
94
+ if attributes.key?(:'reviewer_team_ids')
95
+ if (value = attributes[:'reviewer_team_ids']).is_a?(Array)
96
+ self.reviewer_team_ids = value
97
+ end
98
+ end
99
+ end
100
+
101
+ # Show invalid properties with the reasons. Usually used together with valid?
102
+ # @return Array for valid properties with the reasons
103
+ def list_invalid_properties
104
+ invalid_properties = Array.new
105
+ if @locale_name.nil?
106
+ invalid_properties.push('invalid value for "locale_name", locale_name cannot be nil.')
107
+ end
108
+
109
+ if @locale_code.nil?
110
+ invalid_properties.push('invalid value for "locale_code", locale_code cannot be nil.')
111
+ end
112
+
113
+ invalid_properties
114
+ end
115
+
116
+ # Check to see if the all the properties in the model are valid
117
+ # @return true if the model is valid
118
+ def valid?
119
+ return false if @locale_name.nil?
120
+ return false if @locale_code.nil?
121
+ true
122
+ end
123
+
124
+ # Checks equality by comparing each attribute.
125
+ # @param [Object] Object to be compared
126
+ def ==(o)
127
+ return true if self.equal?(o)
128
+ self.class == o.class &&
129
+ locale_name == o.locale_name &&
130
+ locale_code == o.locale_code &&
131
+ user_ids == o.user_ids &&
132
+ reviewer_ids == o.reviewer_ids &&
133
+ translator_team_ids == o.translator_team_ids &&
134
+ reviewer_team_ids == o.reviewer_team_ids
135
+ end
136
+
137
+ # @see the `==` method
138
+ # @param [Object] Object to be compared
139
+ def eql?(o)
140
+ self == o
141
+ end
142
+
143
+ # Calculates hash code according to all attributes.
144
+ # @return [Integer] Hash code
145
+ def hash
146
+ [locale_name, locale_code, user_ids, reviewer_ids, translator_team_ids, reviewer_team_ids].hash
147
+ end
148
+
149
+ # Builds the object from hash
150
+ # @param [Hash] attributes Model attributes in the form of hash
151
+ # @return [Object] Returns the model itself
152
+ def self.build_from_hash(attributes)
153
+ new.build_from_hash(attributes)
154
+ end
155
+
156
+ # Builds the object from hash
157
+ # @param [Hash] attributes Model attributes in the form of hash
158
+ # @return [Object] Returns the model itself
159
+ def build_from_hash(attributes)
160
+ return nil unless attributes.is_a?(Hash)
161
+ self.class.openapi_types.each_pair do |key, type|
162
+ if type =~ /\AArray<(.*)>/i
163
+ # check to ensure the input is an array given that the attribute
164
+ # is documented as an array but the input is not
165
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
166
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
167
+ end
168
+ elsif !attributes[self.class.attribute_map[key]].nil?
169
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
170
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
171
+ end
172
+
173
+ self
174
+ end
175
+
176
+ # Deserializes the data based on type
177
+ # @param string type Data type
178
+ # @param string value Value to be deserialized
179
+ # @return [Object] Deserialized data
180
+ def _deserialize(type, value)
181
+ case type.to_sym
182
+ when :DateTime
183
+ DateTime.parse(value)
184
+ when :Date
185
+ Date.parse(value)
186
+ when :String
187
+ value.to_s
188
+ when :Integer
189
+ value.to_i
190
+ when :Float
191
+ value.to_f
192
+ when :Boolean
193
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
194
+ true
195
+ else
196
+ false
197
+ end
198
+ when :Object
199
+ # generic object (usually a Hash), return directly
200
+ value
201
+ when /\AArray<(?<inner_type>.+)>\z/
202
+ inner_type = Regexp.last_match[:inner_type]
203
+ value.map { |v| _deserialize(inner_type, v) }
204
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
205
+ k_type = Regexp.last_match[:k_type]
206
+ v_type = Regexp.last_match[:v_type]
207
+ {}.tap do |hash|
208
+ value.each do |k, v|
209
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
210
+ end
211
+ end
212
+ else # model
213
+ Phrase.const_get(type).build_from_hash(value)
214
+ end
215
+ end
216
+
217
+ # Returns the string representation of the object
218
+ # @return [String] String presentation of the object
219
+ def to_s
220
+ to_hash.to_s
221
+ end
222
+
223
+ # to_body is an alias to to_hash (backward compatibility)
224
+ # @return [Hash] Returns the object in the form of hash
225
+ def to_body
226
+ to_hash
227
+ end
228
+
229
+ # Returns the object in the form of hash
230
+ # @return [Hash] Returns the object in the form of hash
231
+ def to_hash
232
+ hash = {}
233
+ self.class.attribute_map.each_pair do |attr, param|
234
+ value = self.send(attr)
235
+ if value.nil?
236
+ is_nullable = self.class.openapi_nullable.include?(attr)
237
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
238
+ end
239
+
240
+ hash[param] = _to_hash(value)
241
+ end
242
+ hash
243
+ end
244
+
245
+ # Outputs non-array value in the form of hash
246
+ # For object, use to_hash. Otherwise, just return the value
247
+ # @param [Object] value Any valid value
248
+ # @return [Hash] Returns the value in the form of hash
249
+ def _to_hash(value)
250
+ if value.is_a?(Array)
251
+ value.compact.map { |v| _to_hash(v) }
252
+ elsif value.is_a?(Hash)
253
+ {}.tap do |hash|
254
+ value.each { |k, v| hash[k] = _to_hash(v) }
255
+ end
256
+ elsif value.respond_to? :to_hash
257
+ value.to_hash
258
+ else
259
+ value
260
+ end
261
+ end
262
+ end
263
+ end