phrase 4.32.0 → 4.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -0
  3. data/Gemfile +1 -1
  4. data/README.md +6 -3
  5. data/docs/JobCreateParameters.md +4 -2
  6. data/docs/JobDetails.md +3 -1
  7. data/docs/JobTemplateCreateParameters.md +2 -0
  8. data/docs/JobTemplateDetails.md +3 -1
  9. data/docs/JobTemplateUpdateParameters.md +2 -0
  10. data/docs/JobUpdateParameters.md +3 -1
  11. data/docs/KeysApi.md +6 -2
  12. data/docs/OrganizationJobTemplateCreateParameters.md +2 -0
  13. data/docs/OrganizationJobTemplateDetails.md +3 -1
  14. data/docs/OrganizationJobTemplateUpdateParameters.md +2 -0
  15. data/docs/RepoSyncEvent.md +3 -1
  16. data/docs/RepoSyncEventUploadsInner.md +19 -0
  17. data/docs/TranslationKey.md +3 -1
  18. data/docs/TranslationKeyDetails.md +2 -0
  19. data/docs/TranslationKeyLinkedKey.md +21 -0
  20. data/docs/TranslationKeyLinkedKeyParent.md +19 -0
  21. data/docs/TranslationsApi.md +7 -7
  22. data/docs/TranslationsExcludeParameters.md +2 -2
  23. data/docs/TranslationsIncludeParameters.md +2 -2
  24. data/docs/TranslationsReviewParameters.md +2 -2
  25. data/docs/TranslationsSearchParameters.md +2 -2
  26. data/docs/TranslationsUnreviewParameters.md +2 -2
  27. data/docs/TranslationsUnverifyParameters.md +2 -2
  28. data/docs/TranslationsVerifyParameters.md +2 -2
  29. data/lib/phrase/api/keys_api.rb +6 -0
  30. data/lib/phrase/api/translations_api.rb +8 -8
  31. data/lib/phrase/models/job_create_parameters.rb +15 -5
  32. data/lib/phrase/models/job_details.rb +14 -4
  33. data/lib/phrase/models/job_template_create_parameters.rb +11 -1
  34. data/lib/phrase/models/job_template_details.rb +14 -4
  35. data/lib/phrase/models/job_template_update_parameters.rb +11 -1
  36. data/lib/phrase/models/job_update_parameters.rb +14 -4
  37. data/lib/phrase/models/organization_job_template_create_parameters.rb +11 -1
  38. data/lib/phrase/models/organization_job_template_details.rb +14 -4
  39. data/lib/phrase/models/organization_job_template_update_parameters.rb +11 -1
  40. data/lib/phrase/models/repo_sync_event.rb +17 -4
  41. data/lib/phrase/models/repo_sync_event_uploads_inner.rb +241 -0
  42. data/lib/phrase/models/translation_key.rb +14 -4
  43. data/lib/phrase/models/translation_key_details.rb +11 -1
  44. data/lib/phrase/models/translation_key_linked_key.rb +253 -0
  45. data/lib/phrase/models/translation_key_linked_key_parent.rb +208 -0
  46. data/lib/phrase/models/translations_exclude_parameters.rb +1 -1
  47. data/lib/phrase/models/translations_include_parameters.rb +1 -1
  48. data/lib/phrase/models/translations_review_parameters.rb +1 -1
  49. data/lib/phrase/models/translations_search_parameters.rb +1 -1
  50. data/lib/phrase/models/translations_unreview_parameters.rb +1 -1
  51. data/lib/phrase/models/translations_unverify_parameters.rb +1 -1
  52. data/lib/phrase/models/translations_verify_parameters.rb +1 -1
  53. data/lib/phrase/version.rb +1 -1
  54. data/lib/phrase.rb +3 -0
  55. data/spec/api/keys_api_spec.rb +2 -0
  56. data/spec/api/translations_api_spec.rb +4 -4
  57. data/spec/models/job_create_parameters_spec.rb +6 -0
  58. data/spec/models/job_details_spec.rb +6 -0
  59. data/spec/models/job_template_create_parameters_spec.rb +6 -0
  60. data/spec/models/job_template_details_spec.rb +6 -0
  61. data/spec/models/job_template_update_parameters_spec.rb +6 -0
  62. data/spec/models/job_update_parameters_spec.rb +6 -0
  63. data/spec/models/organization_job_template_create_parameters_spec.rb +6 -0
  64. data/spec/models/organization_job_template_details_spec.rb +6 -0
  65. data/spec/models/organization_job_template_update_parameters_spec.rb +6 -0
  66. data/spec/models/repo_sync_event_spec.rb +6 -0
  67. data/spec/models/repo_sync_event_uploads_inner_spec.rb +39 -0
  68. data/spec/models/translation_key_details_spec.rb +6 -0
  69. data/spec/models/translation_key_linked_key_parent_spec.rb +35 -0
  70. data/spec/models/translation_key_linked_key_spec.rb +45 -0
  71. data/spec/models/translation_key_spec.rb +6 -0
  72. metadata +280 -268
