phrase 2.20.0 → 2.22.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 (86) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +22 -0
  3. data/README.md +27 -5
  4. data/docs/CustomMetadataApi.md +339 -0
  5. data/docs/CustomMetadataDataType.md +16 -0
  6. data/docs/CustomMetadataPropertiesCreateParameters.md +25 -0
  7. data/docs/CustomMetadataPropertiesUpdateParameters.md +23 -0
  8. data/docs/CustomMetadataProperty.md +33 -0
  9. data/docs/CustomMetadataPropertyCreate422Response.md +19 -0
  10. data/docs/{InvitationCreate422ResponseErrorsInner.md → CustomMetadataPropertyCreate422ResponseErrorsInner.md} +2 -2
  11. data/docs/Error.md +17 -0
  12. data/docs/ErrorError.md +19 -0
  13. data/docs/KeyCreateParameters.md +4 -2
  14. data/docs/KeyUpdateParameters.md +4 -2
  15. data/docs/KeysApi.md +2 -2
  16. data/docs/KeysSearchParameters.md +1 -1
  17. data/docs/LocaleReport.md +43 -0
  18. data/docs/LocalesApi.md +3 -1
  19. data/docs/ProjectCreateParameters.md +1 -1
  20. data/docs/ProjectReport.md +31 -0
  21. data/docs/ProjectUpdateParameters.md +1 -1
  22. data/docs/ProjectsQualityPerformanceScore200Response.md +21 -0
  23. data/docs/ProjectsQualityPerformanceScore200ResponseAnyOf.md +19 -0
  24. data/docs/ProjectsQualityPerformanceScore200ResponseAnyOfData.md +17 -0
  25. data/docs/ProjectsQualityPerformanceScore200ResponseAnyOfDataTranslationsInner.md +21 -0
  26. data/docs/ProjectsQualityPerformanceScore200ResponseAnyOfErrorsInner.md +21 -0
  27. data/docs/ProjectsQualityPerformanceScoreRequest.md +17 -0
  28. data/docs/QualityPerformanceScoreApi.md +72 -0
  29. data/docs/ReportsApi.md +144 -0
  30. data/docs/ScreenshotUpdateParameters.md +1 -1
  31. data/docs/TranslationKeyDetails.md +3 -1
  32. data/docs/Upload.md +2 -0
  33. data/lib/phrase/api/custom_metadata_api.rb +390 -0
  34. data/lib/phrase/api/keys_api.rb +2 -2
  35. data/lib/phrase/api/locales_api.rb +3 -0
  36. data/lib/phrase/api/quality_performance_score_api.rb +84 -0
  37. data/lib/phrase/api/reports_api.rb +160 -0
  38. data/lib/phrase/models/custom_metadata_data_type.rb +30 -0
  39. data/lib/phrase/models/custom_metadata_properties_create_parameters.rb +272 -0
  40. data/lib/phrase/models/custom_metadata_properties_update_parameters.rb +231 -0
  41. data/lib/phrase/models/custom_metadata_property.rb +294 -0
  42. data/lib/phrase/models/{invitation_create422_response.rb → custom_metadata_property_create422_response.rb} +4 -4
  43. data/lib/phrase/models/{invitation_create422_response_errors_inner.rb → custom_metadata_property_create422_response_errors_inner.rb} +3 -3
  44. data/lib/phrase/models/error.rb +197 -0
  45. data/lib/phrase/models/error_error.rb +205 -0
  46. data/lib/phrase/models/key_create_parameters.rb +14 -4
  47. data/lib/phrase/models/key_update_parameters.rb +14 -4
  48. data/lib/phrase/models/keys_search_parameters.rb +1 -1
  49. data/lib/phrase/models/locale_report.rb +313 -0
  50. data/lib/phrase/models/project_report.rb +259 -0
  51. data/lib/phrase/models/projects_quality_performance_score200_response.rb +237 -0
  52. data/lib/phrase/models/projects_quality_performance_score200_response_any_of.rb +208 -0
  53. data/lib/phrase/models/projects_quality_performance_score200_response_any_of_data.rb +198 -0
  54. data/lib/phrase/models/projects_quality_performance_score200_response_any_of_data_translations_inner.rb +217 -0
  55. data/lib/phrase/models/projects_quality_performance_score200_response_any_of_errors_inner.rb +215 -0
  56. data/lib/phrase/models/projects_quality_performance_score_request.rb +199 -0
  57. data/lib/phrase/models/translation_key_details.rb +15 -4
  58. data/lib/phrase/models/upload.rb +11 -1
  59. data/lib/phrase/version.rb +1 -1
  60. data/lib/phrase.rb +19 -2
  61. data/spec/api/custom_metadata_api_spec.rb +99 -0
  62. data/spec/api/keys_api_spec.rb +1 -1
  63. data/spec/api/quality_performance_score_api_spec.rb +37 -0
  64. data/spec/api/reports_api_spec.rb +55 -0
  65. data/spec/models/custom_metadata_data_type_spec.rb +23 -0
  66. data/spec/models/custom_metadata_properties_create_parameters_spec.rb +53 -0
  67. data/spec/models/custom_metadata_properties_update_parameters_spec.rb +47 -0
  68. data/spec/models/{invitation_create422_response_errors_inner_spec.rb → custom_metadata_property_create422_response_errors_inner_spec.rb} +6 -6
  69. data/spec/models/custom_metadata_property_create422_response_spec.rb +35 -0
  70. data/spec/models/custom_metadata_property_spec.rb +77 -0
  71. data/spec/models/{invitation_create422_response_spec.rb → error_error_spec.rb} +7 -7
  72. data/spec/models/error_spec.rb +29 -0
  73. data/spec/models/key_create_parameters_spec.rb +6 -0
  74. data/spec/models/key_update_parameters_spec.rb +6 -0
  75. data/spec/models/locale_report_spec.rb +107 -0
  76. data/spec/models/project_report_spec.rb +71 -0
  77. data/spec/models/projects_quality_performance_score200_response_any_of_data_spec.rb +29 -0
  78. data/spec/models/projects_quality_performance_score200_response_any_of_data_translations_inner_spec.rb +41 -0
  79. data/spec/models/projects_quality_performance_score200_response_any_of_errors_inner_spec.rb +41 -0
  80. data/spec/models/projects_quality_performance_score200_response_any_of_spec.rb +35 -0
  81. data/spec/models/projects_quality_performance_score200_response_spec.rb +41 -0
  82. data/spec/models/projects_quality_performance_score_request_spec.rb +29 -0
  83. data/spec/models/translation_key_details_spec.rb +6 -0
  84. data/spec/models/upload_spec.rb +6 -0
  85. metadata +285 -217
  86. data/docs/InvitationCreate422Response.md +0 -19
