phrase 2.12.0 → 2.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/README.md +25 -13
  4. data/docs/Comment.md +5 -1
  5. data/docs/CommentReaction.md +27 -0
  6. data/docs/CommentReactionsApi.md +289 -0
  7. data/docs/CommentRepliesApi.md +427 -0
  8. data/docs/CommentsApi.md +5 -1
  9. data/docs/DistributionCreateParameters.md +1 -1
  10. data/docs/GitlabSyncHistory.md +2 -2
  11. data/docs/GitlabSyncHistoryErrors.md +19 -0
  12. data/docs/JobLocaleUpdateParameters.md +1 -1
  13. data/docs/JobLocalesApi.md +20 -20
  14. data/docs/JobLocalesCreateParameters.md +1 -1
  15. data/docs/LocalesApi.md +2 -2
  16. data/docs/SpacesApi.md +9 -9
  17. data/docs/TeamsApi.md +6 -6
  18. data/docs/UploadCreateParameters.md +1 -1
  19. data/docs/UploadsApi.md +2 -2
  20. data/lib/phrase/api/comment_reactions_api.rb +353 -0
  21. data/lib/phrase/api/comment_replies_api.rb +523 -0
  22. data/lib/phrase/api/comments_api.rb +6 -0
  23. data/lib/phrase/api/job_locales_api.rb +20 -20
  24. data/lib/phrase/api/locales_api.rb +2 -2
  25. data/lib/phrase/api/spaces_api.rb +6 -6
  26. data/lib/phrase/api/teams_api.rb +4 -4
  27. data/lib/phrase/api/uploads_api.rb +2 -2
  28. data/lib/phrase/models/comment.rb +24 -4
  29. data/lib/phrase/models/comment_reaction.rb +239 -0
  30. data/lib/phrase/models/distribution_create_parameters.rb +1 -1
  31. data/lib/phrase/models/gitlab_sync_history.rb +2 -2
  32. data/lib/phrase/models/gitlab_sync_history_errors.rb +203 -0
  33. data/lib/phrase/models/job_locale_update_parameters.rb +1 -1
  34. data/lib/phrase/models/job_locales_create_parameters.rb +1 -1
  35. data/lib/phrase/models/upload_create_parameters.rb +1 -1
  36. data/lib/phrase/version.rb +1 -1
  37. data/lib/phrase.rb +4 -0
  38. data/spec/api/comment_reactions_api_spec.rb +92 -0
  39. data/spec/api/comment_replies_api_spec.rb +126 -0
  40. data/spec/api/comments_api_spec.rb +2 -0
  41. data/spec/api/job_locales_api_spec.rb +10 -10
  42. data/spec/api/locales_api_spec.rb +1 -1
  43. data/spec/api/spaces_api_spec.rb +3 -3
  44. data/spec/api/teams_api_spec.rb +2 -2
  45. data/spec/api/uploads_api_spec.rb +1 -1
  46. data/spec/models/comment_reaction_spec.rb +59 -0
  47. data/spec/models/comment_spec.rb +12 -0
  48. data/spec/models/gitlab_sync_history_errors_spec.rb +35 -0
  49. metadata +228 -211
@@ -375,7 +375,7 @@ module Phrase
375
375
  return response, status_code, headers
376
376
  end
377
377
 
378
- # Add Project
378
+ # Add Project to Space
379
379
  # Adds an existing project to the space.
380
380
  # @param account_id [String] Account ID
381
381
  # @param space_id [String] Space ID
@@ -388,7 +388,7 @@ module Phrase
388
388
  data
389
389
  end
390
390
 
391
- # Add Project
391
+ # Add Project to Space
392
392
  # Adds an existing project to the space.
393
393
  # @param account_id [String] Account ID
394
394
  # @param space_id [String] Space ID
@@ -453,7 +453,7 @@ module Phrase
453
453
  return response, status_code, headers
454
454
  end
455
455
 
456
- # Remove Project
456
+ # Remove Project from Space
457
457
  # Removes a specified project from the specified space.
458
458
  # @param account_id [String] Account ID
