phrase 2.6.0 → 2.7.2

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 (76) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +32 -22
  3. data/docs/BlacklistedKeyCreateParameters.md +1 -1
  4. data/docs/BlacklistedKeyUpdateParameters.md +1 -1
  5. data/docs/BlacklistedKeysApi.md +20 -20
  6. data/docs/DistributionCreateParameters.md +2 -0
  7. data/docs/DistributionUpdateParameters.md +2 -0
  8. data/docs/GlossariesApi.md +20 -20
  9. data/docs/GlossaryTermTranslationsApi.md +12 -12
  10. data/docs/GlossaryTermsApi.md +20 -20
  11. data/docs/Invitation.md +3 -3
  12. data/docs/JobComment.md +29 -0
  13. data/docs/JobCommentCreateParameters.md +17 -0
  14. data/docs/JobCommentUpdateParameters.md +17 -0
  15. data/docs/JobCommentsApi.md +343 -0
  16. data/docs/JobCreateParameters.md +3 -1
  17. data/docs/JobsApi.md +130 -0
  18. data/docs/KeyCreateParameters.md +2 -0
  19. data/docs/Locale.md +2 -0
  20. data/docs/LocaleCreateParameters.md +2 -0
  21. data/docs/LocaleDetails.md +2 -0
  22. data/docs/LocaleUpdateParameters.md +2 -0
  23. data/docs/Member.md +1 -1
  24. data/docs/ScreenshotsApi.md +12 -6
  25. data/docs/StyleguideCreateParameters.md +1 -1
  26. data/docs/StyleguideUpdateParameters.md +1 -1
  27. data/docs/{Team1.md → TeamShort.md} +2 -2
  28. data/docs/VersionsHistoryApi.md +1 -1
  29. data/lib/phrase/api/blacklisted_keys_api.rb +20 -20
  30. data/lib/phrase/api/glossaries_api.rb +20 -20
  31. data/lib/phrase/api/glossary_term_translations_api.rb +12 -12
  32. data/lib/phrase/api/glossary_terms_api.rb +20 -20
  33. data/lib/phrase/api/job_comments_api.rb +411 -0
  34. data/lib/phrase/api/jobs_api.rb +146 -0
  35. data/lib/phrase/api/screenshots_api.rb +17 -11
  36. data/lib/phrase/api/versions_history_api.rb +2 -2
  37. data/lib/phrase/models/blacklisted_key_create_parameters.rb +1 -1
  38. data/lib/phrase/models/blacklisted_key_update_parameters.rb +1 -1
  39. data/lib/phrase/models/distribution_create_parameters.rb +11 -1
  40. data/lib/phrase/models/distribution_update_parameters.rb +11 -1
  41. data/lib/phrase/models/invitation.rb +13 -13
  42. data/lib/phrase/models/job_comment.rb +250 -0
  43. data/lib/phrase/models/job_comment_create_parameters.rb +195 -0
  44. data/lib/phrase/models/job_comment_update_parameters.rb +195 -0
  45. data/lib/phrase/models/job_create_parameters.rb +14 -4
  46. data/lib/phrase/models/key_create_parameters.rb +11 -1
  47. data/lib/phrase/models/locale.rb +10 -1
  48. data/lib/phrase/models/locale_create_parameters.rb +11 -1
  49. data/lib/phrase/models/locale_details.rb +10 -1
  50. data/lib/phrase/models/locale_update_parameters.rb +11 -1
  51. data/lib/phrase/models/member.rb +1 -1
  52. data/lib/phrase/models/{team1.rb → team_short.rb} +3 -3
  53. data/lib/phrase/version.rb +1 -1
  54. data/lib/phrase.rb +5 -1
  55. data/spec/api/blacklisted_keys_api_spec.rb +10 -10
  56. data/spec/api/glossaries_api_spec.rb +10 -10
  57. data/spec/api/glossary_term_translations_api_spec.rb +6 -6
  58. data/spec/api/glossary_terms_api_spec.rb +10 -10
  59. data/spec/api/job_comments_api_spec.rb +101 -0
  60. data/spec/api/jobs_api_spec.rb +30 -0
  61. data/spec/api/screenshots_api_spec.rb +4 -1
  62. data/spec/api/versions_history_api_spec.rb +1 -1
  63. data/spec/models/distribution_create_parameters_spec.rb +6 -0
  64. data/spec/models/distribution_update_parameters_spec.rb +6 -0
  65. data/spec/models/invitation_spec.rb +6 -6
  66. data/spec/models/job_comment_create_parameters_spec.rb +29 -0
  67. data/spec/models/job_comment_spec.rb +65 -0
  68. data/spec/models/job_comment_update_parameters_spec.rb +29 -0
  69. data/spec/models/job_create_parameters_spec.rb +6 -0
  70. data/spec/models/key_create_parameters_spec.rb +6 -0
  71. data/spec/models/locale_create_parameters_spec.rb +6 -0
  72. data/spec/models/locale_details_spec.rb +6 -0
  73. data/spec/models/locale_spec.rb +6 -0
  74. data/spec/models/locale_update_parameters_spec.rb +6 -0
  75. data/spec/models/{team1_spec.rb → team_short_spec.rb} +6 -6
  76. metadata +218 -202