@@ -0,0 +1,205 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class ErrorError
5
+ attr_accessor :message
6
+
7
+ attr_accessor :code
8
+
9
+ # Attribute mapping from ruby-style variable name to JSON key.
10
+ def self.attribute_map
11
+ {
12
+ :'message' => :'message',
13
+ :'code' => :'code'
14
+ }
15
+ end
16
+
17
+ # Attribute type mapping.
18
+ def self.openapi_types
19
+ {
20
+ :'message' => :'String',
21
+ :'code' => :'String'
22
+ }
23
+ end
24
+
25
+ # List of attributes with nullable: true
26
+ def self.openapi_nullable
27
+ Set.new([
28
+ ])
29
+ end
30
+
31
+ # Initializes the object
32
+ # @param [Hash] attributes Model attributes in the form of hash
33
+ def initialize(attributes = {})
34
+ if (!attributes.is_a?(Hash))
35
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::ErrorError` initialize method"
36
+ end
37
+
38
+ # check to see if the attribute exists and convert string to symbol for hash key
39
+ attributes = attributes.each_with_object({}) { |(k, v), h|
40
+ if (!self.class.attribute_map.key?(k.to_sym))
41
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::ErrorError`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
42
+ end
43
+ h[k.to_sym] = v
44
+ }
45
+
46
+ if attributes.key?(:'message')
47
+ self.message = attributes[:'message']
48
+ end
49
+
50
+ if attributes.key?(:'code')
51
+ self.code = attributes[:'code']
52
+ end
53
+ end
54
+
55
+ # Show invalid properties with the reasons. Usually used together with valid?
56
+ # @return Array for valid properties with the reasons
57
+ def list_invalid_properties
58
+ invalid_properties = Array.new
59
+ invalid_properties
60
+ end
61
+
62
+ # Check to see if the all the properties in the model are valid
63
+ # @return true if the model is valid
64
+ def valid?
65
+ true
66
+ end
67
+
68
+ # Checks equality by comparing each attribute.
69
+ # @param [Object] Object to be compared
70
+ def ==(o)
71
+ return true if self.equal?(o)
72
+ self.class == o.class &&
73
+ message == o.message &&
74
+ code == o.code
75
+ end
76
+
77
+ # @see the `==` method
78
+ # @param [Object] Object to be compared
79
+ def eql?(o)
80
+ self == o
81
+ end
82
+
83
+ # Calculates hash code according to all attributes.
84
+ # @return [Integer] Hash code
85
+ def hash
86
+ [message, code].hash
87
+ end
88
+
89
+ # Builds the object from hash
90
+ # @param [Hash] attributes Model attributes in the form of hash
91
+ # @return [Object] Returns the model itself
92
+ def self.build_from_hash(attributes)
93
+ new.build_from_hash(attributes)
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 build_from_hash(attributes)
100
+ return nil unless attributes.is_a?(Hash)
101
+ self.class.openapi_types.each_pair do |key, type|
102
+ if type =~ /\AArray<(.*)>/i
103
+ # check to ensure the input is an array given that the attribute
104
+ # is documented as an array but the input is not
105
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
106
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
107
+ end
108
+ elsif !attributes[self.class.attribute_map[key]].nil?
109
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
110
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
111
+ end
112
+
113
+ self
114
+ end
115
+
116
+ # Deserializes the data based on type
117
+ # @param string type Data type
118
+ # @param string value Value to be deserialized
119
+ # @return [Object] Deserialized data
120
+ def _deserialize(type, value)
121
+ case type.to_sym
122
+ when :DateTime
123
+ DateTime.parse(value)
124
+ when :Date
125
+ Date.parse(value)
126
+ when :Time
127
+ Time.parse(value)
128
+ when :String
129
+ value.to_s
130
+ when :Integer
131
+ value.to_i
132
+ when :Float
133
+ value.to_f
134
+ when :Boolean
135
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
136
+ true
137
+ else
138
+ false
139
+ end
140
+ when :Object
141
+ # generic object (usually a Hash), return directly
142
+ value
143
+ when /\AArray<(?<inner_type>.+)>\z/
144
+ inner_type = Regexp.last_match[:inner_type]
145
+ value.map { |v| _deserialize(inner_type, v) }
146
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
147
+ k_type = Regexp.last_match[:k_type]
148
+ v_type = Regexp.last_match[:v_type]
149
+ {}.tap do |hash|
150
+ value.each do |k, v|
151
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
152
+ end
153
+ end
154
+ else # model
155
+ Phrase.const_get(type).build_from_hash(value)
156
+ end
157
+ end
158
+
159
+ # Returns the string representation of the object
160
+ # @return [String] String presentation of the object
161
+ def to_s
162
+ to_hash.to_s
163
+ end
164
+
165
+ # to_body is an alias to to_hash (backward compatibility)
166
+ # @return [Hash] Returns the object in the form of hash
167
+ def to_body
168
+ to_hash
169
+ end
170
+
171
+ # Returns the object in the form of hash
172
+ # @return [Hash] Returns the object in the form of hash
173
+ def to_hash
174
+ hash = {}
175
+ self.class.attribute_map.each_pair do |attr, param|
176
+ value = self.send(attr)
177
+ if value.nil?
178
+ is_nullable = self.class.openapi_nullable.include?(attr)
179
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
180
+ end
181
+
182
+ hash[param] = _to_hash(value)
183
+ end
184
+ hash
185
+ end
186
+
187
+ # Outputs non-array value in the form of hash
188
+ # For object, use to_hash. Otherwise, just return the value
189
+ # @param [Object] value Any valid value
190
+ # @return [Hash] Returns the value in the form of hash
191
+ def _to_hash(value)
192
+ if value.is_a?(Array)
193
+ value.compact.map { |v| _to_hash(v) }
194
+ elsif value.is_a?(Hash)
195
+ {}.tap do |hash|
196
+ value.each { |k, v| hash[k] = _to_hash(v) }
197
+ end
198
+ elsif value.respond_to? :to_hash
199
+ value.to_hash
200
+ else
201
+ value
202
+ end
203
+ end
204
+ end
205
+ end
@@ -50,6 +50,9 @@ module Phrase
50
50
  # NSStringLocalizedFormatKey attribute. Used in .stringsdict format.