459
459
  # @param space_id [String] Space ID
@@ -466,7 +466,7 @@ module Phrase
466
466
  data
467
467
  end
468
468
 
469
- # Remove Project
469
+ # Remove Project from Space
470
470
  # Removes a specified project from the specified space.
471
471
  # @param account_id [String] Account ID
472
472
  # @param space_id [String] Space ID
@@ -529,7 +529,7 @@ module Phrase
529
529
  return response, status_code, headers
530
530
  end
531
531
 
532
- # List Projects
532
+ # List Projects in Space
533
533
  # List all projects for the specified Space.
534
534
  # @param account_id [String] Account ID
535
535
  # @param space_id [String] Space ID
@@ -543,7 +543,7 @@ module Phrase
543
543
  data
544
544
  end
545
545
 
546
- # List Projects
546
+ # List Projects in Space
547
547
  # List all projects for the specified Space.
548
548
  # @param account_id [String] Account ID
549
549
  # @param space_id [String] Space ID
@@ -375,7 +375,7 @@ module Phrase
375
375
  return response, status_code, headers
376
376
  end
377
377
 
378
- # Add Project
378
+ # Add Project to Team
379
379
  # Adds an existing project to the team.
380
380
  # @param account_id [String] Account ID
381
381
  # @param team_id [String] Team ID
@@ -388,7 +388,7 @@ module Phrase
388
388
  data
389
389
  end
390
390
 
391
- # Add Project
391
+ # Add Project to Team
392
392
  # Adds an existing project to the team.
393
393
  # @param account_id [String] Account ID
394
394
  # @param team_id [String] Team ID
@@ -453,7 +453,7 @@ module Phrase
453
453
  return response, status_code, headers
454
454
  end
455
455
 
456
- # Remove Project
456
+ # Remove Project from Team
457
457
  # Removes a specified project from the specified team.
458
458
  # @param account_id [String] Account ID
459
459
  # @param team_id [String] Team ID
@@ -466,7 +466,7 @@ module Phrase
466
466
  data
467
467
  end
468
468
 
469
- # Remove Project
469
+ # Remove Project from Team
470
470
  # Removes a specified project from the specified team.
471
471
  # @param account_id [String] Account ID
472
472
  # @param team_id [String] Team ID
@@ -26,7 +26,7 @@ module Phrase
26
26
  # @option opts [Object] :locale_mapping Optional, format specific mapping between locale names and the columns the translations to those locales are contained in.
27
27
  # @option opts [Object] :format_options Additional options available for specific formats. See our format guide for complete list.
28
28
  # @option opts [Boolean] :autotranslate If set, translations for the uploaded language will be fetched automatically.
29
- # @option opts [Boolean] :mark_reviewed Indicated whether the imported translations should be marked as reviewed. This setting is available if the review workflow (currently beta) is enabled for the project.
29
+ # @option opts [Boolean] :mark_reviewed Indicated whether the imported translations should be marked as reviewed. This setting is available if the review workflow is enabled for the project.
30
30
  # @return [Upload]
31
31
  def upload_create(project_id, opts = {})
32
32
  data, _status_code, _headers = upload_create_with_http_info(project_id, opts)
@@ -52,7 +52,7 @@ module Phrase
52
52
  # @option opts [Object] :locale_mapping Optional, format specific mapping between locale names and the columns the translations to those locales are contained in.
53
53
  # @option opts [Object] :format_options Additional options available for specific formats. See our format guide for complete list.
54
54
  # @option opts [Boolean] :autotranslate If set, translations for the uploaded language will be fetched automatically.
55
- # @option opts [Boolean] :mark_reviewed Indicated whether the imported translations should be marked as reviewed. This setting is available if the review workflow (currently beta) is enabled for the project.
55
+ # @option opts [Boolean] :mark_reviewed Indicated whether the imported translations should be marked as reviewed. This setting is available if the review workflow is enabled for the project.
56
56
  # @return [Array<(Response<(Upload)>, Integer, Hash)>] Response<(Upload)> data, response status code and response headers