@@ -11,6 +11,9 @@ module Phrase
11
11
  # Automatically translate the job using machine translation.
12
12
  attr_accessor :autotranslate
13
13
 
14
+ # Exclude linked child keys from jobs created from this template.
15
+ attr_accessor :exclude_linked_child_keys
16
+
14
17
  # Code of the account member to set as the job template owner. Pass an empty string to clear a previously set owner; when blank, the owner is set to null and jobs created from this template will default to assigning the job creator as owner.
15
18
  attr_accessor :owner_id
16
19
 
@@ -20,6 +23,7 @@ module Phrase
20
23
  :'name' => :'name',
21
24
  :'briefing' => :'briefing',
22
25
  :'autotranslate' => :'autotranslate',
26
+ :'exclude_linked_child_keys' => :'exclude_linked_child_keys',
23
27
  :'owner_id' => :'owner_id'
24
28
  }
25
29
  end
@@ -30,6 +34,7 @@ module Phrase
30
34
  :'name' => :'String',
31
35
  :'briefing' => :'String',
32
36
  :'autotranslate' => :'Boolean',
37
+ :'exclude_linked_child_keys' => :'Boolean',
33
38
  :'owner_id' => :'String'
34
39
  }
35
40
  end
@@ -68,6 +73,10 @@ module Phrase
68
73
  self.autotranslate = attributes[:'autotranslate']
69
74
  end
70
75
 
76
+ if attributes.key?(:'exclude_linked_child_keys')
77
+ self.exclude_linked_child_keys = attributes[:'exclude_linked_child_keys']
78
+ end
79
+
71
80
  if attributes.key?(:'owner_id')
72
81
  self.owner_id = attributes[:'owner_id']
73
82
  end
@@ -99,6 +108,7 @@ module Phrase
99
108
  name == o.name &&
100
109
  briefing == o.briefing &&
101
110
  autotranslate == o.autotranslate &&
111
+ exclude_linked_child_keys == o.exclude_linked_child_keys &&
102
112
  owner_id == o.owner_id
103
113
  end
104
114
 
@@ -111,7 +121,7 @@ module Phrase
111
121
  # Calculates hash code according to all attributes.
112
122
  # @return [Integer] Hash code
113
123
  def hash
114
- [name, briefing, autotranslate, owner_id].hash
124
+ [name, briefing, autotranslate, exclude_linked_child_keys, owner_id].hash
115
125
  end
116
126
 
117
127
  # Builds the object from hash
@@ -19,6 +19,9 @@ module Phrase
19
19
  # List of error messages, in case of failure
20
20
  attr_accessor :errors
21
21
 
22
+ # The uploads associated with this import event, or `null` if no upload batch has been created yet. Each entry identifies a single file upload by its public code (`id`) and its current public state (`state`). Present on show responses only; absent from list responses. Possible `state` values: `initialized`, `waiting_for_preview`, `processing`, `success`, `error`.
23
+ attr_accessor :uploads
24
+
22
25
  class EnumAttributeValidator
23
26
  attr_reader :datatype
24
27
  attr_reader :allowable_values
@@ -50,7 +53,8 @@ module Phrase
50
53
  :'status' => :'status',
51
54
  :'pull_request_url' => :'pull_request_url',
52
55
  :'auto_import' => :'auto_import',
