phrase 2.2.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +20 -3
  3. data/docs/AccountsApi.md +8 -2
  4. data/docs/AuthorizationsApi.md +20 -5
  5. data/docs/BitbucketSyncApi.md +12 -3
  6. data/docs/BlacklistedKeysApi.md +20 -5
  7. data/docs/BranchesApi.md +28 -7
  8. data/docs/CommentsApi.md +32 -8
  9. data/docs/Distribution.md +2 -0
  10. data/docs/DistributionCreateParameters.md +2 -0
  11. data/docs/DistributionUpdateParameters.md +2 -0
  12. data/docs/DistributionsApi.md +20 -5
  13. data/docs/DocumentsApi.md +8 -2
  14. data/docs/FormatsApi.md +4 -1
  15. data/docs/GitHubSyncApi.md +8 -2
  16. data/docs/GitLabSyncApi.md +28 -7
  17. data/docs/GlossariesApi.md +20 -5
  18. data/docs/GlossaryTermTranslationsApi.md +12 -3
  19. data/docs/GlossaryTermsApi.md +20 -5
  20. data/docs/ICUApi.md +73 -0
  21. data/docs/Icu.md +17 -0
  22. data/docs/IcuSkeletonParameters.md +21 -0
  23. data/docs/InvitationCreateParameters.md +2 -0
  24. data/docs/InvitationUpdateParameters.md +2 -0
  25. data/docs/InvitationsApi.md +28 -7
  26. data/docs/JobLocaleCompleteReviewParameters.md +17 -0
  27. data/docs/JobLocaleUpdateParameters.md +3 -1
  28. data/docs/JobLocalesApi.md +99 -7
  29. data/docs/JobLocalesCreateParameters.md +4 -2
  30. data/docs/JobTemplateLocalesApi.md +20 -5
  31. data/docs/JobTemplatesApi.md +20 -5
  32. data/docs/JobsApi.md +44 -11
  33. data/docs/KeysApi.md +44 -11
  34. data/docs/LocalesApi.md +35 -10
  35. data/docs/Member.md +6 -0
  36. data/docs/MembersApi.md +20 -5
  37. data/docs/NotificationGroupsApi.md +12 -3
  38. data/docs/NotificationsApi.md +12 -3
  39. data/docs/OrdersApi.md +20 -5
  40. data/docs/Project.md +2 -0
  41. data/docs/ProjectDetails.md +2 -0
  42. data/docs/ProjectsApi.md +20 -5
  43. data/docs/ReleaseCreateParameters.md +2 -0
  44. data/docs/ReleasesApi.md +24 -6
  45. data/docs/ScreenshotMarkersApi.md +20 -5
  46. data/docs/ScreenshotsApi.md +20 -5
  47. data/docs/SearchApi.md +4 -1
  48. data/docs/SpacesApi.md +32 -8
  49. data/docs/StyleGuidesApi.md +20 -5
  50. data/docs/TagsApi.md +16 -4
  51. data/docs/Team1.md +23 -0
  52. data/docs/TeamsApi.md +44 -11
  53. data/docs/TranslationsApi.md +68 -17
  54. data/docs/TranslationsVerifyParameters.md +3 -5
  55. data/docs/UploadsApi.md +12 -3
  56. data/docs/UserPreview.md +3 -1
  57. data/docs/UsersApi.md +4 -1
  58. data/docs/VariablesApi.md +20 -5
  59. data/docs/VersionsHistoryApi.md +8 -2
  60. data/docs/WebhooksApi.md +24 -6
  61. data/lib/phrase/api/accounts_api.rb +2 -2
  62. data/lib/phrase/api/authorizations_api.rb +5 -5
  63. data/lib/phrase/api/bitbucket_sync_api.rb +3 -3
  64. data/lib/phrase/api/blacklisted_keys_api.rb +5 -5
  65. data/lib/phrase/api/branches_api.rb +7 -7
  66. data/lib/phrase/api/comments_api.rb +8 -8
  67. data/lib/phrase/api/distributions_api.rb +5 -5
  68. data/lib/phrase/api/documents_api.rb +2 -2
  69. data/lib/phrase/api/formats_api.rb +1 -1
  70. data/lib/phrase/api/git_hub_sync_api.rb +2 -2
  71. data/lib/phrase/api/git_lab_sync_api.rb +7 -7
  72. data/lib/phrase/api/glossaries_api.rb +5 -5
  73. data/lib/phrase/api/glossary_term_translations_api.rb +3 -3
  74. data/lib/phrase/api/glossary_terms_api.rb +5 -5
  75. data/lib/phrase/api/icu_api.rb +78 -0
  76. data/lib/phrase/api/invitations_api.rb +7 -7
  77. data/lib/phrase/api/job_locales_api.rb +93 -7
  78. data/lib/phrase/api/job_template_locales_api.rb +5 -5
  79. data/lib/phrase/api/job_templates_api.rb +5 -5
  80. data/lib/phrase/api/jobs_api.rb +11 -11
  81. data/lib/phrase/api/keys_api.rb +11 -11
  82. data/lib/phrase/api/locales_api.rb +20 -11
  83. data/lib/phrase/api/members_api.rb +5 -5
  84. data/lib/phrase/api/notification_groups_api.rb +3 -3
  85. data/lib/phrase/api/notifications_api.rb +3 -3
  86. data/lib/phrase/api/orders_api.rb +5 -5
  87. data/lib/phrase/api/projects_api.rb +5 -5
  88. data/lib/phrase/api/releases_api.rb +6 -6
  89. data/lib/phrase/api/screenshot_markers_api.rb +5 -5
  90. data/lib/phrase/api/screenshots_api.rb +5 -5
  91. data/lib/phrase/api/search_api.rb +1 -1
  92. data/lib/phrase/api/spaces_api.rb +8 -8
  93. data/lib/phrase/api/style_guides_api.rb +5 -5
  94. data/lib/phrase/api/tags_api.rb +4 -4
  95. data/lib/phrase/api/teams_api.rb +11 -11
  96. data/lib/phrase/api/translations_api.rb +17 -17
  97. data/lib/phrase/api/uploads_api.rb +3 -3
  98. data/lib/phrase/api/users_api.rb +1 -1
  99. data/lib/phrase/api/variables_api.rb +5 -5
  100. data/lib/phrase/api/versions_history_api.rb +2 -2
  101. data/lib/phrase/api/webhooks_api.rb +6 -6
  102. data/lib/phrase/configuration.rb +8 -0
  103. data/lib/phrase/models/distribution.rb +12 -1
  104. data/lib/phrase/models/distribution_create_parameters.rb +13 -1
  105. data/lib/phrase/models/distribution_update_parameters.rb +13 -1
  106. data/lib/phrase/models/icu.rb +195 -0
  107. data/lib/phrase/models/icu_skeleton_parameters.rb +217 -0
  108. data/lib/phrase/models/invitation_create_parameters.rb +13 -1
  109. data/lib/phrase/models/invitation_update_parameters.rb +13 -1
  110. data/lib/phrase/models/job_locale_complete_review_parameters.rb +195 -0
  111. data/lib/phrase/models/job_locale_update_parameters.rb +16 -4
  112. data/lib/phrase/models/job_locales_create_parameters.rb +17 -5
  113. data/lib/phrase/models/member.rb +30 -1
  114. data/lib/phrase/models/project.rb +10 -1
  115. data/lib/phrase/models/project_details.rb +10 -1
  116. data/lib/phrase/models/release_create_parameters.rb +13 -1
  117. data/lib/phrase/models/team1.rb +221 -0
  118. data/lib/phrase/models/translations_verify_parameters.rb +14 -24
  119. data/lib/phrase/models/user_preview.rb +13 -4
  120. data/lib/phrase/response.rb +1 -1
  121. data/lib/phrase/version.rb +1 -1
  122. data/lib/phrase.rb +5 -0
  123. data/phrase.gemspec +2 -2
  124. data/spec/api/icu_api_spec.rb +36 -0
  125. data/spec/api/job_locales_api_spec.rb +16 -0
  126. data/spec/api/locales_api_spec.rb +2 -0
  127. data/spec/models/distribution_create_parameters_spec.rb +6 -0
  128. data/spec/models/distribution_spec.rb +6 -0
  129. data/spec/models/distribution_update_parameters_spec.rb +6 -0
  130. data/spec/models/icu_skeleton_parameters_spec.rb +41 -0
  131. data/spec/models/icu_spec.rb +29 -0
  132. data/spec/models/invitation_create_parameters_spec.rb +6 -0
  133. data/spec/models/invitation_update_parameters_spec.rb +6 -0
  134. data/spec/models/job_locale_complete_review_parameters_spec.rb +29 -0
  135. data/spec/models/job_locale_update_parameters_spec.rb +6 -0
  136. data/spec/models/job_locales_create_parameters_spec.rb +6 -0
  137. data/spec/models/member_spec.rb +18 -0
  138. data/spec/models/project_details_spec.rb +6 -0
  139. data/spec/models/project_spec.rb +6 -0
  140. data/spec/models/release_create_parameters_spec.rb +6 -0
  141. data/spec/models/team1_spec.rb +47 -0
  142. data/spec/models/translations_verify_parameters_spec.rb +2 -8
  143. data/spec/models/user_preview_spec.rb +6 -0
  144. metadata +214 -194