51
51
  attr_accessor :localized_format_key
52
52
 
53
+ # Custom metadata property name and value pairs to be associated with key.
54
+ attr_accessor :custom_metadata
55
+
53
56
  # Attribute mapping from ruby-style variable name to JSON key.
54
57
  def self.attribute_map
55
58
  {
@@ -68,7 +71,8 @@ module Phrase
68
71
  :'xml_space_preserve' => :'xml_space_preserve',
69
72
  :'original_file' => :'original_file',
70
73
  :'localized_format_string' => :'localized_format_string',
71
- :'localized_format_key' => :'localized_format_key'
74
+ :'localized_format_key' => :'localized_format_key',
75
+ :'custom_metadata' => :'custom_metadata'
72
76
  }
73
77
  end
74
78
 
@@ -90,7 +94,8 @@ module Phrase
90
94
  :'xml_space_preserve' => :'Boolean',
91
95
  :'original_file' => :'String',
92
96
  :'localized_format_string' => :'String',
93
- :'localized_format_key' => :'String'
97
+ :'localized_format_key' => :'String',
98
+ :'custom_metadata' => :'Object'
94
99
  }
95
100
  end
96
101
 
@@ -178,6 +183,10 @@ module Phrase
178
183
  if attributes.key?(:'localized_format_key')