53
- :'errors' => :'errors'
56
+ :'errors' => :'errors',
57
+ :'uploads' => :'uploads'
54
58
  }
55
59
  end
56
60
 
@@ -63,13 +67,15 @@ module Phrase
63
67
  :'status' => :'String',
64
68
  :'pull_request_url' => :'String',
65
69
  :'auto_import' => :'Boolean',
66
- :'errors' => :'Array<String>'
70
+ :'errors' => :'Array<String>',
71
+ :'uploads' => :'Array<RepoSyncEventUploadsInner>'
67
72
  }
68
73
  end
69
74
 
70
75
  # List of attributes with nullable: true
71
76
  def self.openapi_nullable
72
77
  Set.new([
78
+ :'uploads'
73
79
  ])
74
80
  end
75
81
 
@@ -117,6 +123,12 @@ module Phrase
117
123
  self.errors = value
118
124
  end
119
125
  end
126
+
127
+ if attributes.key?(:'uploads')
128
+ if (value = attributes[:'uploads']).is_a?(Array)
129
+ self.uploads = value
130
+ end
131
+ end
120
132
  end
121
133
 
122
134
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -167,7 +179,8 @@ module Phrase
167
179
  status == o.status &&
168
180
  pull_request_url == o.pull_request_url &&
169
181
  auto_import == o.auto_import &&
170
- errors == o.errors
182
+ errors == o.errors &&
183
+ uploads == o.uploads
171
184
  end
172
185
 
173
186
  # @see the `==` method
@@ -179,7 +192,7 @@ module Phrase
179
192
  # Calculates hash code according to all attributes.
180
193
  # @return [Integer] Hash code
181
194
  def hash
182
- [id, type, created_at, status, pull_request_url, auto_import, errors].hash
195
+ [id, type, created_at, status, pull_request_url, auto_import, errors, uploads].hash
183
196
  end
184
197
 
185
198
  # Builds the object from hash