@@ -62,7 +62,7 @@ module Phrase
62
62
  return_type = opts[:return_type] || 'Variable'
63
63
 
64
64
  # auth_names
65
- auth_names = opts[:auth_names] || ['Basic', 'Token']
65
+ auth_names = opts[:auth_names] || ['Basic', 'Token', 'bearerAuth']
66
66
 
67
67
  new_options = opts.merge(
68
68
  :header_params => header_params,
@@ -132,7 +132,7 @@ module Phrase
132
132
  return_type = opts[:return_type]
133
133
 
134
134
  # auth_names
135
- auth_names = opts[:auth_names] || ['Basic', 'Token']
135
+ auth_names = opts[:auth_names] || ['Basic', 'Token', 'bearerAuth']
136
136
 
137
137
  new_options = opts.merge(
138
138
  :header_params => header_params,
@@ -204,7 +204,7 @@ module Phrase
204
204
  return_type = opts[:return_type] || 'Variable'
205
205
 
206
206
  # auth_names
207
- auth_names = opts[:auth_names] || ['Basic', 'Token']
207
+ auth_names = opts[:auth_names] || ['Basic', 'Token', 'bearerAuth']
208
208
 
209
209
  new_options = opts.merge(
210
210
  :header_params => header_params,
@@ -284,7 +284,7 @@ module Phrase
284
284
  return_type = opts[:return_type] || 'Variable'
285
285
 
286
286
  # auth_names
287
- auth_names = opts[:auth_names] || ['Basic', 'Token']
287
+ auth_names = opts[:auth_names] || ['Basic', 'Token', 'bearerAuth']
288
288
 
289
289
  new_options = opts.merge(
290
290
  :header_params => header_params,
@@ -356,7 +356,7 @@ module Phrase
356
356
  return_type = opts[:return_type] || 'Array<Variable>'
357
357
 
358
358
  # auth_names
359
- auth_names = opts[:auth_names] || ['Basic', 'Token']
359
+ auth_names = opts[:auth_names] || ['Basic', 'Token', 'bearerAuth']
360
360
 
361
361
  new_options = opts.merge(
362
362
  :header_params => header_params,
@@ -69,7 +69,7 @@ module Phrase
69
69
  return_type = opts[:return_type] || 'TranslationVersionWithUser'
70
70
 
71
71
  # auth_names
72
- auth_names = opts[:auth_names] || ['Basic', 'Token']
72
+ auth_names = opts[:auth_names] || ['Basic', 'Token', 'bearerAuth']
73
73
 
74
74
  new_options = opts.merge(
75
75
  :header_params => header_params,
@@ -150,7 +150,7 @@ module Phrase
150
150
  return_type = opts[:return_type] || 'Array<TranslationVersion>'
151
151
 
152
152
  # auth_names
153
- auth_names = opts[:auth_names] || ['Basic', 'Token']
153
+ auth_names = opts[:auth_names] || ['Basic', 'Token', 'bearerAuth']
154
154
 
155
155
  new_options = opts.merge(
156
156
  :header_params => header_params,
@@ -62,7 +62,7 @@ module Phrase
62
62
  return_type = opts[:return_type] || 'Webhook'
63
63
 
64
64
  # auth_names
65
- auth_names = opts[:auth_names] || ['Basic', 'Token']
65
+ auth_names = opts[:auth_names] || ['Basic', 'Token', 'bearerAuth']
66
66
 
67
67
  new_options = opts.merge(
68
68
  :header_params => header_params,
@@ -132,7 +132,7 @@ module Phrase
132
132
  return_type = opts[:return_type]
133
133
 
134
134
  # auth_names
135
- auth_names = opts[:auth_names] || ['Basic', 'Token']
135
+ auth_names = opts[:auth_names] || ['Basic', 'Token', 'bearerAuth']
136
136
 
137
137
  new_options = opts.merge(
138
138
  :header_params => header_params,
@@ -204,7 +204,7 @@ module Phrase
204
204
  return_type = opts[:return_type] || 'Webhook'
205
205
 
206
206
  # auth_names
207
- auth_names = opts[:auth_names] || ['Basic', 'Token']
207
+ auth_names = opts[:auth_names] || ['Basic', 'Token', 'bearerAuth']
208
208
 
209
209
  new_options = opts.merge(
210
210
  :header_params => header_params,
@@ -274,7 +274,7 @@ module Phrase
274
274
  return_type = opts[:return_type]
275
275
 
276
276
  # auth_names
277
- auth_names = opts[:auth_names] || ['Basic', 'Token']
277
+ auth_names = opts[:auth_names] || ['Basic', 'Token', 'bearerAuth']
278
278
 
279
279
  new_options = opts.merge(
280
280
  :header_params => header_params,
@@ -354,7 +354,7 @@ module Phrase
354
354
  return_type = opts[:return_type] || 'Webhook'
355
355
 
356
356
  # auth_names
357
- auth_names = opts[:auth_names] || ['Basic', 'Token']
357
+ auth_names = opts[:auth_names] || ['Basic', 'Token', 'bearerAuth']
358
358
 
359
359
  new_options = opts.merge(
360
360
  :header_params => header_params,
@@ -426,7 +426,7 @@ module Phrase
426
426
  return_type = opts[:return_type] || 'Array<Webhook>'
427
427
 
428
428
  # auth_names
429
- auth_names = opts[:auth_names] || ['Basic', 'Token']
429
+ auth_names = opts[:auth_names] || ['Basic', 'Token', 'bearerAuth']
430
430
 
431
431
  new_options = opts.merge(
432
432
  :header_params => header_params,
@@ -195,6 +195,14 @@ module Phrase
195
195
  key: 'Authorization',
196
196
  value: api_key_with_prefix('Authorization')
197
197
  },
198
+ 'bearerAuth' =>
199
+ {
200
+ type: 'bearer',
201
+ in: 'header',
202
+ format: 'JWT',
203
+ key: 'Authorization',
204
+ value: "Bearer #{access_token}"
205
+ },
198
206
  }
199
207
  end
200
208
 
@@ -10,6 +10,8 @@ module Phrase
10
10
 
11
11
  attr_accessor :platforms
12
12
 
13
+ attr_accessor :locales
14
+
13
15
  attr_accessor :releases
14
16
 
15
17
  attr_accessor :created_at
@@ -23,6 +25,7 @@ module Phrase
23
25
  :'name' => :'name',
24
26
  :'project' => :'project',
25
27
  :'platforms' => :'platforms',
28
+ :'locales' => :'locales',
26
29
  :'releases' => :'releases',
27
30
  :'created_at' => :'created_at',
28
31
  :'deleted_at' => :'deleted_at'
@@ -36,6 +39,7 @@ module Phrase
36
39
  :'name' => :'String',
37
40
  :'project' => :'ProjectShort',
38
41
  :'platforms' => :'Array<String>',
42
+ :'locales' => :'Array<LocalePreview>',
39
43
  :'releases' => :'Array<ReleasePreview>',
40
44
  :'created_at' => :'DateTime',
41
45
  :'deleted_at' => :'DateTime'
@@ -81,6 +85,12 @@ module Phrase
81
85
  end
82
86
  end
83
87
 
88
+ if attributes.key?(:'locales')
89
+ if (value = attributes[:'locales']).is_a?(Array)
90
+ self.locales = value
91
+ end
92
+ end
93
+
84
94
  if attributes.key?(:'releases')
85
95
  if (value = attributes[:'releases']).is_a?(Array)
86
96
  self.releases = value
@@ -118,6 +128,7 @@ module Phrase
118
128
  name == o.name &&
119
129
  project == o.project &&
120
130
  platforms == o.platforms &&
131
+ locales == o.locales &&
121
132
  releases == o.releases &&
122
133
  created_at == o.created_at &&
123
134
  deleted_at == o.deleted_at
@@ -132,7 +143,7 @@ module Phrase
132
143
  # Calculates hash code according to all attributes.
133
144
  # @return [Integer] Hash code
134
145
  def hash
135
- [id, name, project, platforms, releases, created_at, deleted_at].hash
146
+ [id, name, project, platforms, locales, releases, created_at, deleted_at].hash
136
147
  end
137
148
 
138
149
  # Builds the object from hash
@@ -11,6 +11,9 @@ module Phrase
11
11
  # List of platforms the distribution should support.
12
12
  attr_accessor :platforms
13
13
 
14
+ # List of locale ids that will be part of distribution releases
15
+ attr_accessor :locale_ids
16
+
14
17
  # Additional formatting and render options. Only <code>enclose_in_cdata</code> is available for platform <code>android</code>.
15
18
  attr_accessor :format_options
16
19
 
@@ -29,6 +32,7 @@ module Phrase
29
32
  :'name' => :'name',
30
33
  :'project_id' => :'project_id',
31
34
  :'platforms' => :'platforms',
35
+ :'locale_ids' => :'locale_ids',
32
36
  :'format_options' => :'format_options',
33
37
  :'fallback_to_non_regional_locale' => :'fallback_to_non_regional_locale',
34
38
  :'fallback_to_default_locale' => :'fallback_to_default_locale',
@@ -42,6 +46,7 @@ module Phrase
42
46
  :'name' => :'String',
43
47
  :'project_id' => :'String',
44
48
  :'platforms' => :'Array<String>',
49
+ :'locale_ids' => :'Array<String>',
45
50
  :'format_options' => :'Hash<String, String>',
46
51
  :'fallback_to_non_regional_locale' => :'Boolean',
47
52
  :'fallback_to_default_locale' => :'Boolean',
@@ -84,6 +89,12 @@ module Phrase
84
89
  end
85
90
  end
86
91
 
92
+ if attributes.key?(:'locale_ids')
93
+ if (value = attributes[:'locale_ids']).is_a?(Array)
94
+ self.locale_ids = value
95
+ end
96
+ end
97
+
87
98
  if attributes.key?(:'format_options')
88
99
  if (value = attributes[:'format_options']).is_a?(Hash)
89
100
  self.format_options = value
@@ -124,6 +135,7 @@ module Phrase
124
135
  name == o.name &&
125
136
  project_id == o.project_id &&
126
137
  platforms == o.platforms &&
138
+ locale_ids == o.locale_ids &&
127
139
  format_options == o.format_options &&
128
140
  fallback_to_non_regional_locale == o.fallback_to_non_regional_locale &&
129
141
  fallback_to_default_locale == o.fallback_to_default_locale &&
@@ -139,7 +151,7 @@ module Phrase
139
151
  # Calculates hash code according to all attributes.
140
152
  # @return [Integer] Hash code
141
153
  def hash
142
- [name, project_id, platforms, format_options, fallback_to_non_regional_locale, fallback_to_default_locale, use_last_reviewed_version].hash
154
+ [name, project_id, platforms, locale_ids, format_options, fallback_to_non_regional_locale, fallback_to_default_locale, use_last_reviewed_version].hash
143
155
  end
144
156
 
145
157
  # Builds the object from hash
@@ -11,6 +11,9 @@ module Phrase
11
11
  # List of platforms the distribution should support.
12
12
  attr_accessor :platforms
13
13
 
14
+ # List of locale ids that will be part of distribution releases
15
+ attr_accessor :locale_ids
16
+
14
17
  # Additional formatting and render options. Only <code>enclose_in_cdata</code> is available for platform <code>android</code>.
15
18
  attr_accessor :format_options
16
19
 
@@ -29,6 +32,7 @@ module Phrase
29
32
  :'name' => :'name',
30
33
  :'project_id' => :'project_id',
31
34
  :'platforms' => :'platforms',
35
+ :'locale_ids' => :'locale_ids',
32
36
  :'format_options' => :'format_options',
33
37
  :'fallback_to_non_regional_locale' => :'fallback_to_non_regional_locale',
34
38
  :'fallback_to_default_locale' => :'fallback_to_default_locale',
@@ -42,6 +46,7 @@ module Phrase
42
46
  :'name' => :'String',
43
47
  :'project_id' => :'String',
44
48
  :'platforms' => :'Array<String>',
49
+ :'locale_ids' => :'Array<String>',
45
50
  :'format_options' => :'Hash<String, String>',
46
51
  :'fallback_to_non_regional_locale' => :'Boolean',
47
52
  :'fallback_to_default_locale' => :'Boolean',
@@ -84,6 +89,12 @@ module Phrase
84
89
  end
85
90
  end
86
91
 
92
+ if attributes.key?(:'locale_ids')
93
+ if (value = attributes[:'locale_ids']).is_a?(Array)
94
+ self.locale_ids = value
95
+ end
96
+ end
97
+
87
98
  if attributes.key?(:'format_options')
88
99
  if (value = attributes[:'format_options']).is_a?(Hash)
89
100
  self.format_options = value
@@ -124,6 +135,7 @@ module Phrase
124
135
  name == o.name &&
125
136
  project_id == o.project_id &&
126
137
  platforms == o.platforms &&
138
+ locale_ids == o.locale_ids &&
127
139
  format_options == o.format_options &&
128
140
  fallback_to_non_regional_locale == o.fallback_to_non_regional_locale &&
129
141
  fallback_to_default_locale == o.fallback_to_default_locale &&
@@ -139,7 +151,7 @@ module Phrase
139
151
  # Calculates hash code according to all attributes.
140
152
  # @return [Integer] Hash code
141
153
  def hash
142
- [name, project_id, platforms, format_options, fallback_to_non_regional_locale, fallback_to_default_locale, use_last_reviewed_version].hash
154
+ [name, project_id, platforms, locale_ids, format_options, fallback_to_non_regional_locale, fallback_to_default_locale, use_last_reviewed_version].hash
143
155
  end
144
156
 
145
157
  # Builds the object from hash
@@ -0,0 +1,195 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class Icu
5
+ # Object keys are dynamic and based on requested locale codes, see example.
6
+ attr_accessor :locale_code
7
+
8
+ # Attribute mapping from ruby-style variable name to JSON key.
9
+ def self.attribute_map
10
+ {
11
+ :'locale_code' => :'locale_code'
12
+ }
13
+ end
14
+
15
+ # Attribute type mapping.
16
+ def self.openapi_types
17
+ {
18
+ :'locale_code' => :'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::Icu` 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::Icu`. 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?(:'locale_code')
44
+ self.locale_code = attributes[:'locale_code']
45
+ end
46
+ end
47
+
48
+ # Show invalid properties with the reasons. Usually used together with valid?
49
+ # @return Array for valid properties with the reasons
50
+ def list_invalid_properties
51
+ invalid_properties = Array.new
52
+ invalid_properties
53
+ end
54
+
55
+ # Check to see if the all the properties in the model are valid
56
+ # @return true if the model is valid
57
+ def valid?
58
+ true
59
+ end
60
+
61
+ # Checks equality by comparing each attribute.
62
+ # @param [Object] Object to be compared
63
+ def ==(o)
64
+ return true if self.equal?(o)
65
+ self.class == o.class &&
66
+ locale_code == o.locale_code
67
+ end
68
+
69
+ # @see the `==` method
70
+ # @param [Object] Object to be compared
71
+ def eql?(o)
72
+ self == o
73
+ end
74
+
75
+ # Calculates hash code according to all attributes.
76
+ # @return [Integer] Hash code
77
+ def hash
78
+ [locale_code].hash
79
+ end
80
+
81
+ # Builds the object from hash
82
+ # @param [Hash] attributes Model attributes in the form of hash
83
+ # @return [Object] Returns the model itself
84
+ def self.build_from_hash(attributes)
85
+ new.build_from_hash(attributes)
86
+ end
87
+
88
+ # Builds the object from hash
89
+ # @param [Hash] attributes Model attributes in the form of hash
90
+ # @return [Object] Returns the model itself
91
+ def build_from_hash(attributes)
92
+ return nil unless attributes.is_a?(Hash)
93
+ self.class.openapi_types.each_pair do |key, type|
94
+ if type =~ /\AArray<(.*)>/i
95
+ # check to ensure the input is an array given that the attribute
96
+ # is documented as an array but the input is not
97
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
98
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
99
+ end
100
+ elsif !attributes[self.class.attribute_map[key]].nil?
101
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
102
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
103
+ end
104
+
105
+ self
106
+ end
107
+
108
+ # Deserializes the data based on type
109
+ # @param string type Data type
110
+ # @param string value Value to be deserialized
111
+ # @return [Object] Deserialized data
112
+ def _deserialize(type, value)
113
+ case type.to_sym
114
+ when :DateTime
115
+ DateTime.parse(value)
116
+ when :Date
117
+ Date.parse(value)
118
+ when :String
119
+ value.to_s
120
+ when :Integer
121
+ value.to_i
122
+ when :Float
123
+ value.to_f
124
+ when :Boolean
125
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
126
+ true
127
+ else
128
+ false
129
+ end
130
+ when :Object
131
+ # generic object (usually a Hash), return directly
132
+ value
133
+ when /\AArray<(?<inner_type>.+)>\z/
134
+ inner_type = Regexp.last_match[:inner_type]
135
+ value.map { |v| _deserialize(inner_type, v) }
136
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
137
+ k_type = Regexp.last_match[:k_type]
138
+ v_type = Regexp.last_match[:v_type]
139
+ {}.tap do |hash|
140
+ value.each do |k, v|
141
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
142
+ end
143
+ end
144
+ else # model
145
+ Phrase.const_get(type).build_from_hash(value)
146
+ end
147
+ end
148
+
149
+ # Returns the string representation of the object
150
+ # @return [String] String presentation of the object
151
+ def to_s
152
+ to_hash.to_s
153
+ end
154
+
155
+ # to_body is an alias to to_hash (backward compatibility)
156
+ # @return [Hash] Returns the object in the form of hash
157
+ def to_body
158
+ to_hash
159
+ end
160
+
161
+ # Returns the object in the form of hash
162
+ # @return [Hash] Returns the object in the form of hash
163
+ def to_hash
164
+ hash = {}
165
+ self.class.attribute_map.each_pair do |attr, param|
166
+ value = self.send(attr)
167
+ if value.nil?
168
+ is_nullable = self.class.openapi_nullable.include?(attr)
169
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
170
+ end
171
+
172
+ hash[param] = _to_hash(value)
173
+ end
174
+ hash
175
+ end
176
+
177
+ # Outputs non-array value in the form of hash
178
+ # For object, use to_hash. Otherwise, just return the value
179
+ # @param [Object] value Any valid value
180
+ # @return [Hash] Returns the value in the form of hash
181
+ def _to_hash(value)
182
+ if value.is_a?(Array)
183
+ value.compact.map { |v| _to_hash(v) }
184
+ elsif value.is_a?(Hash)
185
+ {}.tap do |hash|
186
+ value.each { |k, v| hash[k] = _to_hash(v) }
187
+ end
188
+ elsif value.respond_to? :to_hash
189
+ value.to_hash
190
+ else
191
+ value
192
+ end
193
+ end
194
+ end
195
+ end