179
184
  self.localized_format_key = attributes[:'localized_format_key']
180
185
  end
186
+
187
+ if attributes.key?(:'custom_metadata')
188
+ self.custom_metadata = attributes[:'custom_metadata']
189
+ end
181
190
  end
182
191
 
183
192
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -213,7 +222,8 @@ module Phrase
213
222
  xml_space_preserve == o.xml_space_preserve &&
214
223
  original_file == o.original_file &&
215
224
  localized_format_string == o.localized_format_string &&
216
- localized_format_key == o.localized_format_key
225
+ localized_format_key == o.localized_format_key &&
226
+ custom_metadata == o.custom_metadata
217
227
  end
218
228
 
219
229
  # @see the `==` method
@@ -225,7 +235,7 @@ module Phrase
225
235
  # Calculates hash code according to all attributes.
226
236
  # @return [Integer] Hash code
227
237
  def hash
228
- [branch, name, description, plural, name_plural, data_type, tags, max_characters_allowed, screenshot, remove_screenshot, unformatted, default_translation_content, xml_space_preserve, original_file, localized_format_string, localized_format_key].hash
238
+ [branch, name, description, plural, name_plural, data_type, tags, max_characters_allowed, screenshot, remove_screenshot, unformatted, default_translation_content, xml_space_preserve, original_file, localized_format_string, localized_format_key, custom_metadata].hash
229
239
  end
230
240
 
231
241
  # Builds the object from hash
@@ -47,6 +47,9 @@ module Phrase
47
47
  # NSStringLocalizedFormatKey attribute. Used in .stringsdict format.
48
48
  attr_accessor :localized_format_key
49
49
 
50
+ # Updates/Creates custom metadata property name and value pairs to be associated with key. If you want to delete a custom metadata property, you can set its value to null. If you want to update a custom metadata property, you can set its value to the new value.
51
+ attr_accessor :custom_metadata
52
+
50
53
  # Attribute mapping from ruby-style variable name to JSON key.
51
54
  def self.attribute_map
