phrase 4.26.0 → 4.27.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +14 -3
- data/docs/CheckIssue.md +33 -0
- data/docs/ChecksApi.md +146 -0
- data/docs/JobCreateParameters.md +1 -1
- data/docs/KeyCreateParameters.md +1 -1
- data/docs/KeyUpdateParameters.md +1 -1
- data/docs/Locale.md +6 -0
- data/docs/LocaleCreateParameters.md +2 -0
- data/docs/LocaleDetails.md +6 -0
- data/docs/LocaleUpdateParameters.md +2 -0
- data/docs/MachineTranslationApi.md +263 -0
- data/docs/MachineTranslationLocaleProviderMapping.md +21 -0
- data/docs/MachineTranslationLocaleProviderMappingsCreateParameters.md +21 -0
- data/docs/MachineTranslationSettings.md +23 -0
- data/docs/MachineTranslationSettingsUpdateParameters.md +17 -0
- data/docs/ProjectCreateParameters.md +8 -2
- data/docs/ProjectDetails.md +3 -1
- data/docs/ProjectUpdateParameters.md +8 -2
- data/docs/ScreenshotUpdateParameters.md +1 -1
- data/docs/Upload.md +3 -1
- data/docs/UploadsApi.md +4 -4
- data/lib/phrase/api/checks_api.rb +174 -0
- data/lib/phrase/api/machine_translation_api.rb +302 -0
- data/lib/phrase/api/uploads_api.rb +6 -6
- data/lib/phrase/models/check_issue.rb +319 -0
- data/lib/phrase/models/job_create_parameters.rb +1 -1
- data/lib/phrase/models/locale.rb +31 -1
- data/lib/phrase/models/locale_create_parameters.rb +11 -1
- data/lib/phrase/models/locale_details.rb +31 -1
- data/lib/phrase/models/locale_update_parameters.rb +11 -1
- data/lib/phrase/models/machine_translation_locale_provider_mapping.rb +217 -0
- data/lib/phrase/models/machine_translation_locale_provider_mappings_create_parameters.rb +232 -0
- data/lib/phrase/models/machine_translation_settings.rb +230 -0
- data/lib/phrase/models/machine_translation_settings_update_parameters.rb +198 -0
- data/lib/phrase/models/project_create_parameters.rb +35 -1
- data/lib/phrase/models/project_details.rb +10 -1
- data/lib/phrase/models/project_update_parameters.rb +35 -1
- data/lib/phrase/models/upload.rb +13 -1
- data/lib/phrase/version.rb +1 -1
- data/lib/phrase.rb +7 -0
- data/spec/api/checks_api_spec.rb +56 -0
- data/spec/api/machine_translation_api_spec.rb +79 -0
- data/spec/models/check_issue_spec.rb +85 -0
- data/spec/models/locale_create_parameters_spec.rb +6 -0
- data/spec/models/locale_details_spec.rb +18 -0
- data/spec/models/locale_spec.rb +18 -0
- data/spec/models/locale_update_parameters_spec.rb +6 -0
- data/spec/models/machine_translation_locale_provider_mapping_spec.rb +41 -0
- data/spec/models/machine_translation_locale_provider_mappings_create_parameters_spec.rb +41 -0
- data/spec/models/machine_translation_settings_spec.rb +47 -0
- data/spec/models/machine_translation_settings_update_parameters_spec.rb +29 -0
- data/spec/models/project_create_parameters_spec.rb +18 -0
- data/spec/models/project_details_spec.rb +6 -0
- data/spec/models/project_update_parameters_spec.rb +18 -0
- data/spec/models/upload_spec.rb +6 -0
- metadata +292 -264
data/lib/phrase/models/locale.rb
CHANGED
|
@@ -24,6 +24,15 @@ module Phrase
|
|
|
24
24
|
|
|
25
25
|
attr_accessor :language_ai_profile
|
|
26
26
|
|
|
27
|
+
# Indicates that new translations for this locale are marked as unverified. Only applies to locales using the basic verification workflow. Part of the [Advanced Workflows](https://support.phrase.com/hc/en-us/articles/5784094755484) feature.
|
|
28
|
+
attr_accessor :unverify_new_translations
|
|
29
|
+
|
|
30
|
+
# Indicates that updated translations for this locale are marked as unverified. Only applies to locales using the basic verification workflow. Part of the [Advanced Workflows](https://support.phrase.com/hc/en-us/articles/5784094755484) feature.
|
|
31
|
+
attr_accessor :unverify_updated_translations
|
|
32
|
+
|
|
33
|
+
# Indicates that translations for this locale are marked as unverified when the source language has been changed.
|
|
34
|
+
attr_accessor :unverify_on_source_changes
|
|
35
|
+
|
|
27
36
|
attr_accessor :created_at
|
|
28
37
|
|
|
29
38
|
attr_accessor :updated_at
|
|
@@ -42,6 +51,9 @@ module Phrase
|
|
|
42
51
|
:'source_locale' => :'source_locale',
|
|
43
52
|
:'fallback_locale' => :'fallback_locale',
|
|
44
53
|
:'language_ai_profile' => :'language_ai_profile',
|
|
54
|
+
:'unverify_new_translations' => :'unverify_new_translations',
|
|
55
|
+
:'unverify_updated_translations' => :'unverify_updated_translations',
|
|
56
|
+
:'unverify_on_source_changes' => :'unverify_on_source_changes',
|
|
45
57
|
:'created_at' => :'created_at',
|
|
46
58
|
:'updated_at' => :'updated_at'
|
|
47
59
|
}
|
|
@@ -61,6 +73,9 @@ module Phrase
|
|
|
61
73
|
:'source_locale' => :'LocalePreview',
|
|
62
74
|
:'fallback_locale' => :'LocalePreview',
|
|
63
75
|
:'language_ai_profile' => :'String',
|
|
76
|
+
:'unverify_new_translations' => :'Boolean',
|
|
77
|
+
:'unverify_updated_translations' => :'Boolean',
|
|
78
|
+
:'unverify_on_source_changes' => :'Boolean',
|
|
64
79
|
:'created_at' => :'DateTime',
|
|
65
80
|
:'updated_at' => :'DateTime'
|
|
66
81
|
}
|
|
@@ -135,6 +150,18 @@ module Phrase
|
|
|
135
150
|
self.language_ai_profile = attributes[:'language_ai_profile']
|
|
136
151
|
end
|
|
137
152
|
|
|
153
|
+
if attributes.key?(:'unverify_new_translations')
|
|
154
|
+
self.unverify_new_translations = attributes[:'unverify_new_translations']
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
if attributes.key?(:'unverify_updated_translations')
|
|
158
|
+
self.unverify_updated_translations = attributes[:'unverify_updated_translations']
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
if attributes.key?(:'unverify_on_source_changes')
|
|
162
|
+
self.unverify_on_source_changes = attributes[:'unverify_on_source_changes']
|
|
163
|
+
end
|
|
164
|
+
|
|
138
165
|
if attributes.key?(:'created_at')
|
|
139
166
|
self.created_at = attributes[:'created_at']
|
|
140
167
|
end
|
|
@@ -173,6 +200,9 @@ module Phrase
|
|
|
173
200
|
source_locale == o.source_locale &&
|
|
174
201
|
fallback_locale == o.fallback_locale &&
|
|
175
202
|
language_ai_profile == o.language_ai_profile &&
|
|
203
|
+
unverify_new_translations == o.unverify_new_translations &&
|
|
204
|
+
unverify_updated_translations == o.unverify_updated_translations &&
|
|
205
|
+
unverify_on_source_changes == o.unverify_on_source_changes &&
|
|
176
206
|
created_at == o.created_at &&
|
|
177
207
|
updated_at == o.updated_at
|
|
178
208
|
end
|
|
@@ -186,7 +216,7 @@ module Phrase
|
|
|
186
216
|
# Calculates hash code according to all attributes.
|
|
187
217
|
# @return [Integer] Hash code
|
|
188
218
|
def hash
|
|
189
|
-
[id, name, code, default, main, rtl, plural_forms, ordinal_plural_forms, source_locale, fallback_locale, language_ai_profile, created_at, updated_at].hash
|
|
219
|
+
[id, name, code, default, main, rtl, plural_forms, ordinal_plural_forms, source_locale, fallback_locale, language_ai_profile, unverify_new_translations, unverify_updated_translations, unverify_on_source_changes, created_at, updated_at].hash
|
|
190
220
|
end
|
|
191
221
|
|
|
192
222
|
# Builds the object from hash
|
|
@@ -32,6 +32,9 @@ module Phrase
|
|
|
32
32
|
# Indicates that updated translations for this locale should be marked as unverified. Part of the [Advanced Workflows](https://support.phrase.com/hc/en-us/articles/5784094755484) feature.
|
|
33
33
|
attr_accessor :unverify_updated_translations
|
|
34
34
|
|
|
35
|
+
# Indicates that translations for this locale should be marked as unverified when the source language has been changed.
|
|
36
|
+
attr_accessor :unverify_on_source_changes
|
|
37
|
+
|
|
35
38
|
# If set, translations for this locale will be fetched automatically, right after creation.
|
|
36
39
|
attr_accessor :autotranslate
|
|
37
40
|
|
|
@@ -51,6 +54,7 @@ module Phrase
|
|
|
51
54
|
:'fallback_locale_id' => :'fallback_locale_id',
|
|
52
55
|
:'unverify_new_translations' => :'unverify_new_translations',
|
|
53
56
|
:'unverify_updated_translations' => :'unverify_updated_translations',
|
|
57
|
+
:'unverify_on_source_changes' => :'unverify_on_source_changes',
|
|
54
58
|
:'autotranslate' => :'autotranslate',
|
|
55
59
|
:'language_ai_profile' => :'language_ai_profile'
|
|
56
60
|
}
|
|
@@ -69,6 +73,7 @@ module Phrase
|
|
|
69
73
|
:'fallback_locale_id' => :'String',
|
|
70
74
|
:'unverify_new_translations' => :'Boolean',
|
|
71
75
|
:'unverify_updated_translations' => :'Boolean',
|
|
76
|
+
:'unverify_on_source_changes' => :'Boolean',
|
|
72
77
|
:'autotranslate' => :'Boolean',
|
|
73
78
|
:'language_ai_profile' => :'String'
|
|
74
79
|
}
|
|
@@ -135,6 +140,10 @@ module Phrase
|
|
|
135
140
|
self.unverify_updated_translations = attributes[:'unverify_updated_translations']
|
|
136
141
|
end
|
|
137
142
|
|
|
143
|
+
if attributes.key?(:'unverify_on_source_changes')
|
|
144
|
+
self.unverify_on_source_changes = attributes[:'unverify_on_source_changes']
|
|
145
|
+
end
|
|
146
|
+
|
|
138
147
|
if attributes.key?(:'autotranslate')
|
|
139
148
|
self.autotranslate = attributes[:'autotranslate']
|
|
140
149
|
end
|
|
@@ -182,6 +191,7 @@ module Phrase
|
|
|
182
191
|
fallback_locale_id == o.fallback_locale_id &&
|
|
183
192
|
unverify_new_translations == o.unverify_new_translations &&
|
|
184
193
|
unverify_updated_translations == o.unverify_updated_translations &&
|
|
194
|
+
unverify_on_source_changes == o.unverify_on_source_changes &&
|
|
185
195
|
autotranslate == o.autotranslate &&
|
|
186
196
|
language_ai_profile == o.language_ai_profile
|
|
187
197
|
end
|
|
@@ -195,7 +205,7 @@ module Phrase
|
|
|
195
205
|
# Calculates hash code according to all attributes.
|
|
196
206
|
# @return [Integer] Hash code
|
|
197
207
|
def hash
|
|
198
|
-
[branch, name, code, default, main, rtl, source_locale_id, fallback_locale_id, unverify_new_translations, unverify_updated_translations, autotranslate, language_ai_profile].hash
|
|
208
|
+
[branch, name, code, default, main, rtl, source_locale_id, fallback_locale_id, unverify_new_translations, unverify_updated_translations, unverify_on_source_changes, autotranslate, language_ai_profile].hash
|
|
199
209
|
end
|
|
200
210
|
|
|
201
211
|
# Builds the object from hash
|
|
@@ -24,6 +24,15 @@ module Phrase
|
|
|
24
24
|
|
|
25
25
|
attr_accessor :language_ai_profile
|
|
26
26
|
|
|
27
|
+
# Indicates that new translations for this locale are marked as unverified. Only applies to locales using the basic verification workflow. Part of the [Advanced Workflows](https://support.phrase.com/hc/en-us/articles/5784094755484) feature.
|
|
28
|
+
attr_accessor :unverify_new_translations
|
|
29
|
+
|
|
30
|
+
# Indicates that updated translations for this locale are marked as unverified. Only applies to locales using the basic verification workflow. Part of the [Advanced Workflows](https://support.phrase.com/hc/en-us/articles/5784094755484) feature.
|
|
31
|
+
attr_accessor :unverify_updated_translations
|
|
32
|
+
|
|
33
|
+
# Indicates that translations for this locale are marked as unverified when the source language has been changed.
|
|
34
|
+
attr_accessor :unverify_on_source_changes
|
|
35
|
+
|
|
27
36
|
attr_accessor :created_at
|
|
28
37
|
|
|
29
38
|
attr_accessor :updated_at
|
|
@@ -44,6 +53,9 @@ module Phrase
|
|
|
44
53
|
:'source_locale' => :'source_locale',
|
|
45
54
|
:'fallback_locale' => :'fallback_locale',
|
|
46
55
|
:'language_ai_profile' => :'language_ai_profile',
|
|
56
|
+
:'unverify_new_translations' => :'unverify_new_translations',
|
|
57
|
+
:'unverify_updated_translations' => :'unverify_updated_translations',
|
|
58
|
+
:'unverify_on_source_changes' => :'unverify_on_source_changes',
|
|
47
59
|
:'created_at' => :'created_at',
|
|
48
60
|
:'updated_at' => :'updated_at',
|
|
49
61
|
:'statistics' => :'statistics'
|
|
@@ -64,6 +76,9 @@ module Phrase
|
|
|
64
76
|
:'source_locale' => :'LocalePreview',
|
|
65
77
|
:'fallback_locale' => :'LocalePreview',
|
|
66
78
|
:'language_ai_profile' => :'String',
|
|
79
|
+
:'unverify_new_translations' => :'Boolean',
|
|
80
|
+
:'unverify_updated_translations' => :'Boolean',
|
|
81
|
+
:'unverify_on_source_changes' => :'Boolean',
|
|
67
82
|
:'created_at' => :'DateTime',
|
|
68
83
|
:'updated_at' => :'DateTime',
|
|
69
84
|
:'statistics' => :'LocaleStatistics'
|
|
@@ -146,6 +161,18 @@ module Phrase
|
|
|
146
161
|
self.language_ai_profile = attributes[:'language_ai_profile']
|
|
147
162
|
end
|
|
148
163
|
|
|
164
|
+
if attributes.key?(:'unverify_new_translations')
|
|
165
|
+
self.unverify_new_translations = attributes[:'unverify_new_translations']
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
if attributes.key?(:'unverify_updated_translations')
|
|
169
|
+
self.unverify_updated_translations = attributes[:'unverify_updated_translations']
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
if attributes.key?(:'unverify_on_source_changes')
|
|
173
|
+
self.unverify_on_source_changes = attributes[:'unverify_on_source_changes']
|
|
174
|
+
end
|
|
175
|
+
|
|
149
176
|
if attributes.key?(:'created_at')
|
|
150
177
|
self.created_at = attributes[:'created_at']
|
|
151
178
|
end
|
|
@@ -188,6 +215,9 @@ module Phrase
|
|
|
188
215
|
source_locale == o.source_locale &&
|
|
189
216
|
fallback_locale == o.fallback_locale &&
|
|
190
217
|
language_ai_profile == o.language_ai_profile &&
|
|
218
|
+
unverify_new_translations == o.unverify_new_translations &&
|
|
219
|
+
unverify_updated_translations == o.unverify_updated_translations &&
|
|
220
|
+
unverify_on_source_changes == o.unverify_on_source_changes &&
|
|
191
221
|
created_at == o.created_at &&
|
|
192
222
|
updated_at == o.updated_at &&
|
|
193
223
|
statistics == o.statistics
|
|
@@ -202,7 +232,7 @@ module Phrase
|
|
|
202
232
|
# Calculates hash code according to all attributes.
|
|
203
233
|
# @return [Integer] Hash code
|
|
204
234
|
def hash
|
|
205
|
-
[id, name, code, default, main, rtl, plural_forms, ordinal_plural_forms, source_locale, fallback_locale, language_ai_profile, created_at, updated_at, statistics].hash
|
|
235
|
+
[id, name, code, default, main, rtl, plural_forms, ordinal_plural_forms, source_locale, fallback_locale, language_ai_profile, unverify_new_translations, unverify_updated_translations, unverify_on_source_changes, created_at, updated_at, statistics].hash
|
|
206
236
|
end
|
|
207
237
|
|
|
208
238
|
# Builds the object from hash
|
|
@@ -32,6 +32,9 @@ module Phrase
|
|
|
32
32
|
# Indicates that updated translations for this locale should be marked as unverified. Part of the [Advanced Workflows](https://support.phrase.com/hc/en-us/articles/5784094755484) feature.
|
|
33
33
|
attr_accessor :unverify_updated_translations
|
|
34
34
|
|
|
35
|
+
# Indicates that translations for this locale should be marked as unverified when the source language has been changed.
|
|
36
|
+
attr_accessor :unverify_on_source_changes
|
|
37
|
+
|
|
35
38
|
# If set, translations for this locale will be fetched automatically, right after creation.
|
|
36
39
|
attr_accessor :autotranslate
|
|
37
40
|
|
|
@@ -51,6 +54,7 @@ module Phrase
|
|
|
51
54
|
:'fallback_locale_id' => :'fallback_locale_id',
|
|
52
55
|
:'unverify_new_translations' => :'unverify_new_translations',
|
|
53
56
|
:'unverify_updated_translations' => :'unverify_updated_translations',
|
|
57
|
+
:'unverify_on_source_changes' => :'unverify_on_source_changes',
|
|
54
58
|
:'autotranslate' => :'autotranslate',
|
|
55
59
|
:'language_ai_profile' => :'language_ai_profile'
|
|
56
60
|
}
|
|
@@ -69,6 +73,7 @@ module Phrase
|
|
|
69
73
|
:'fallback_locale_id' => :'String',
|
|
70
74
|
:'unverify_new_translations' => :'Boolean',
|
|
71
75
|
:'unverify_updated_translations' => :'Boolean',
|
|
76
|
+
:'unverify_on_source_changes' => :'Boolean',
|
|
72
77
|
:'autotranslate' => :'Boolean',
|
|
73
78
|
:'language_ai_profile' => :'String'
|
|
74
79
|
}
|
|
@@ -135,6 +140,10 @@ module Phrase
|
|
|
135
140
|
self.unverify_updated_translations = attributes[:'unverify_updated_translations']
|
|
136
141
|
end
|
|
137
142
|
|
|
143
|
+
if attributes.key?(:'unverify_on_source_changes')
|
|
144
|
+
self.unverify_on_source_changes = attributes[:'unverify_on_source_changes']
|
|
145
|
+
end
|
|
146
|
+
|
|
138
147
|
if attributes.key?(:'autotranslate')
|
|
139
148
|
self.autotranslate = attributes[:'autotranslate']
|
|
140
149
|
end
|
|
@@ -172,6 +181,7 @@ module Phrase
|
|
|
172
181
|
fallback_locale_id == o.fallback_locale_id &&
|
|
173
182
|
unverify_new_translations == o.unverify_new_translations &&
|
|
174
183
|
unverify_updated_translations == o.unverify_updated_translations &&
|
|
184
|
+
unverify_on_source_changes == o.unverify_on_source_changes &&
|
|
175
185
|
autotranslate == o.autotranslate &&
|
|
176
186
|
language_ai_profile == o.language_ai_profile
|
|
177
187
|
end
|
|
@@ -185,7 +195,7 @@ module Phrase
|
|
|
185
195
|
# Calculates hash code according to all attributes.
|
|
186
196
|
# @return [Integer] Hash code
|
|
187
197
|
def hash
|
|
188
|
-
[branch, name, code, default, main, rtl, source_locale_id, fallback_locale_id, unverify_new_translations, unverify_updated_translations, autotranslate, language_ai_profile].hash
|
|
198
|
+
[branch, name, code, default, main, rtl, source_locale_id, fallback_locale_id, unverify_new_translations, unverify_updated_translations, unverify_on_source_changes, autotranslate, language_ai_profile].hash
|
|
189
199
|
end
|
|
190
200
|
|
|
191
201
|
# Builds the object from hash
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
require 'date'
|
|
2
|
+
|
|
3
|
+
module Phrase
|
|
4
|
+
class MachineTranslationLocaleProviderMapping
|
|
5
|
+
# The locale code of the source language for this mapping.
|
|
6
|
+
attr_accessor :source_locale_code
|
|
7
|
+
|
|
8
|
+
# The locale code of the target language for this mapping.
|
|
9
|
+
attr_accessor :target_locale_code
|
|
10
|
+
|
|
11
|
+
# The translation service applied when translating from source to target locale.
|
|
12
|
+
attr_accessor :service
|
|
13
|
+
|
|
14
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
15
|
+
def self.attribute_map
|
|
16
|
+
{
|
|
17
|
+
:'source_locale_code' => :'source_locale_code',
|
|
18
|
+
:'target_locale_code' => :'target_locale_code',
|
|
19
|
+
:'service' => :'service'
|
|
20
|
+
}
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Attribute type mapping.
|
|
24
|
+
def self.openapi_types
|
|
25
|
+
{
|
|
26
|
+
:'source_locale_code' => :'String',
|
|
27
|
+
:'target_locale_code' => :'String',
|
|
28
|
+
:'service' => :'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::MachineTranslationLocaleProviderMapping` 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::MachineTranslationLocaleProviderMapping`. 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?(:'source_locale_code')
|
|
54
|
+
self.source_locale_code = attributes[:'source_locale_code']
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
if attributes.key?(:'target_locale_code')
|
|
58
|
+
self.target_locale_code = attributes[:'target_locale_code']
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
if attributes.key?(:'service')
|
|
62
|
+
self.service = attributes[:'service']
|
|
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
|
+
source_locale_code == o.source_locale_code &&
|
|
85
|
+
target_locale_code == o.target_locale_code &&
|
|
86
|
+
service == o.service
|
|
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
|
+
[source_locale_code, target_locale_code, service].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
|