57
57
  def upload_create_with_http_info(project_id, opts = {})
58
58
  if @api_client.config.debugging
@@ -6,6 +6,8 @@ module Phrase
6
6
 
7
7
  attr_accessor :message
8
8
 
9
+ attr_accessor :has_replies
10
+
9
11
  attr_accessor :user
10
12
 
11
13
  attr_accessor :created_at
@@ -14,15 +16,19 @@ module Phrase
14
16
 
15
17
  attr_accessor :mentioned_users
16
18
 
19
+ attr_accessor :locales
20
+
17
21
  # Attribute mapping from ruby-style variable name to JSON key.
18
22
  def self.attribute_map
19
23
  {
20
24
  :'id' => :'id',
21
25
  :'message' => :'message',
26
+ :'has_replies' => :'has_replies',
22
27
  :'user' => :'user',
23
28
  :'created_at' => :'created_at',
24
29
  :'updated_at' => :'updated_at',
25
- :'mentioned_users' => :'mentioned_users'
30
+ :'mentioned_users' => :'mentioned_users',
31
+ :'locales' => :'locales'
26
32
  }
27
33
  end
28
34
 
@@ -31,10 +37,12 @@ module Phrase
31
37
  {
32
38
  :'id' => :'String',
33
39
  :'message' => :'String',
40
+ :'has_replies' => :'Boolean',
34
41
  :'user' => :'UserPreview',
35
42
  :'created_at' => :'DateTime',
36
43
  :'updated_at' => :'DateTime',
37
- :'mentioned_users' => :'Array<UserPreview>'
44
+ :'mentioned_users' => :'Array<UserPreview>',
45
+ :'locales' => :'Array<LocalePreview>'
38
46
  }
39
47
  end
40
48
 
@@ -67,6 +75,10 @@ module Phrase
67
75
  self.message = attributes[:'message']
68
76
  end
69
77
 
78
+ if attributes.key?(:'has_replies')
79
+ self.has_replies = attributes[:'has_replies']
80
+ end
81
+
70
82
  if attributes.key?(:'user')
71
83
  self.user = attributes[:'user']
72
84
  end
@@ -84,6 +96,12 @@ module Phrase
84
96
  self.mentioned_users = value
85
97
  end
86
98
  end
99
+
100
+ if attributes.key?(:'locales')
101
+ if (value = attributes[:'locales']).is_a?(Array)
102
+ self.locales = value
103
+ end
104
+ end
87
105
  end
88
106
 
89
107
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -106,10 +124,12 @@ module Phrase
106
124
  self.class == o.class &&
107
125
  id == o.id &&
108
126
  message == o.message &&
127
+ has_replies == o.has_replies &&
109
128
  user == o.user &&
110
129
  created_at == o.created_at &&
111
130
  updated_at == o.updated_at &&
112
- mentioned_users == o.mentioned_users
131
+ mentioned_users == o.mentioned_users &&
132
+ locales == o.locales
113
133
  end
114
134
 
115
135
  # @see the `==` method
@@ -121,7 +141,7 @@ module Phrase
121
141
  # Calculates hash code according to all attributes.
122
142
  # @return [Integer] Hash code
123
143
  def hash
124
- [id, message, user, created_at, updated_at, mentioned_users].hash
144
+ [id, message, has_replies, user, created_at, updated_at, mentioned_users, locales].hash
125
145
  end
126
146
 
127
147
  # Builds the object from hash
