phrase 2.21.0 → 2.22.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +14 -3
- data/docs/CustomMetadataApi.md +12 -26
- data/docs/CustomMetadataPropertiesCreateParameters.md +25 -0
- data/docs/CustomMetadataPropertiesUpdateParameters.md +23 -0
- data/docs/Error.md +17 -0
- data/docs/ErrorError.md +19 -0
- data/docs/KeyCreateParameters.md +1 -1
- data/docs/KeyUpdateParameters.md +1 -1
- data/docs/ProjectCreateParameters.md +1 -1
- data/docs/ProjectUpdateParameters.md +1 -1
- data/docs/ProjectsQualityPerformanceScore200Response.md +21 -0
- data/docs/ProjectsQualityPerformanceScore200ResponseAnyOf.md +19 -0
- data/docs/ProjectsQualityPerformanceScore200ResponseAnyOfData.md +17 -0
- data/docs/ProjectsQualityPerformanceScore200ResponseAnyOfDataTranslationsInner.md +21 -0
- data/docs/ProjectsQualityPerformanceScore200ResponseAnyOfErrorsInner.md +21 -0
- data/docs/ProjectsQualityPerformanceScoreRequest.md +17 -0
- data/docs/QualityPerformanceScoreApi.md +72 -0
- data/docs/ScreenshotUpdateParameters.md +1 -1
- data/lib/phrase/api/custom_metadata_api.rb +23 -42
- data/lib/phrase/api/quality_performance_score_api.rb +84 -0
- data/lib/phrase/models/custom_metadata_properties_create_parameters.rb +272 -0
- data/lib/phrase/models/custom_metadata_properties_update_parameters.rb +231 -0
- data/lib/phrase/models/error.rb +197 -0
- data/lib/phrase/models/error_error.rb +205 -0
- data/lib/phrase/models/projects_quality_performance_score200_response.rb +237 -0
- data/lib/phrase/models/projects_quality_performance_score200_response_any_of.rb +208 -0
- data/lib/phrase/models/projects_quality_performance_score200_response_any_of_data.rb +198 -0
- data/lib/phrase/models/projects_quality_performance_score200_response_any_of_data_translations_inner.rb +217 -0
- data/lib/phrase/models/projects_quality_performance_score200_response_any_of_errors_inner.rb +215 -0
- data/lib/phrase/models/projects_quality_performance_score_request.rb +199 -0
- data/lib/phrase/version.rb +1 -1
- data/lib/phrase.rb +11 -0
- data/spec/api/custom_metadata_api_spec.rb +2 -9
- data/spec/api/quality_performance_score_api_spec.rb +37 -0
- data/spec/models/custom_metadata_properties_create_parameters_spec.rb +53 -0
- data/spec/models/custom_metadata_properties_update_parameters_spec.rb +47 -0
- data/spec/models/error_error_spec.rb +35 -0
- data/spec/models/error_spec.rb +29 -0
- data/spec/models/projects_quality_performance_score200_response_any_of_data_spec.rb +29 -0
- data/spec/models/projects_quality_performance_score200_response_any_of_data_translations_inner_spec.rb +41 -0
- data/spec/models/projects_quality_performance_score200_response_any_of_errors_inner_spec.rb +41 -0
- data/spec/models/projects_quality_performance_score200_response_any_of_spec.rb +35 -0
- data/spec/models/projects_quality_performance_score200_response_spec.rb +41 -0
- data/spec/models/projects_quality_performance_score_request_spec.rb +29 -0
- metadata +259 -215
@@ -0,0 +1,217 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module Phrase
|
4
|
+
class ProjectsQualityPerformanceScore200ResponseAnyOfDataTranslationsInner
|
5
|
+
# Engine used for the translation scoring
|
6
|
+
attr_accessor :engine
|
7
|
+
|
8
|
+
# Quality score for the translation
|
9
|
+
attr_accessor :score
|
10
|
+
|
11
|
+
# One of the translation ids passed in arguments
|
12
|
+
attr_accessor :id
|
13
|
+
|
14
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
15
|
+
def self.attribute_map
|
16
|
+
{
|
17
|
+
:'engine' => :'engine',
|
18
|
+
:'score' => :'score',
|
19
|
+
:'id' => :'id'
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
# Attribute type mapping.
|
24
|
+
def self.openapi_types
|
25
|
+
{
|
26
|
+
:'engine' => :'String',
|
27
|
+
:'score' => :'Float',
|
28
|
+
:'id' => :'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::ProjectsQualityPerformanceScore200ResponseAnyOfDataTranslationsInner` 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::ProjectsQualityPerformanceScore200ResponseAnyOfDataTranslationsInner`. 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?(:'engine')
|
54
|
+
self.engine = attributes[:'engine']
|
55
|
+
end
|
56
|
+
|
57
|
+
if attributes.key?(:'score')
|
58
|
+
self.score = attributes[:'score']
|
59
|
+
end
|
60
|
+
|
61
|
+
if attributes.key?(:'id')
|
62
|
+
self.id = attributes[:'id']
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
67
|
+
# @return Array for valid properties with the reasons
|
68
|
+
def list_invalid_properties
|
69
|
+
invalid_properties = Array.new
|
70
|
+
invalid_properties
|
71
|
+
end
|
72
|
+
|
73
|
+
# Check to see if the all the properties in the model are valid
|
74
|
+
# @return true if the model is valid
|
75
|
+
def valid?
|
76
|
+
true
|
77
|
+
end
|
78
|
+
|
79
|
+
# Checks equality by comparing each attribute.
|
80
|
+
# @param [Object] Object to be compared
|
81
|
+
def ==(o)
|
82
|
+
return true if self.equal?(o)
|
83
|
+
self.class == o.class &&
|
84
|
+
engine == o.engine &&
|
85
|
+
score == o.score &&
|
86
|
+
id == o.id
|
87
|
+
end
|
88
|
+
|
89
|
+
# @see the `==` method
|
90
|
+
# @param [Object] Object to be compared
|
91
|
+
def eql?(o)
|
92
|
+
self == o
|
93
|
+
end
|
94
|
+
|
95
|
+
# Calculates hash code according to all attributes.
|
96
|
+
# @return [Integer] Hash code
|
97
|
+
def hash
|
98
|
+
[engine, score, id].hash
|
99
|
+
end
|
100
|
+
|
101
|
+
# Builds the object from hash
|
102
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
103
|
+
# @return [Object] Returns the model itself
|
104
|
+
def self.build_from_hash(attributes)
|
105
|
+
new.build_from_hash(attributes)
|
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 build_from_hash(attributes)
|
112
|
+
return nil unless attributes.is_a?(Hash)
|
113
|
+
self.class.openapi_types.each_pair do |key, type|
|
114
|
+
if type =~ /\AArray<(.*)>/i
|
115
|
+
# check to ensure the input is an array given that the attribute
|
116
|
+
# is documented as an array but the input is not
|
117
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
118
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
119
|
+
end
|
120
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
121
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
122
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
123
|
+
end
|
124
|
+
|
125
|
+
self
|
126
|
+
end
|
127
|
+
|
128
|
+
# Deserializes the data based on type
|
129
|
+
# @param string type Data type
|
130
|
+
# @param string value Value to be deserialized
|
131
|
+
# @return [Object] Deserialized data
|
132
|
+
def _deserialize(type, value)
|
133
|
+
case type.to_sym
|
134
|
+
when :DateTime
|
135
|
+
DateTime.parse(value)
|
136
|
+
when :Date
|
137
|
+
Date.parse(value)
|
138
|
+
when :Time
|
139
|
+
Time.parse(value)
|
140
|
+
when :String
|
141
|
+
value.to_s
|
142
|
+
when :Integer
|
143
|
+
value.to_i
|
144
|
+
when :Float
|
145
|
+
value.to_f
|
146
|
+
when :Boolean
|
147
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
148
|
+
true
|
149
|
+
else
|
150
|
+
false
|
151
|
+
end
|
152
|
+
when :Object
|
153
|
+
# generic object (usually a Hash), return directly
|
154
|
+
value
|
155
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
156
|
+
inner_type = Regexp.last_match[:inner_type]
|
157
|
+
value.map { |v| _deserialize(inner_type, v) }
|
158
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
159
|
+
k_type = Regexp.last_match[:k_type]
|
160
|
+
v_type = Regexp.last_match[:v_type]
|
161
|
+
{}.tap do |hash|
|
162
|
+
value.each do |k, v|
|
163
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
else # model
|
167
|
+
Phrase.const_get(type).build_from_hash(value)
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
# Returns the string representation of the object
|
172
|
+
# @return [String] String presentation of the object
|
173
|
+
def to_s
|
174
|
+
to_hash.to_s
|
175
|
+
end
|
176
|
+
|
177
|
+
# to_body is an alias to to_hash (backward compatibility)
|
178
|
+
# @return [Hash] Returns the object in the form of hash
|
179
|
+
def to_body
|
180
|
+
to_hash
|
181
|
+
end
|
182
|
+
|
183
|
+
# Returns the object in the form of hash
|
184
|
+
# @return [Hash] Returns the object in the form of hash
|
185
|
+
def to_hash
|
186
|
+
hash = {}
|
187
|
+
self.class.attribute_map.each_pair do |attr, param|
|
188
|
+
value = self.send(attr)
|
189
|
+
if value.nil?
|
190
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
191
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
192
|
+
end
|
193
|
+
|
194
|
+
hash[param] = _to_hash(value)
|
195
|
+
end
|
196
|
+
hash
|
197
|
+
end
|
198
|
+
|
199
|
+
# Outputs non-array value in the form of hash
|
200
|
+
# For object, use to_hash. Otherwise, just return the value
|
201
|
+
# @param [Object] value Any valid value
|
202
|
+
# @return [Hash] Returns the value in the form of hash
|
203
|
+
def _to_hash(value)
|
204
|
+
if value.is_a?(Array)
|
205
|
+
value.compact.map { |v| _to_hash(v) }
|
206
|
+
elsif value.is_a?(Hash)
|
207
|
+
{}.tap do |hash|
|
208
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
209
|
+
end
|
210
|
+
elsif value.respond_to? :to_hash
|
211
|
+
value.to_hash
|
212
|
+
else
|
213
|
+
value
|
214
|
+
end
|
215
|
+
end
|
216
|
+
end
|
217
|
+
end
|
@@ -0,0 +1,215 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module Phrase
|
4
|
+
class ProjectsQualityPerformanceScore200ResponseAnyOfErrorsInner
|
5
|
+
attr_accessor :message
|
6
|
+
|
7
|
+
attr_accessor :code
|
8
|
+
|
9
|
+
# One of the translation ids passed in arguments
|
10
|
+
attr_accessor :id
|
11
|
+
|
12
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
13
|
+
def self.attribute_map
|
14
|
+
{
|
15
|
+
:'message' => :'message',
|
16
|
+
:'code' => :'code',
|
17
|
+
:'id' => :'id'
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
# Attribute type mapping.
|
22
|
+
def self.openapi_types
|
23
|
+
{
|
24
|
+
:'message' => :'String',
|
25
|
+
:'code' => :'String',
|
26
|
+
:'id' => :'String'
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
# List of attributes with nullable: true
|
31
|
+
def self.openapi_nullable
|
32
|
+
Set.new([
|
33
|
+
])
|
34
|
+
end
|
35
|
+
|
36
|
+
# Initializes the object
|
37
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
38
|
+
def initialize(attributes = {})
|
39
|
+
if (!attributes.is_a?(Hash))
|
40
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::ProjectsQualityPerformanceScore200ResponseAnyOfErrorsInner` initialize method"
|
41
|
+
end
|
42
|
+
|
43
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
44
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
45
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
46
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::ProjectsQualityPerformanceScore200ResponseAnyOfErrorsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
47
|
+
end
|
48
|
+
h[k.to_sym] = v
|
49
|
+
}
|
50
|
+
|
51
|
+
if attributes.key?(:'message')
|
52
|
+
self.message = attributes[:'message']
|
53
|
+
end
|
54
|
+
|
55
|
+
if attributes.key?(:'code')
|
56
|
+
self.code = attributes[:'code']
|
57
|
+
end
|
58
|
+
|
59
|
+
if attributes.key?(:'id')
|
60
|
+
self.id = attributes[:'id']
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
65
|
+
# @return Array for valid properties with the reasons
|
66
|
+
def list_invalid_properties
|
67
|
+
invalid_properties = Array.new
|
68
|
+
invalid_properties
|
69
|
+
end
|
70
|
+
|
71
|
+
# Check to see if the all the properties in the model are valid
|
72
|
+
# @return true if the model is valid
|
73
|
+
def valid?
|
74
|
+
true
|
75
|
+
end
|
76
|
+
|
77
|
+
# Checks equality by comparing each attribute.
|
78
|
+
# @param [Object] Object to be compared
|
79
|
+
def ==(o)
|
80
|
+
return true if self.equal?(o)
|
81
|
+
self.class == o.class &&
|
82
|
+
message == o.message &&
|
83
|
+
code == o.code &&
|
84
|
+
id == o.id
|
85
|
+
end
|
86
|
+
|
87
|
+
# @see the `==` method
|
88
|
+
# @param [Object] Object to be compared
|
89
|
+
def eql?(o)
|
90
|
+
self == o
|
91
|
+
end
|
92
|
+
|
93
|
+
# Calculates hash code according to all attributes.
|
94
|
+
# @return [Integer] Hash code
|
95
|
+
def hash
|
96
|
+
[message, code, id].hash
|
97
|
+
end
|
98
|
+
|
99
|
+
# Builds the object from hash
|
100
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
101
|
+
# @return [Object] Returns the model itself
|
102
|
+
def self.build_from_hash(attributes)
|
103
|
+
new.build_from_hash(attributes)
|
104
|
+
end
|
105
|
+
|
106
|
+
# Builds the object from hash
|
107
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
108
|
+
# @return [Object] Returns the model itself
|
109
|
+
def build_from_hash(attributes)
|
110
|
+
return nil unless attributes.is_a?(Hash)
|
111
|
+
self.class.openapi_types.each_pair do |key, type|
|
112
|
+
if type =~ /\AArray<(.*)>/i
|
113
|
+
# check to ensure the input is an array given that the attribute
|
114
|
+
# is documented as an array but the input is not
|
115
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
116
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
117
|
+
end
|
118
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
119
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
120
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
121
|
+
end
|
122
|
+
|
123
|
+
self
|
124
|
+
end
|
125
|
+
|
126
|
+
# Deserializes the data based on type
|
127
|
+
# @param string type Data type
|
128
|
+
# @param string value Value to be deserialized
|
129
|
+
# @return [Object] Deserialized data
|
130
|
+
def _deserialize(type, value)
|
131
|
+
case type.to_sym
|
132
|
+
when :DateTime
|
133
|
+
DateTime.parse(value)
|
134
|
+
when :Date
|
135
|
+
Date.parse(value)
|
136
|
+
when :Time
|
137
|
+
Time.parse(value)
|
138
|
+
when :String
|
139
|
+
value.to_s
|
140
|
+
when :Integer
|
141
|
+
value.to_i
|
142
|
+
when :Float
|
143
|
+
value.to_f
|
144
|
+
when :Boolean
|
145
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
146
|
+
true
|
147
|
+
else
|
148
|
+
false
|
149
|
+
end
|
150
|
+
when :Object
|
151
|
+
# generic object (usually a Hash), return directly
|
152
|
+
value
|
153
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
154
|
+
inner_type = Regexp.last_match[:inner_type]
|
155
|
+
value.map { |v| _deserialize(inner_type, v) }
|
156
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
157
|
+
k_type = Regexp.last_match[:k_type]
|
158
|
+
v_type = Regexp.last_match[:v_type]
|
159
|
+
{}.tap do |hash|
|
160
|
+
value.each do |k, v|
|
161
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
else # model
|
165
|
+
Phrase.const_get(type).build_from_hash(value)
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
# Returns the string representation of the object
|
170
|
+
# @return [String] String presentation of the object
|
171
|
+
def to_s
|
172
|
+
to_hash.to_s
|
173
|
+
end
|
174
|
+
|
175
|
+
# to_body is an alias to to_hash (backward compatibility)
|
176
|
+
# @return [Hash] Returns the object in the form of hash
|
177
|
+
def to_body
|
178
|
+
to_hash
|
179
|
+
end
|
180
|
+
|
181
|
+
# Returns the object in the form of hash
|
182
|
+
# @return [Hash] Returns the object in the form of hash
|
183
|
+
def to_hash
|
184
|
+
hash = {}
|
185
|
+
self.class.attribute_map.each_pair do |attr, param|
|
186
|
+
value = self.send(attr)
|
187
|
+
if value.nil?
|
188
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
189
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
190
|
+
end
|
191
|
+
|
192
|
+
hash[param] = _to_hash(value)
|
193
|
+
end
|
194
|
+
hash
|
195
|
+
end
|
196
|
+
|
197
|
+
# Outputs non-array value in the form of hash
|
198
|
+
# For object, use to_hash. Otherwise, just return the value
|
199
|
+
# @param [Object] value Any valid value
|
200
|
+
# @return [Hash] Returns the value in the form of hash
|
201
|
+
def _to_hash(value)
|
202
|
+
if value.is_a?(Array)
|
203
|
+
value.compact.map { |v| _to_hash(v) }
|
204
|
+
elsif value.is_a?(Hash)
|
205
|
+
{}.tap do |hash|
|
206
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
207
|
+
end
|
208
|
+
elsif value.respond_to? :to_hash
|
209
|
+
value.to_hash
|
210
|
+
else
|
211
|
+
value
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
@@ -0,0 +1,199 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module Phrase
|
4
|
+
class ProjectsQualityPerformanceScoreRequest
|
5
|
+
# Translation ids you want to get the quality performance score for
|
6
|
+
attr_accessor :translation_ids
|
7
|
+
|
8
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
9
|
+
def self.attribute_map
|
10
|
+
{
|
11
|
+
:'translation_ids' => :'translation_ids'
|
12
|
+
}
|
13
|
+
end
|
14
|
+
|
15
|
+
# Attribute type mapping.
|
16
|
+
def self.openapi_types
|
17
|
+
{
|
18
|
+
:'translation_ids' => :'Array<String>'
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
# List of attributes with nullable: true
|
23
|
+
def self.openapi_nullable
|
24
|
+
Set.new([
|
25
|
+
])
|
26
|
+
end
|
27
|
+
|
28
|
+
# Initializes the object
|
29
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
30
|
+
def initialize(attributes = {})
|
31
|
+
if (!attributes.is_a?(Hash))
|
32
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::ProjectsQualityPerformanceScoreRequest` initialize method"
|
33
|
+
end
|
34
|
+
|
35
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
36
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
37
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
38
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::ProjectsQualityPerformanceScoreRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
39
|
+
end
|
40
|
+
h[k.to_sym] = v
|
41
|
+
}
|
42
|
+
|
43
|
+
if attributes.key?(:'translation_ids')
|
44
|
+
if (value = attributes[:'translation_ids']).is_a?(Array)
|
45
|
+
self.translation_ids = value
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
51
|
+
# @return Array for valid properties with the reasons
|
52
|
+
def list_invalid_properties
|
53
|
+
invalid_properties = Array.new
|
54
|
+
invalid_properties
|
55
|
+
end
|
56
|
+
|
57
|
+
# Check to see if the all the properties in the model are valid
|
58
|
+
# @return true if the model is valid
|
59
|
+
def valid?
|
60
|
+
true
|
61
|
+
end
|
62
|
+
|
63
|
+
# Checks equality by comparing each attribute.
|
64
|
+
# @param [Object] Object to be compared
|
65
|
+
def ==(o)
|
66
|
+
return true if self.equal?(o)
|
67
|
+
self.class == o.class &&
|
68
|
+
translation_ids == o.translation_ids
|
69
|
+
end
|
70
|
+
|
71
|
+
# @see the `==` method
|
72
|
+
# @param [Object] Object to be compared
|
73
|
+
def eql?(o)
|
74
|
+
self == o
|
75
|
+
end
|
76
|
+
|
77
|
+
# Calculates hash code according to all attributes.
|
78
|
+
# @return [Integer] Hash code
|
79
|
+
def hash
|
80
|
+
[translation_ids].hash
|
81
|
+
end
|
82
|
+
|
83
|
+
# Builds the object from hash
|
84
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
85
|
+
# @return [Object] Returns the model itself
|
86
|
+
def self.build_from_hash(attributes)
|
87
|
+
new.build_from_hash(attributes)
|
88
|
+
end
|
89
|
+
|
90
|
+
# Builds the object from hash
|
91
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
92
|
+
# @return [Object] Returns the model itself
|
93
|
+
def build_from_hash(attributes)
|
94
|
+
return nil unless attributes.is_a?(Hash)
|
95
|
+
self.class.openapi_types.each_pair do |key, type|
|
96
|
+
if type =~ /\AArray<(.*)>/i
|
97
|
+
# check to ensure the input is an array given that the attribute
|
98
|
+
# is documented as an array but the input is not
|
99
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
100
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
101
|
+
end
|
102
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
103
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
104
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
105
|
+
end
|
106
|
+
|
107
|
+
self
|
108
|
+
end
|
109
|
+
|
110
|
+
# Deserializes the data based on type
|
111
|
+
# @param string type Data type
|
112
|
+
# @param string value Value to be deserialized
|
113
|
+
# @return [Object] Deserialized data
|
114
|
+
def _deserialize(type, value)
|
115
|
+
case type.to_sym
|
116
|
+
when :DateTime
|
117
|
+
DateTime.parse(value)
|
118
|
+
when :Date
|
119
|
+
Date.parse(value)
|
120
|
+
when :Time
|
121
|
+
Time.parse(value)
|
122
|
+
when :String
|
123
|
+
value.to_s
|
124
|
+
when :Integer
|
125
|
+
value.to_i
|
126
|
+
when :Float
|
127
|
+
value.to_f
|
128
|
+
when :Boolean
|
129
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
130
|
+
true
|
131
|
+
else
|
132
|
+
false
|
133
|
+
end
|
134
|
+
when :Object
|
135
|
+
# generic object (usually a Hash), return directly
|
136
|
+
value
|
137
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
138
|
+
inner_type = Regexp.last_match[:inner_type]
|
139
|
+
value.map { |v| _deserialize(inner_type, v) }
|
140
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
141
|
+
k_type = Regexp.last_match[:k_type]
|
142
|
+
v_type = Regexp.last_match[:v_type]
|
143
|
+
{}.tap do |hash|
|
144
|
+
value.each do |k, v|
|
145
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
146
|
+
end
|
147
|
+
end
|
148
|
+
else # model
|
149
|
+
Phrase.const_get(type).build_from_hash(value)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
# Returns the string representation of the object
|
154
|
+
# @return [String] String presentation of the object
|
155
|
+
def to_s
|
156
|
+
to_hash.to_s
|
157
|
+
end
|
158
|
+
|
159
|
+
# to_body is an alias to to_hash (backward compatibility)
|
160
|
+
# @return [Hash] Returns the object in the form of hash
|
161
|
+
def to_body
|
162
|
+
to_hash
|
163
|
+
end
|
164
|
+
|
165
|
+
# Returns the object in the form of hash
|
166
|
+
# @return [Hash] Returns the object in the form of hash
|
167
|
+
def to_hash
|
168
|
+
hash = {}
|
169
|
+
self.class.attribute_map.each_pair do |attr, param|
|
170
|
+
value = self.send(attr)
|
171
|
+
if value.nil?
|
172
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
173
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
174
|
+
end
|
175
|
+
|
176
|
+
hash[param] = _to_hash(value)
|
177
|
+
end
|
178
|
+
hash
|
179
|
+
end
|
180
|
+
|
181
|
+
# Outputs non-array value in the form of hash
|
182
|
+
# For object, use to_hash. Otherwise, just return the value
|
183
|
+
# @param [Object] value Any valid value
|
184
|
+
# @return [Hash] Returns the value in the form of hash
|
185
|
+
def _to_hash(value)
|
186
|
+
if value.is_a?(Array)
|
187
|
+
value.compact.map { |v| _to_hash(v) }
|
188
|
+
elsif value.is_a?(Hash)
|
189
|
+
{}.tap do |hash|
|
190
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
191
|
+
end
|
192
|
+
elsif value.respond_to? :to_hash
|
193
|
+
value.to_hash
|
194
|
+
else
|
195
|
+
value
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|
data/lib/phrase/version.rb
CHANGED
data/lib/phrase.rb
CHANGED
@@ -37,6 +37,8 @@ require 'phrase/models/comment_update_parameters'
|
|
37
37
|
require 'phrase/models/comments_list_parameters'
|
38
38
|
require 'phrase/models/current_user'
|
39
39
|
require 'phrase/models/custom_metadata_data_type'
|
40
|
+
require 'phrase/models/custom_metadata_properties_create_parameters'
|
41
|
+
require 'phrase/models/custom_metadata_properties_update_parameters'
|
40
42
|
require 'phrase/models/custom_metadata_property'
|
41
43
|
require 'phrase/models/custom_metadata_property_create422_response'
|
42
44
|
require 'phrase/models/custom_metadata_property_create422_response_errors_inner'
|
@@ -45,6 +47,8 @@ require 'phrase/models/distribution_create_parameters'
|
|
45
47
|
require 'phrase/models/distribution_preview'
|
46
48
|
require 'phrase/models/distribution_update_parameters'
|
47
49
|
require 'phrase/models/document'
|
50
|
+
require 'phrase/models/error'
|
51
|
+
require 'phrase/models/error_error'
|
48
52
|
require 'phrase/models/figma_attachment'
|
49
53
|
require 'phrase/models/figma_attachment_create_parameters'
|
50
54
|
require 'phrase/models/figma_attachment_update_parameters'
|
@@ -140,6 +144,12 @@ require 'phrase/models/project_locales'
|
|
140
144
|
require 'phrase/models/project_report'
|
141
145
|
require 'phrase/models/project_short'
|
142
146
|
require 'phrase/models/project_update_parameters'
|
147
|
+
require 'phrase/models/projects_quality_performance_score200_response'
|
148
|
+
require 'phrase/models/projects_quality_performance_score200_response_any_of'
|
149
|
+
require 'phrase/models/projects_quality_performance_score200_response_any_of_data'
|
150
|
+
require 'phrase/models/projects_quality_performance_score200_response_any_of_data_translations_inner'
|
151
|
+
require 'phrase/models/projects_quality_performance_score200_response_any_of_errors_inner'
|
152
|
+
require 'phrase/models/projects_quality_performance_score_request'
|
143
153
|
require 'phrase/models/release'
|
144
154
|
require 'phrase/models/release_create_parameters'
|
145
155
|
require 'phrase/models/release_preview'
|
@@ -243,6 +253,7 @@ require 'phrase/api/orders_api'
|
|
243
253
|
require 'phrase/api/organization_job_template_locales_api'
|
244
254
|
require 'phrase/api/organization_job_templates_api'
|
245
255
|
require 'phrase/api/projects_api'
|
256
|
+
require 'phrase/api/quality_performance_score_api'
|
246
257
|
require 'phrase/api/releases_api'
|
247
258
|
require 'phrase/api/reports_api'
|
248
259
|
require 'phrase/api/screenshot_markers_api'
|
@@ -57,13 +57,9 @@ describe 'CustomMetadataApi' do
|
|
57
57
|
# Create a property
|
58
58
|
# Create a new custom metadata property.
|
59
59
|
# @param account_id Account ID
|
60
|
-
# @param
|
61
|
-
# @param data_type Data Type of Custom Metadata Property
|
60
|
+
# @param custom_metadata_properties_create_parameters
|
62
61
|
# @param [Hash] opts the optional parameters
|
63
62
|
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
64
|
-
# @option opts [String] :description description of property
|
65
|
-
# @option opts [Array<String>] :project_ids ids of projects that the property belongs to
|
66
|
-
# @option opts [Array<String>] :value_options value options of property (only applies to single or multi select properties)
|
67
63
|
# @return [CustomMetadataProperty]
|
68
64
|
describe 'custom_metadata_property_create test' do
|
69
65
|
it 'should work' do
|
@@ -90,12 +86,9 @@ describe 'CustomMetadataApi' do
|
|
90
86
|
# Update an existing custom metadata property.
|
91
87
|
# @param account_id Account ID
|
92
88
|
# @param id ID
|
89
|
+
# @param custom_metadata_properties_update_parameters
|
93
90
|
# @param [Hash] opts the optional parameters
|
94
91
|
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
95
|
-
# @option opts [String] :name name of the property
|
96
|
-
# @option opts [String] :description description of property
|
97
|
-
# @option opts [Array<String>] :project_ids ids of projects that the property belongs to
|
98
|
-
# @option opts [Array<String>] :value_options value options of property (only applies to single or multi select properties)
|
99
92
|
# @return [CustomMetadataProperty]
|
100
93
|
describe 'custom_metadata_property_update test' do
|
101
94
|
it 'should work' do
|