@@ -0,0 +1,241 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class RepoSyncEventUploadsInner
5
+ # The upload's public identifier (code).
6
+ attr_accessor :id
7
+
8
+ # The upload's current public state. Multiple internal processing states are collapsed to `processing`; both internal error states are collapsed to `error`.
9
+ attr_accessor :state
10
+
11
+ class EnumAttributeValidator
12
+ attr_reader :datatype
13
+ attr_reader :allowable_values
14
+
15
+ def initialize(datatype, allowable_values)
16
+ @allowable_values = allowable_values.map do |value|
17
+ case datatype.to_s
18
+ when /Integer/i
19
+ value.to_i
20
+ when /Float/i
21
+ value.to_f
22
+ else
23
+ value
24
+ end
25
+ end
26
+ end
27
+
28
+ def valid?(value)
29
+ !value || allowable_values.include?(value)
30
+ end
31
+ end
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'id' => :'id',
37
+ :'state' => :'state'
38
+ }
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'id' => :'String',
45
+ :'state' => :'String'
46
+ }
47
+ end
48
+
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ ])
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::RepoSyncEventUploadsInner` initialize method"
60
+ end
61
+
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!self.class.attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::RepoSyncEventUploadsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'id')
71
+ self.id = attributes[:'id']
72
+ end
73
+
74
+ if attributes.key?(:'state')
75
+ self.state = attributes[:'state']
76
+ end
77
+ end
78
+
79
+ # Show invalid properties with the reasons. Usually used together with valid?
80
+ # @return Array for valid properties with the reasons
81
+ def list_invalid_properties
82
+ invalid_properties = Array.new
83
+ invalid_properties
84
+ end
85
+
86
+ # Check to see if the all the properties in the model are valid
87
+ # @return true if the model is valid
88
+ def valid?
89
+ state_validator = EnumAttributeValidator.new('String', ["initialized", "waiting_for_preview", "processing", "success", "error"])
90
+ return false unless state_validator.valid?(@state)
91
+ true
92
+ end
93
+
94
+ # Custom attribute writer method checking allowed values (enum).
95
+ # @param [Object] state Object to be assigned
96
+ def state=(state)
97
+ validator = EnumAttributeValidator.new('String', ["initialized", "waiting_for_preview", "processing", "success", "error"])
98
+ unless validator.valid?(state)
99
+ fail ArgumentError, "invalid value for \"state\", must be one of #{validator.allowable_values}."
100
+ end
101
+ @state = state
102
+ end
103
+
104
+ # Checks equality by comparing each attribute.
105
+ # @param [Object] Object to be compared
106
+ def ==(o)
107
+ return true if self.equal?(o)
108
+ self.class == o.class &&
109
+ id == o.id &&
110
+ state == o.state
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, state].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 :Time
163
+ Time.parse(value)
164
+ when :String
165
+ value.to_s
166
+ when :Integer
167
+ value.to_i
168
+ when :Float
169
+ value.to_f
170
+ when :Boolean
171
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
172
+ true
173
+ else
174
+ false
175
+ end
176
+ when :Object
177
+ # generic object (usually a Hash), return directly
178
+ value
179
+ when /\AArray<(?<inner_type>.+)>\z/
180
+ inner_type = Regexp.last_match[:inner_type]
181
+ value.map { |v| _deserialize(inner_type, v) }
182
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
183
+ k_type = Regexp.last_match[:k_type]
184
+ v_type = Regexp.last_match[:v_type]
185
+ {}.tap do |hash|
186
+ value.each do |k, v|
187
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
188
+ end
189
+ end
190
+ else # model
191
+ Phrase.const_get(type).build_from_hash(value)
192
+ end
193
+ end
194
+
195
+ # Returns the string representation of the object
196
+ # @return [String] String presentation of the object
197
+ def to_s
198
+ to_hash.to_s
199
+ end
200
+
201
+ # to_body is an alias to to_hash (backward compatibility)
202
+ # @return [Hash] Returns the object in the form of hash
203
+ def to_body
204
+ to_hash
205
+ end
206
+
207
+ # Returns the object in the form of hash
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_hash
210
+ hash = {}
211
+ self.class.attribute_map.each_pair do |attr, param|
212
+ value = self.send(attr)
213
+ if value.nil?
214
+ is_nullable = self.class.openapi_nullable.include?(attr)
215
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
216
+ end
217
+
218
+ hash[param] = _to_hash(value)
219
+ end
220
+ hash
221
+ end
222
+
223
+ # Outputs non-array value in the form of hash
224
+ # For object, use to_hash. Otherwise, just return the value
225
+ # @param [Object] value Any valid value
226
+ # @return [Hash] Returns the value in the form of hash
227
+ def _to_hash(value)
228
+ if value.is_a?(Array)
229
+ value.compact.map { |v| _to_hash(v) }
230
+ elsif value.is_a?(Hash)
231
+ {}.tap do |hash|
232
+ value.each { |k, v| hash[k] = _to_hash(v) }
233
+ end
234
+ elsif value.respond_to? :to_hash
235
+ value.to_hash
236
+ else
237
+ value
238
+ end
239
+ end
240
+ end
241
+ end
@@ -22,6 +22,8 @@ module Phrase
22
22
 
23
23
  attr_accessor :updated_at
24
24
 
25
+ attr_accessor :linked_key
26
+
25
27
  # Attribute mapping from ruby-style variable name to JSON key.
26
28
  def self.attribute_map
27
29
  {
@@ -34,7 +36,8 @@ module Phrase
34
36
  :'tags' => :'tags',
35
37
  :'data_type' => :'data_type',
36
38
  :'created_at' => :'created_at',
37
- :'updated_at' => :'updated_at'
39
+ :'updated_at' => :'updated_at',
40
+ :'linked_key' => :'linked_key'
38
41
  }
39
42
  end
40
43
 
@@ -50,13 +53,15 @@ module Phrase
50
53
  :'tags' => :'Array<String>',
51
54
  :'data_type' => :'String',
52
55
  :'created_at' => :'DateTime',
53
- :'updated_at' => :'DateTime'
56
+ :'updated_at' => :'DateTime',
57
+ :'linked_key' => :'TranslationKeyLinkedKey'
54
58
  }
55
59
  end
56
60
 
57
61
  # List of attributes with nullable: true
58
62
  def self.openapi_nullable
59
63
  Set.new([
64
+ :'linked_key'
60
65
  ])
61
66
  end
62
67
 
@@ -116,6 +121,10 @@ module Phrase
116
121
  if attributes.key?(:'updated_at')
117
122
  self.updated_at = attributes[:'updated_at']
118
123
  end
124
+
125
+ if attributes.key?(:'linked_key')
126
+ self.linked_key = attributes[:'linked_key']
127
+ end
119
128
  end
120
129
 
121
130
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -145,7 +154,8 @@ module Phrase
145
154
  tags == o.tags &&
146
155
  data_type == o.data_type &&
147
156
  created_at == o.created_at &&
148
- updated_at == o.updated_at
157
+ updated_at == o.updated_at &&
158
+ linked_key == o.linked_key
149
159
  end
150
160
 
151
161
  # @see the `==` method
@@ -157,7 +167,7 @@ module Phrase
157
167
  # Calculates hash code according to all attributes.
158
168
  # @return [Integer] Hash code
159
169
  def hash
160
- [id, name, description, name_hash, plural, use_ordinal_rules, tags, data_type, created_at, updated_at].hash
170
+ [id, name, description, name_hash, plural, use_ordinal_rules, tags, data_type, created_at, updated_at, linked_key].hash
161
171
  end
162
172
 
163
173
  # Builds the object from hash
@@ -22,6 +22,8 @@ module Phrase
22
22
 
23
23
  attr_accessor :updated_at
24
24
 
25
+ attr_accessor :linked_key
26
+
25
27
  attr_accessor :name_plural
26
28
 
27
29
  attr_accessor :comments_count
@@ -55,6 +57,7 @@ module Phrase
55
57
  :'data_type' => :'data_type',
56
58
  :'created_at' => :'created_at',
57
59
  :'updated_at' => :'updated_at',
60
+ :'linked_key' => :'linked_key',
58
61
  :'name_plural' => :'name_plural',
59
62
  :'comments_count' => :'comments_count',
60
63
  :'max_characters_allowed' => :'max_characters_allowed',
@@ -81,6 +84,7 @@ module Phrase
81
84
  :'data_type' => :'String',
82
85
  :'created_at' => :'DateTime',
83
86
  :'updated_at' => :'DateTime',
87
+ :'linked_key' => :'TranslationKeyLinkedKey',
84
88
  :'name_plural' => :'String',
85
89
  :'comments_count' => :'Integer',
86
90
  :'max_characters_allowed' => :'Integer',
@@ -97,6 +101,7 @@ module Phrase
97
101
  # List of attributes with nullable: true
98
102
  def self.openapi_nullable
99
103
  Set.new([
104
+ :'linked_key',
100
105
  ])
101
106
  end
102
107
 
@@ -164,6 +169,10 @@ module Phrase
164
169
  self.updated_at = attributes[:'updated_at']
165
170
  end
166
171
 
172
+ if attributes.key?(:'linked_key')
173
+ self.linked_key = attributes[:'linked_key']
174
+ end
175
+
167
176
  if attributes.key?(:'name_plural')
168
177
  self.name_plural = attributes[:'name_plural']
169
178
  end
@@ -235,6 +244,7 @@ module Phrase
235
244
  data_type == o.data_type &&
236
245
  created_at == o.created_at &&
237
246
  updated_at == o.updated_at &&
247
+ linked_key == o.linked_key &&
238
248
  name_plural == o.name_plural &&
239
249
  comments_count == o.comments_count &&
240
250
  max_characters_allowed == o.max_characters_allowed &&
@@ -256,7 +266,7 @@ module Phrase
256
266
  # Calculates hash code according to all attributes.
257
267
  # @return [Integer] Hash code
258
268
  def hash
259
- [id, name, description, name_hash, plural, use_ordinal_rules, tags, data_type, created_at, updated_at, name_plural, comments_count, max_characters_allowed, screenshot_url, unformatted, xml_space_preserve, original_file, format_value_type, creator, custom_metadata].hash
269
+ [id, name, description, name_hash, plural, use_ordinal_rules, tags, data_type, created_at, updated_at, linked_key, name_plural, comments_count, max_characters_allowed, screenshot_url, unformatted, xml_space_preserve, original_file, format_value_type, creator, custom_metadata].hash
260
270
  end
261
271
 
262
272
  # Builds the object from hash