@@ -17,6 +17,9 @@ module Phrase
17
17
  # Additional formatting and render options. Only <code>enclose_in_cdata</code> is available for platform <code>android</code>.
18
18
  attr_accessor :format_options
19
19
 
20
+ # Use fallback locale if there is no translation in the current locale.
21
+ attr_accessor :fallback_locales_enabled
22
+
20
23
  # Indicates whether to fallback to non regional locale when locale can not be found
21
24
  attr_accessor :fallback_to_non_regional_locale
22
25
 
@@ -34,6 +37,7 @@ module Phrase
34
37
  :'platforms' => :'platforms',
35
38
  :'locale_ids' => :'locale_ids',
36
39
  :'format_options' => :'format_options',
40
+ :'fallback_locales_enabled' => :'fallback_locales_enabled',
37
41
  :'fallback_to_non_regional_locale' => :'fallback_to_non_regional_locale',
38
42
  :'fallback_to_default_locale' => :'fallback_to_default_locale',
39
43
  :'use_last_reviewed_version' => :'use_last_reviewed_version'
@@ -48,6 +52,7 @@ module Phrase
48
52
  :'platforms' => :'Array<String>',
49
53
  :'locale_ids' => :'Array<String>',
50
54
  :'format_options' => :'Hash<String, String>',
55
+ :'fallback_locales_enabled' => :'Boolean',
51
56
  :'fallback_to_non_regional_locale' => :'Boolean',
52
57
  :'fallback_to_default_locale' => :'Boolean',
53
58
  :'use_last_reviewed_version' => :'Boolean'
@@ -101,6 +106,10 @@ module Phrase
101
106
  end
102
107
  end
103
108
 
109
+ if attributes.key?(:'fallback_locales_enabled')
110
+ self.fallback_locales_enabled = attributes[:'fallback_locales_enabled']
111
+ end
112
+
104
113
  if attributes.key?(:'fallback_to_non_regional_locale')
105
114
  self.fallback_to_non_regional_locale = attributes[:'fallback_to_non_regional_locale']
106
115
  end
@@ -137,6 +146,7 @@ module Phrase
137
146
  platforms == o.platforms &&
138
147
  locale_ids == o.locale_ids &&
139
148
  format_options == o.format_options &&
149
+ fallback_locales_enabled == o.fallback_locales_enabled &&
140
150
  fallback_to_non_regional_locale == o.fallback_to_non_regional_locale &&
141
151
  fallback_to_default_locale == o.fallback_to_default_locale &&
142
152
  use_last_reviewed_version == o.use_last_reviewed_version
