phrase 2.8.7 → 2.10.0

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