52
55
  {
@@ -64,7 +67,8 @@ module Phrase
64
67
  :'xml_space_preserve' => :'xml_space_preserve',
65
68
  :'original_file' => :'original_file',
66
69
  :'localized_format_string' => :'localized_format_string',
67
- :'localized_format_key' => :'localized_format_key'
70
+ :'localized_format_key' => :'localized_format_key',
71
+ :'custom_metadata' => :'custom_metadata'
68
72
  }
69
73
  end
70
74
 
@@ -85,7 +89,8 @@ module Phrase
85
89
  :'xml_space_preserve' => :'Boolean',
86
90
  :'original_file' => :'String',
87
91
  :'localized_format_string' => :'String',
88
- :'localized_format_key' => :'String'
92
+ :'localized_format_key' => :'String',
93
+ :'custom_metadata' => :'Object'
89
94
  }
90
95
  end
91
96
 
@@ -169,6 +174,10 @@ module Phrase
169
174
  if attributes.key?(:'localized_format_key')
170
175
  self.localized_format_key = attributes[:'localized_format_key']
171
176
  end
177
+
178
+ if attributes.key?(:'custom_metadata')
179
+ self.custom_metadata = attributes[:'custom_metadata']
180
+ end
172
181
  end
173
182
 
174
183
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -203,7 +212,8 @@ module Phrase
203
212
  xml_space_preserve == o.xml_space_preserve &&
204
213
  original_file == o.original_file &&
205
214
  localized_format_string == o.localized_format_string &&
206
- localized_format_key == o.localized_format_key
215
+ localized_format_key == o.localized_format_key &&
216
+ custom_metadata == o.custom_metadata
207
217
  end
208
218
 
209
219
  # @see the `==` method
@@ -215,7 +225,7 @@ module Phrase
215
225
  # Calculates hash code according to all attributes.
216
226
  # @return [Integer] Hash code
217
227
  def hash
218
- [branch, name, description, plural, name_plural, data_type, tags, max_characters_allowed, screenshot, remove_screenshot, unformatted, xml_space_preserve, original_file, localized_format_string, localized_format_key].hash
228
+ [branch, name, description, plural, name_plural, data_type, tags, max_characters_allowed, screenshot, remove_screenshot, unformatted, xml_space_preserve, original_file, localized_format_string, localized_format_key, custom_metadata].hash
219
229
  end
220
230
 
221
231
  # Builds the object from hash
@@ -11,7 +11,7 @@ module Phrase
11
11
  # Order direction. Can be one of: asc, desc.
12
12
  attr_accessor :order
13
13
 
14
- # Specify a query to do broad search for keys by name (including wildcards).<br><br> The following qualifiers are also supported in the search term:<br> <ul> <li><code>ids:key_id,...</code> for queries on a comma-separated list of ids</li> <li><code>name:key_name</code> for text queries on exact key names - spaces, commas, and colons need to be escaped with double backslashes</li> <li><code>tags:tag_name</code> to filter for keys with certain tags</li> <li><code>translated:{true|false}</code> for translation status (also requires <code>locale_id</code> to be specified)</li> <li><code>updated_at:{>=|<=}2013-02-21T00:00:00Z</code> for date range queries</li> <li><code>unmentioned_in_upload:upload_id</code> to filter keys unmentioned within upload</li> </ul> Find more examples <a href=\"#overview--usage-examples\">here</a>. Please note: If <code>tags</code> are added to filter the search, the search will be limited to a maximum of 65,536 tagged keys.
14
+ # Specify a query to do broad search for keys by name (including wildcards).<br><br> The following qualifiers are also supported in the search term:<br> <ul> <li><code>ids:key_id,...</code> for queries on a comma-separated list of ids</li> <li><code>name:key_name,...</code> for text queries on a comma-seperated list of exact key names - spaces, commas, and colons need to be escaped with double backslashes</li> <li><code>tags:tag_name,...</code> to filter for keys with certain comma-seperated list of tags</li> <li><code>uploads:upload_id,...</code> to filter for keys with certain comma-seperated list of uploads</li> <li><code>job:{true|false}</code> to filter for keys mentioned in an active job</li> <li><code>translated:{true|false}</code> for translation status (also requires <code>locale_id</code> to be specified)</li> <li><code>updated_at:{&gt;=|&lt;=}2013-02-21T00:00:00Z</code> for date range queries</li> <li><code>unmentioned_in_upload:upload_id</code> to filter keys unmentioned within upload</li> </ul> Find more examples <a href=\"#overview--usage-examples\">here</a>. Please note: If <code>tags</code> are added to filter the search, the search will be limited to a maximum of 65,536 tagged keys.
15
15
  attr_accessor :q