@@ -0,0 +1,239 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class CommentReaction
5
+ attr_accessor :id
6
+
7
+ attr_accessor :emoji
8
+
9
+ attr_accessor :created_at
10
+
11
+ attr_accessor :updated_at
12
+
13
+ attr_accessor :comment
14
+
15
+ attr_accessor :user
16
+
17
+ # Attribute mapping from ruby-style variable name to JSON key.
18
+ def self.attribute_map
19
+ {
20
+ :'id' => :'id',
21
+ :'emoji' => :'emoji',
22
+ :'created_at' => :'created_at',
23
+ :'updated_at' => :'updated_at',
24
+ :'comment' => :'comment',
25
+ :'user' => :'user'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.openapi_types
31
+ {
32
+ :'id' => :'String',
33
+ :'emoji' => :'String',
34
+ :'created_at' => :'DateTime',
35
+ :'updated_at' => :'DateTime',
36
+ :'comment' => :'Comment',
37
+ :'user' => :'UserPreview'
38
+ }
39
+ end
40
+
41
+ # List of attributes with nullable: true
42
+ def self.openapi_nullable
43
+ Set.new([
44
+ ])
45
+ end
46
+
47
+ # Initializes the object
48
+ # @param [Hash] attributes Model attributes in the form of hash
49
+ def initialize(attributes = {})
50
+ if (!attributes.is_a?(Hash))
51
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::CommentReaction` initialize method"
52
+ end
53
+
54
+ # check to see if the attribute exists and convert string to symbol for hash key
55
+ attributes = attributes.each_with_object({}) { |(k, v), h|
56
+ if (!self.class.attribute_map.key?(k.to_sym))
57
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::CommentReaction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
58
+ end
59
+ h[k.to_sym] = v
60
+ }
61
+
62
+ if attributes.key?(:'id')
63
+ self.id = attributes[:'id']
64
+ end
65
+
66
+ if attributes.key?(:'emoji')
67
+ self.emoji = attributes[:'emoji']
68
+ end
69
+
70
+ if attributes.key?(:'created_at')
71
+ self.created_at = attributes[:'created_at']
72
+ end
73
+
74
+ if attributes.key?(:'updated_at')
75
+ self.updated_at = attributes[:'updated_at']
76
+ end
77
+
78
+ if attributes.key?(:'comment')
79
+ self.comment = attributes[:'comment']
80
+ end
81
+
82
+ if attributes.key?(:'user')
83
+ self.user = attributes[:'user']
84
+ end
85
+ end
86
+
87
+ # Show invalid properties with the reasons. Usually used together with valid?
88
+ # @return Array for valid properties with the reasons
89
+ def list_invalid_properties
90
+ invalid_properties = Array.new
91
+ invalid_properties
92
+ end
93
+
94
+ # Check to see if the all the properties in the model are valid
95
+ # @return true if the model is valid
96
+ def valid?
97
+ true
98
+ end
99
+
100
+ # Checks equality by comparing each attribute.
101
+ # @param [Object] Object to be compared
102
+ def ==(o)
103
+ return true if self.equal?(o)
104
+ self.class == o.class &&
105
+ id == o.id &&
106
+ emoji == o.emoji &&
107
+ created_at == o.created_at &&
108
+ updated_at == o.updated_at &&
109
+ comment == o.comment &&
110
+ user == o.user
111
+ end
112
+
113
+ # @see the `==` method
114
+ # @param [Object] Object to be compared
115
+ def eql?(o)
116
+ self == o
117
+ end
118
+
119
+ # Calculates hash code according to all attributes.
120
+ # @return [Integer] Hash code
121
+ def hash
122
+ [id, emoji, created_at, updated_at, comment, user].hash
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def self.build_from_hash(attributes)
129
+ new.build_from_hash(attributes)
130
+ end
131
+
132
+ # Builds the object from hash
133
+ # @param [Hash] attributes Model attributes in the form of hash
134
+ # @return [Object] Returns the model itself
135
+ def build_from_hash(attributes)
136
+ return nil unless attributes.is_a?(Hash)
137
+ self.class.openapi_types.each_pair do |key, type|
138
+ if type =~ /\AArray<(.*)>/i
139
+ # check to ensure the input is an array given that the attribute
140
+ # is documented as an array but the input is not
141
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
142
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
143
+ end
144
+ elsif !attributes[self.class.attribute_map[key]].nil?
145
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
146
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
147
+ end
148
+
149
+ self
150
+ end
151
+
152
+ # Deserializes the data based on type
153
+ # @param string type Data type
154
+ # @param string value Value to be deserialized
155
+ # @return [Object] Deserialized data
156
+ def _deserialize(type, value)
157
+ case type.to_sym
158
+ when :DateTime
159
+ DateTime.parse(value)
160
+ when :Date
161
+ Date.parse(value)
162
+ when :String
163
+ value.to_s
164
+ when :Integer
165
+ value.to_i
166
+ when :Float
167
+ value.to_f
168
+ when :Boolean
169
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
170
+ true
171
+ else
172
+ false
173
+ end
174
+ when :Object
175
+ # generic object (usually a Hash), return directly
176
+ value
177
+ when /\AArray<(?<inner_type>.+)>\z/
178
+ inner_type = Regexp.last_match[:inner_type]
179
+ value.map { |v| _deserialize(inner_type, v) }
180
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
181
+ k_type = Regexp.last_match[:k_type]
182
+ v_type = Regexp.last_match[:v_type]
183
+ {}.tap do |hash|
184
+ value.each do |k, v|
185
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
186
+ end
187
+ end
188
+ else # model
189
+ Phrase.const_get(type).build_from_hash(value)
190
+ end
191
+ end
192
+
193
+ # Returns the string representation of the object
194
+ # @return [String] String presentation of the object
195
+ def to_s
196
+ to_hash.to_s
197
+ end
198
+
199
+ # to_body is an alias to to_hash (backward compatibility)
200
+ # @return [Hash] Returns the object in the form of hash
201
+ def to_body
202
+ to_hash
203
+ end
204
+
205
+ # Returns the object in the form of hash
206
+ # @return [Hash] Returns the object in the form of hash
207
+ def to_hash
208
+ hash = {}
209
+ self.class.attribute_map.each_pair do |attr, param|
210
+ value = self.send(attr)
211
+ if value.nil?
212
+ is_nullable = self.class.openapi_nullable.include?(attr)
213
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
214
+ end
215
+
216
+ hash[param] = _to_hash(value)
217
+ end
218
+ hash
219
+ end
220
+
221
+ # Outputs non-array value in the form of hash
222
+ # For object, use to_hash. Otherwise, just return the value
223
+ # @param [Object] value Any valid value
224
+ # @return [Hash] Returns the value in the form of hash
225
+ def _to_hash(value)
226
+ if value.is_a?(Array)
227
+ value.compact.map { |v| _to_hash(v) }
228
+ elsif value.is_a?(Hash)
229
+ {}.tap do |hash|
230
+ value.each { |k, v| hash[k] = _to_hash(v) }
231
+ end
232
+ elsif value.respond_to? :to_hash
233
+ value.to_hash
234
+ else
235
+ value
236
+ end
237
+ end
238
+ end
239
+ end
@@ -8,7 +8,7 @@ module Phrase
8
8
  # Project id the distribution should be assigned to.
9
9
  attr_accessor :project_id
10
10
 
11
- # List of platforms the distribution should support.
11
+ # List of platforms the distribution should support. Valid values are: * `android` * `ios` * `flutter` * `i18next`
12
12
  attr_accessor :platforms
13
13
 
14
14
  # List of locale ids that will be part of distribution releases
@@ -26,9 +26,9 @@ module Phrase
26
26
  # Attribute type mapping.
27
27
  def self.openapi_types
28
28
  {
29
- :'status' => :'Integer',
29
+ :'status' => :'String',
30
30
  :'action' => :'String',
31
- :'errors' => :'Array<String>',
31
+ :'errors' => :'Array<GitlabSyncHistoryErrors>',
32
32
  :'date' => :'DateTime',
33
33
  :'details' => :'Object'
34
34
  }
@@ -0,0 +1,203 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class GitlabSyncHistoryErrors
5
+ attr_accessor :error
6
+
7
+ attr_accessor :message
8
+
9
+ # Attribute mapping from ruby-style variable name to JSON key.
10
+ def self.attribute_map
11
+ {
12
+ :'error' => :'error',
13
+ :'message' => :'message'
14
+ }
15
+ end
16
+
17
+ # Attribute type mapping.
18
+ def self.openapi_types
19
+ {
20
+ :'error' => :'String',
21
+ :'message' => :'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::GitlabSyncHistoryErrors` 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::GitlabSyncHistoryErrors`. 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?(:'error')
47
+ self.error = attributes[:'error']
48
+ end
49
+
50
+ if attributes.key?(:'message')
51
+ self.message = attributes[:'message']
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
+ error == o.error &&
74
+ message == o.message
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
+ [error, message].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 :String
127
+ value.to_s
128
+ when :Integer
129
+ value.to_i
130
+ when :Float
131
+ value.to_f
132
+ when :Boolean
133
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
134
+ true
135
+ else
136
+ false
137
+ end
138
+ when :Object
139
+ # generic object (usually a Hash), return directly
140
+ value
141
+ when /\AArray<(?<inner_type>.+)>\z/
142
+ inner_type = Regexp.last_match[:inner_type]
143
+ value.map { |v| _deserialize(inner_type, v) }
144
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
145
+ k_type = Regexp.last_match[:k_type]
146
+ v_type = Regexp.last_match[:v_type]
147
+ {}.tap do |hash|
148
+ value.each do |k, v|
149
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
150
+ end
151
+ end
152
+ else # model
153
+ Phrase.const_get(type).build_from_hash(value)
154
+ end
155
+ end
156
+
157
+ # Returns the string representation of the object
158
+ # @return [String] String presentation of the object
159
+ def to_s
160
+ to_hash.to_s
161
+ end
162
+
163
+ # to_body is an alias to to_hash (backward compatibility)
164
+ # @return [Hash] Returns the object in the form of hash
165
+ def to_body
166
+ to_hash
167
+ end
168
+
169
+ # Returns the object in the form of hash
170
+ # @return [Hash] Returns the object in the form of hash
171
+ def to_hash
172
+ hash = {}
173
+ self.class.attribute_map.each_pair do |attr, param|
174
+ value = self.send(attr)
175
+ if value.nil?
176
+ is_nullable = self.class.openapi_nullable.include?(attr)
177
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
178
+ end
179
+
180
+ hash[param] = _to_hash(value)
181
+ end
182
+ hash
183
+ end
184
+
185
+ # Outputs non-array value in the form of hash
186
+ # For object, use to_hash. Otherwise, just return the value
187
+ # @param [Object] value Any valid value
188
+ # @return [Hash] Returns the value in the form of hash
189
+ def _to_hash(value)
190
+ if value.is_a?(Array)
191
+ value.compact.map { |v| _to_hash(v) }
192
+ elsif value.is_a?(Hash)
193
+ {}.tap do |hash|
194
+ value.each { |k, v| hash[k] = _to_hash(v) }
195
+ end
196
+ elsif value.respond_to? :to_hash
197
+ value.to_hash
198
+ else
199
+ value
200
+ end
201
+ end
202
+ end
203
+ end
@@ -5,7 +5,7 @@ module Phrase
5
5
  # specify the branch to use
6
6
  attr_accessor :branch
7
7
 
8
- # locale id
8
+ # ID of a target locale to update
9
9
  attr_accessor :locale_id
10
10
 
11
11
  # Array of user ids to be assigned to the job locale
@@ -5,7 +5,7 @@ module Phrase
5
5
  # specify the branch to use
6
6
  attr_accessor :branch
7
7
 
8
- # locale id
8
+ # ID of a locale to be added
9
9
  attr_accessor :locale_id
10
10
 
11
11
  # Array of user ids to be assigned to the job locale as translators
@@ -44,7 +44,7 @@ module Phrase
44
44
  # If set, translations for the uploaded language will be fetched automatically.
45
45
  attr_accessor :autotranslate
46
46
 
47
- # Indicated whether the imported translations should be marked as reviewed. This setting is available if the review workflow (currently beta) is enabled for the project.
47
+ # Indicated whether the imported translations should be marked as reviewed. This setting is available if the review workflow is enabled for the project.
48
48
  attr_accessor :mark_reviewed
49
49
 
50
50
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -1,3 +1,3 @@
1
1
  module Phrase
2
- VERSION = '2.12.0'
2
+ VERSION = '2.14.0'
3
3
  end