@@ -151,7 +161,7 @@ module Phrase
151
161
  # Calculates hash code according to all attributes.
152
162
  # @return [Integer] Hash code
153
163
  def hash
154
- [name, project_id, platforms, locale_ids, format_options, fallback_to_non_regional_locale, fallback_to_default_locale, use_last_reviewed_version].hash
164
+ [name, project_id, platforms, locale_ids, format_options, fallback_locales_enabled, fallback_to_non_regional_locale, fallback_to_default_locale, use_last_reviewed_version].hash
155
165
  end
156
166
 
157
167
  # Builds the object from hash
@@ -17,6 +17,9 @@ module Phrase
17
17
  # Additional formatting and render options. Only <code>enclose_in_cdata</code> is available for platform <code>android</code>.
18
18
  attr_accessor :format_options
19
19
 
20
+ # Use fallback locale if there is no translation in the current locale.
21
+ attr_accessor :fallback_locales_enabled
22
+
20
23
  # Indicates whether to fallback to non regional locale when locale can not be found
21
24
  attr_accessor :fallback_to_non_regional_locale
22
25
 
@@ -34,6 +37,7 @@ module Phrase
34
37
  :'platforms' => :'platforms',
35
38
  :'locale_ids' => :'locale_ids',
36
39
  :'format_options' => :'format_options',
40
+ :'fallback_locales_enabled' => :'fallback_locales_enabled',
37
41
  :'fallback_to_non_regional_locale' => :'fallback_to_non_regional_locale',
38
42
  :'fallback_to_default_locale' => :'fallback_to_default_locale',
39
43
  :'use_last_reviewed_version' => :'use_last_reviewed_version'
@@ -48,6 +52,7 @@ module Phrase
48
52
  :'platforms' => :'Array<String>',
49
53
  :'locale_ids' => :'Array<String>',
50
54
  :'format_options' => :'Hash<String, String>',
55
+ :'fallback_locales_enabled' => :'Boolean',
51
56
  :'fallback_to_non_regional_locale' => :'Boolean',
52
57
  :'fallback_to_default_locale' => :'Boolean',
53
58
  :'use_last_reviewed_version' => :'Boolean'
@@ -101,6 +106,10 @@ module Phrase
101
106
  end
102
107
  end
103
108
 
109
+ if attributes.key?(:'fallback_locales_enabled')
110
+ self.fallback_locales_enabled = attributes[:'fallback_locales_enabled']
111
+ end
112
+
104
113
  if attributes.key?(:'fallback_to_non_regional_locale')
105
114
  self.fallback_to_non_regional_locale = attributes[:'fallback_to_non_regional_locale']
106
115
  end
@@ -137,6 +146,7 @@ module Phrase
137
146
  platforms == o.platforms &&
138
147
  locale_ids == o.locale_ids &&
139
148
  format_options == o.format_options &&
149
+ fallback_locales_enabled == o.fallback_locales_enabled &&
140
150
  fallback_to_non_regional_locale == o.fallback_to_non_regional_locale &&
141
151
  fallback_to_default_locale == o.fallback_to_default_locale &&
142
152
  use_last_reviewed_version == o.use_last_reviewed_version
@@ -151,7 +161,7 @@ module Phrase
151
161
  # Calculates hash code according to all attributes.
152
162
  # @return [Integer] Hash code
153
163
  def hash
154
- [name, project_id, platforms, locale_ids, format_options, fallback_to_non_regional_locale, fallback_to_default_locale, use_last_reviewed_version].hash
164
+ [name, project_id, platforms, locale_ids, format_options, fallback_locales_enabled, fallback_to_non_regional_locale, fallback_to_default_locale, use_last_reviewed_version].hash
155
165
  end
156
166
 
157
167
  # Builds the object from hash
@@ -14,6 +14,8 @@ module Phrase
14
14
 
15
15
  attr_accessor :locales
16
16
 