16
16
 
17
17
  # Locale used to determine the translation state of a key when filtering for untranslated or translated keys.
@@ -0,0 +1,313 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class LocaleReport
5
+ attr_accessor :keys_count
6
+
7
+ attr_accessor :translated_translations_percentage
8
+
9
+ attr_accessor :unverified_translations_percentage
10
+
11
+ attr_accessor :reviewed_translations_percentage
12
+
13
+ attr_accessor :untranslated_keys_percentage
14
+
15
+ attr_accessor :completed_translations_count
16
+
17
+ attr_accessor :untranslated_keys_count
18
+
19
+ attr_accessor :unverified_translations_count
20
+
21
+ attr_accessor :reviewed_translations_count
22
+
23
+ attr_accessor :source_word_count
24
+
25
+ attr_accessor :word_count
26
+
27
+ attr_accessor :word_count_unverified
28
+
29
+ attr_accessor :word_count_missing
30
+
31
+ attr_accessor :locale
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'keys_count' => :'keys_count',
37
+ :'translated_translations_percentage' => :'translated_translations_percentage',
38
+ :'unverified_translations_percentage' => :'unverified_translations_percentage',
39
+ :'reviewed_translations_percentage' => :'reviewed_translations_percentage',
40
+ :'untranslated_keys_percentage' => :'untranslated_keys_percentage',
41
+ :'completed_translations_count' => :'completed_translations_count',
42
+ :'untranslated_keys_count' => :'untranslated_keys_count',
43
+ :'unverified_translations_count' => :'unverified_translations_count',
44
+ :'reviewed_translations_count' => :'reviewed_translations_count',
45
+ :'source_word_count' => :'source_word_count',
46
+ :'word_count' => :'word_count',
47
+ :'word_count_unverified' => :'word_count_unverified',
48
+ :'word_count_missing' => :'word_count_missing',
49
+ :'locale' => :'locale'
50
+ }
51
+ end
52
+
53
+ # Attribute type mapping.
54
+ def self.openapi_types
55
+ {
56
+ :'keys_count' => :'Integer',
57
+ :'translated_translations_percentage' => :'Integer',
58
+ :'unverified_translations_percentage' => :'Integer',
59
+ :'reviewed_translations_percentage' => :'Integer',
60
+ :'untranslated_keys_percentage' => :'Integer',
61
+ :'completed_translations_count' => :'Integer',
62
+ :'untranslated_keys_count' => :'Integer',
63
+ :'unverified_translations_count' => :'Integer',
64
+ :'reviewed_translations_count' => :'Integer',
65
+ :'source_word_count' => :'Integer',
66
+ :'word_count' => :'Integer',
67
+ :'word_count_unverified' => :'Integer',
68
+ :'word_count_missing' => :'Integer',
69
+ :'locale' => :'LocalePreview'
70
+ }
71
+ end
72
+
73
+ # List of attributes with nullable: true
74
+ def self.openapi_nullable
75
+ Set.new([
76
+ ])
77
+ end
78
+
79
+ # Initializes the object
80
+ # @param [Hash] attributes Model attributes in the form of hash
81
+ def initialize(attributes = {})
82
+ if (!attributes.is_a?(Hash))
83
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::LocaleReport` initialize method"
84
+ end
85
+
86
+ # check to see if the attribute exists and convert string to symbol for hash key
87
+ attributes = attributes.each_with_object({}) { |(k, v), h|
88
+ if (!self.class.attribute_map.key?(k.to_sym))
89
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::LocaleReport`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
90
+ end
91
+ h[k.to_sym] = v
92
+ }
93
+
94
+ if attributes.key?(:'keys_count')
95
+ self.keys_count = attributes[:'keys_count']
96
+ end
97
+
98
+ if attributes.key?(:'translated_translations_percentage')
99
+ self.translated_translations_percentage = attributes[:'translated_translations_percentage']
100
+ end
101
+
102
+ if attributes.key?(:'unverified_translations_percentage')
103
+ self.unverified_translations_percentage = attributes[:'unverified_translations_percentage']
104
+ end
105
+
106
+ if attributes.key?(:'reviewed_translations_percentage')
107
+ self.reviewed_translations_percentage = attributes[:'reviewed_translations_percentage']
108
+ end
109
+
110
+ if attributes.key?(:'untranslated_keys_percentage')
111
+ self.untranslated_keys_percentage = attributes[:'untranslated_keys_percentage']
112
+ end
113
+
114
+ if attributes.key?(:'completed_translations_count')
115
+ self.completed_translations_count = attributes[:'completed_translations_count']
116
+ end
117
+
118
+ if attributes.key?(:'untranslated_keys_count')
119
+ self.untranslated_keys_count = attributes[:'untranslated_keys_count']
120
+ end
121
+
122
+ if attributes.key?(:'unverified_translations_count')
123
+ self.unverified_translations_count = attributes[:'unverified_translations_count']
124
+ end
125
+
126
+ if attributes.key?(:'reviewed_translations_count')
127
+ self.reviewed_translations_count = attributes[:'reviewed_translations_count']
128
+ end
129
+
130
+ if attributes.key?(:'source_word_count')
131
+ self.source_word_count = attributes[:'source_word_count']
132
+ end
133
+
134
+ if attributes.key?(:'word_count')
135
+ self.word_count = attributes[:'word_count']
136
+ end
137
+
138
+ if attributes.key?(:'word_count_unverified')
139
+ self.word_count_unverified = attributes[:'word_count_unverified']
140
+ end
141
+
142
+ if attributes.key?(:'word_count_missing')
143
+ self.word_count_missing = attributes[:'word_count_missing']
144
+ end
145
+
146
+ if attributes.key?(:'locale')
147
+ self.locale = attributes[:'locale']
148
+ end
149
+ end
150
+
151
+ # Show invalid properties with the reasons. Usually used together with valid?
152
+ # @return Array for valid properties with the reasons
153
+ def list_invalid_properties
154
+ invalid_properties = Array.new
155
+ invalid_properties
156
+ end
157
+
158
+ # Check to see if the all the properties in the model are valid
159
+ # @return true if the model is valid
160
+ def valid?
161
+ true
162
+ end
163
+
164
+ # Checks equality by comparing each attribute.
165
+ # @param [Object] Object to be compared
166
+ def ==(o)
167
+ return true if self.equal?(o)
168
+ self.class == o.class &&
169
+ keys_count == o.keys_count &&
170
+ translated_translations_percentage == o.translated_translations_percentage &&
171
+ unverified_translations_percentage == o.unverified_translations_percentage &&
172
+ reviewed_translations_percentage == o.reviewed_translations_percentage &&
173
+ untranslated_keys_percentage == o.untranslated_keys_percentage &&
174
+ completed_translations_count == o.completed_translations_count &&
175
+ untranslated_keys_count == o.untranslated_keys_count &&
176
+ unverified_translations_count == o.unverified_translations_count &&
177
+ reviewed_translations_count == o.reviewed_translations_count &&
178
+ source_word_count == o.source_word_count &&
179
+ word_count == o.word_count &&
180
+ word_count_unverified == o.word_count_unverified &&
181
+ word_count_missing == o.word_count_missing &&
182
+ locale == o.locale
183
+ end
184
+
185
+ # @see the `==` method
186
+ # @param [Object] Object to be compared
187
+ def eql?(o)
188
+ self == o
189
+ end
190
+
191
+ # Calculates hash code according to all attributes.
192
+ # @return [Integer] Hash code
193
+ def hash
194
+ [keys_count, translated_translations_percentage, unverified_translations_percentage, reviewed_translations_percentage, untranslated_keys_percentage, completed_translations_count, untranslated_keys_count, unverified_translations_count, reviewed_translations_count, source_word_count, word_count, word_count_unverified, word_count_missing, locale].hash
195
+ end
196
+
197
+ # Builds the object from hash
198
+ # @param [Hash] attributes Model attributes in the form of hash
199
+ # @return [Object] Returns the model itself
200
+ def self.build_from_hash(attributes)
201
+ new.build_from_hash(attributes)
202
+ end
203
+
204
+ # Builds the object from hash
205
+ # @param [Hash] attributes Model attributes in the form of hash
206
+ # @return [Object] Returns the model itself
207
+ def build_from_hash(attributes)
208
+ return nil unless attributes.is_a?(Hash)
209
+ self.class.openapi_types.each_pair do |key, type|
210
+ if type =~ /\AArray<(.*)>/i
211
+ # check to ensure the input is an array given that the attribute
212
+ # is documented as an array but the input is not
213
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
214
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
215
+ end
216
+ elsif !attributes[self.class.attribute_map[key]].nil?
217
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
218
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
219
+ end
220
+
221
+ self
222
+ end
223
+
224
+ # Deserializes the data based on type
225
+ # @param string type Data type
226
+ # @param string value Value to be deserialized
227
+ # @return [Object] Deserialized data
228
+ def _deserialize(type, value)
229
+ case type.to_sym
230
+ when :DateTime
231
+ DateTime.parse(value)
232
+ when :Date
233
+ Date.parse(value)
234
+ when :Time
235
+ Time.parse(value)
236
+ when :String
237
+ value.to_s
238
+ when :Integer
239
+ value.to_i
240
+ when :Float
241
+ value.to_f
242
+ when :Boolean
243
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
244
+ true
245
+ else
246
+ false
247
+ end
248
+ when :Object
249
+ # generic object (usually a Hash), return directly
250
+ value
251
+ when /\AArray<(?<inner_type>.+)>\z/
252
+ inner_type = Regexp.last_match[:inner_type]
253
+ value.map { |v| _deserialize(inner_type, v) }
254
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
255
+ k_type = Regexp.last_match[:k_type]
256
+ v_type = Regexp.last_match[:v_type]
257
+ {}.tap do |hash|
258
+ value.each do |k, v|
259
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
260
+ end
261
+ end
262
+ else # model
263
+ Phrase.const_get(type).build_from_hash(value)
264
+ end
265
+ end
266
+
267
+ # Returns the string representation of the object
268
+ # @return [String] String presentation of the object
269
+ def to_s
270
+ to_hash.to_s
271
+ end
272
+
273
+ # to_body is an alias to to_hash (backward compatibility)
274
+ # @return [Hash] Returns the object in the form of hash
275
+ def to_body
276
+ to_hash
277
+ end
278
+
279
+ # Returns the object in the form of hash
280
+ # @return [Hash] Returns the object in the form of hash
281
+ def to_hash
282
+ hash = {}
283
+ self.class.attribute_map.each_pair do |attr, param|
284
+ value = self.send(attr)
285
+ if value.nil?
286
+ is_nullable = self.class.openapi_nullable.include?(attr)
287
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
288
+ end
289
+
290
+ hash[param] = _to_hash(value)
291
+ end
292
+ hash
293
+ end
294
+
295
+ # Outputs non-array value in the form of hash
296
+ # For object, use to_hash. Otherwise, just return the value
297
+ # @param [Object] value Any valid value
298
+ # @return [Hash] Returns the value in the form of hash
299
+ def _to_hash(value)
300
+ if value.is_a?(Array)
301
+ value.compact.map { |v| _to_hash(v) }
302
+ elsif value.is_a?(Hash)
303
+ {}.tap do |hash|
304
+ value.each { |k, v| hash[k] = _to_hash(v) }
305
+ end
306
+ elsif value.respond_to? :to_hash
307
+ value.to_hash
308
+ else
309
+ value
310
+ end
311
+ end
312
+ end
313
+ end