17
+ attr_accessor :teams
18
+
17
19
  attr_accessor :default_locale_codes
18
20
 
19
21
  attr_accessor :permissions
@@ -28,8 +30,6 @@ module Phrase
28
30
 
29
31
  attr_accessor :spaces
30
32
 
31
- attr_accessor :teams
32
-
33
33
  attr_accessor :project_role
34
34
 
35
35
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -41,6 +41,7 @@ module Phrase
41
41
  :'state' => :'state',
42
42
  :'projects' => :'projects',
43
43
  :'locales' => :'locales',
44
+ :'teams' => :'teams',
44
45
  :'default_locale_codes' => :'default_locale_codes',
45
46
  :'permissions' => :'permissions',
46
47
  :'locale_ids' => :'locale_ids',
@@ -48,7 +49,6 @@ module Phrase
48
49
  :'updated_at' => :'updated_at',
49
50
  :'accepted_at' => :'accepted_at',
50
51
  :'spaces' => :'spaces',
51
- :'teams' => :'teams',
52
52
  :'project_role' => :'project_role'
53
53
  }
54
54
  end
@@ -62,14 +62,14 @@ module Phrase
62
62
  :'state' => :'String',
63
63
  :'projects' => :'Array<ProjectShort>',
64
64
  :'locales' => :'Array<LocalePreview>',
65
+ :'teams' => :'Array<TeamShort>',
65
66
  :'default_locale_codes' => :'Array<String>',
66
67
  :'permissions' => :'Object',
67
68
  :'locale_ids' => :'Array<String>',
68
69
  :'created_at' => :'DateTime',
69
70
  :'updated_at' => :'DateTime',
70
71
  :'accepted_at' => :'DateTime',
71
- :'spaces' => :'Array<MemberSpaces>',
72
- :'teams' => :'Array<Items>',
72
+ :'spaces' => :'Array<Space>',
73
73
  :'project_role' => :'Array<MemberProjectDetailProjectRoles>'
74
74
  }
75
75
  end
@@ -123,6 +123,12 @@ module Phrase
123
123
  end
124
124
  end
125
125
 
126
+ if attributes.key?(:'teams')
127
+ if (value = attributes[:'teams']).is_a?(Array)
128
+ self.teams = value
129
+ end
130
+ end
131
+
126
132
  if attributes.key?(:'default_locale_codes')
127
133
  if (value = attributes[:'default_locale_codes']).is_a?(Array)
128
134
  self.default_locale_codes = value
@@ -157,12 +163,6 @@ module Phrase
157
163
  end
158
164
  end
159
165
 
160
- if attributes.key?(:'teams')
161
- if (value = attributes[:'teams']).is_a?(Array)
162
- self.teams = value
163
- end
164
- end
165
-
166
166
  if attributes.key?(:'project_role')
167
167
  if (value = attributes[:'project_role']).is_a?(Array)
168
168
  self.project_role = value
@@ -194,6 +194,7 @@ module Phrase
194
194
  state == o.state &&
195
195
  projects == o.projects &&
196
196
  locales == o.locales &&
197
+ teams == o.teams &&
197
198
  default_locale_codes == o.default_locale_codes &&
198
199
  permissions == o.permissions &&
199
200
  locale_ids == o.locale_ids &&
@@ -201,7 +202,6 @@ module Phrase
201
202
  updated_at == o.updated_at &&
202
203
  accepted_at == o.accepted_at &&
203
204
  spaces == o.spaces &&
204
- teams == o.teams &&
205
205
  project_role == o.project_role
206
206
  end
207
207
 
@@ -214,7 +214,7 @@ module Phrase
214
214
  # Calculates hash code according to all attributes.
215
215
  # @return [Integer] Hash code
216
216
  def hash
217
- [id, email, role, state, projects, locales, default_locale_codes, permissions, locale_ids, created_at, updated_at, accepted_at, spaces, teams, project_role].hash
217
+ [id, email, role, state, projects, locales, teams, default_locale_codes, permissions, locale_ids, created_at, updated_at, accepted_at, spaces, project_role].hash
218
218
  end
219
219
 
220
220
  # Builds the object from hash
@@ -0,0 +1,250 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class JobComment
5
+ attr_accessor :id
6
+
7
+ attr_accessor :message
8
+
9
+ attr_accessor :job_id
10
+
11
+ attr_accessor :user
12
+
13
+ attr_accessor :created_at
14
+
15
+ attr_accessor :updated_at
16
+
17
+ attr_accessor :mentioned_users
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'id' => :'id',
23
+ :'message' => :'message',
24
+ :'job_id' => :'job_id',
25
+ :'user' => :'user',
26
+ :'created_at' => :'created_at',
27
+ :'updated_at' => :'updated_at',
28
+ :'mentioned_users' => :'mentioned_users'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'id' => :'String',
36
+ :'message' => :'String',
37
+ :'job_id' => :'String',
38
+ :'user' => :'UserPreview',
39
+ :'created_at' => :'DateTime',
40
+ :'updated_at' => :'DateTime',
41
+ :'mentioned_users' => :'Array<UserPreview>'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::JobComment` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!self.class.attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::JobComment`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'id')
67
+ self.id = attributes[:'id']
68
+ end
69
+
70
+ if attributes.key?(:'message')
71
+ self.message = attributes[:'message']
72
+ end
73
+
74
+ if attributes.key?(:'job_id')
75
+ self.job_id = attributes[:'job_id']
76
+ end
77
+
78
+ if attributes.key?(:'user')
79
+ self.user = attributes[:'user']
80
+ end
81
+
82
+ if attributes.key?(:'created_at')
83
+ self.created_at = attributes[:'created_at']
84
+ end
85
+
86
+ if attributes.key?(:'updated_at')
87
+ self.updated_at = attributes[:'updated_at']
88
+ end
89
+
90
+ if attributes.key?(:'mentioned_users')
91
+ if (value = attributes[:'mentioned_users']).is_a?(Array)
92
+ self.mentioned_users = value
93
+ end
94
+ end
95
+ end
96
+
97
+ # Show invalid properties with the reasons. Usually used together with valid?
98
+ # @return Array for valid properties with the reasons
99
+ def list_invalid_properties
100
+ invalid_properties = Array.new
101
+ invalid_properties
102
+ end
103
+
104
+ # Check to see if the all the properties in the model are valid
105
+ # @return true if the model is valid
106
+ def valid?
107
+ true
108
+ end
109
+
110
+ # Checks equality by comparing each attribute.
111
+ # @param [Object] Object to be compared
112
+ def ==(o)
113
+ return true if self.equal?(o)
114
+ self.class == o.class &&
115
+ id == o.id &&
116
+ message == o.message &&
117
+ job_id == o.job_id &&
118
+ user == o.user &&
119
+ created_at == o.created_at &&
120
+ updated_at == o.updated_at &&
121
+ mentioned_users == o.mentioned_users
122
+ end
123
+
124
+ # @see the `==` method
125
+ # @param [Object] Object to be compared
126
+ def eql?(o)
127
+ self == o
128
+ end
129
+
130
+ # Calculates hash code according to all attributes.
131
+ # @return [Integer] Hash code
132
+ def hash
133
+ [id, message, job_id, user, created_at, updated_at, mentioned_users].hash
134
+ end
135
+
136
+ # Builds the object from hash
137
+ # @param [Hash] attributes Model attributes in the form of hash
138
+ # @return [Object] Returns the model itself
139
+ def self.build_from_hash(attributes)
140
+ new.build_from_hash(attributes)
141
+ end
142
+
143
+ # Builds the object from hash
144
+ # @param [Hash] attributes Model attributes in the form of hash
145
+ # @return [Object] Returns the model itself
146
+ def build_from_hash(attributes)
147
+ return nil unless attributes.is_a?(Hash)
148
+ self.class.openapi_types.each_pair do |key, type|
149
+ if type =~ /\AArray<(.*)>/i
150
+ # check to ensure the input is an array given that the attribute
151
+ # is documented as an array but the input is not
152
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
153
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
154
+ end
155
+ elsif !attributes[self.class.attribute_map[key]].nil?
156
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
157
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
158
+ end
159
+
160
+ self
161
+ end
162
+
163
+ # Deserializes the data based on type
164
+ # @param string type Data type
165
+ # @param string value Value to be deserialized
166
+ # @return [Object] Deserialized data
167
+ def _deserialize(type, value)
168
+ case type.to_sym
169
+ when :DateTime
170
+ DateTime.parse(value)
171
+ when :Date
172
+ Date.parse(value)
173
+ when :String
174
+ value.to_s
175
+ when :Integer
176
+ value.to_i
177
+ when :Float
178
+ value.to_f
179
+ when :Boolean
180
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
181
+ true
182
+ else
183
+ false
184
+ end
185
+ when :Object
186
+ # generic object (usually a Hash), return directly
187
+ value
188
+ when /\AArray<(?<inner_type>.+)>\z/
189
+ inner_type = Regexp.last_match[:inner_type]
190
+ value.map { |v| _deserialize(inner_type, v) }
191
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
192
+ k_type = Regexp.last_match[:k_type]
193
+ v_type = Regexp.last_match[:v_type]
194
+ {}.tap do |hash|
195
+ value.each do |k, v|
196
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
197
+ end
198
+ end
199
+ else # model
200
+ Phrase.const_get(type).build_from_hash(value)
201
+ end
202
+ end
203
+
204
+ # Returns the string representation of the object
205
+ # @return [String] String presentation of the object
206
+ def to_s
207
+ to_hash.to_s
208
+ end
209
+
210
+ # to_body is an alias to to_hash (backward compatibility)
211
+ # @return [Hash] Returns the object in the form of hash
212
+ def to_body
213
+ to_hash
214
+ end
215
+
216
+ # Returns the object in the form of hash
217
+ # @return [Hash] Returns the object in the form of hash
218
+ def to_hash
219
+ hash = {}
220
+ self.class.attribute_map.each_pair do |attr, param|
221
+ value = self.send(attr)
222
+ if value.nil?
223
+ is_nullable = self.class.openapi_nullable.include?(attr)
224
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
225
+ end
226
+
227
+ hash[param] = _to_hash(value)
228
+ end
229
+ hash
230
+ end
231
+
232
+ # Outputs non-array value in the form of hash
233
+ # For object, use to_hash. Otherwise, just return the value
234
+ # @param [Object] value Any valid value
235
+ # @return [Hash] Returns the value in the form of hash
236
+ def _to_hash(value)
237
+ if value.is_a?(Array)
238
+ value.compact.map { |v| _to_hash(v) }
239
+ elsif value.is_a?(Hash)
240
+ {}.tap do |hash|
241
+ value.each { |k, v| hash[k] = _to_hash(v) }
242
+ end
243
+ elsif value.respond_to? :to_hash
244
+ value.to_hash
245
+ else
246
+ value
247
+ end
248
+ end
249
+ end
250
+ end
@@ -0,0 +1,195 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class JobCommentCreateParameters
5
+ # Job comment message
6
+ attr_accessor :message
7
+
8
+ # Attribute mapping from ruby-style variable name to JSON key.
9
+ def self.attribute_map
10
+ {
11
+ :'message' => :'message'
12
+ }
13
+ end
14
+
15
+ # Attribute type mapping.
16
+ def self.openapi_types
17
+ {
18
+ :'message' => :'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::JobCommentCreateParameters` 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::JobCommentCreateParameters`. 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?(:'message')
44
+ self.message = attributes[:'message']
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
+ message == o.message
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
+ [message].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