phrase 4.24.0 → 4.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/README.md +7 -3
- data/docs/BranchComparison.md +23 -0
- data/docs/BranchComparisonChange.md +19 -0
- data/docs/BranchComparisonDiff.md +21 -0
- data/docs/BranchComparisonDiffConflictsValue.md +19 -0
- data/docs/BranchesApi.md +5 -4
- data/docs/Format.md +20 -20
- data/docs/FormatsApi.md +1 -1
- data/docs/Job.md +3 -1
- data/docs/JobDetails.md +2 -0
- data/docs/KeyCreateParameters.md +1 -1
- data/docs/KeyUpdateParameters.md +1 -1
- data/docs/Locale.md +2 -0
- data/docs/LocaleCreateParameters.md +3 -1
- data/docs/LocaleDetails.md +2 -0
- data/docs/LocaleDownloadCreateParameters.md +4 -0
- data/docs/LocaleUpdateParameters.md +3 -1
- data/docs/LocalesApi.md +2 -2
- data/docs/ProjectCreateParameters.md +1 -1
- data/docs/ProjectUpdateParameters.md +1 -1
- data/docs/RepoSync.md +2 -0
- data/docs/RepoSyncCreateParameters.md +2 -0
- data/docs/ScreenshotUpdateParameters.md +1 -1
- data/docs/ScreenshotsApi.md +9 -9
- data/lib/phrase/api/branches_api.rb +5 -3
- data/lib/phrase/api/formats_api.rb +2 -2
- data/lib/phrase/api/locales_api.rb +2 -2
- data/lib/phrase/api/screenshots_api.rb +16 -12
- data/lib/phrase/models/branch_comparison.rb +224 -0
- data/lib/phrase/models/branch_comparison_change.rb +212 -0
- data/lib/phrase/models/branch_comparison_diff.rb +223 -0
- data/lib/phrase/models/branch_comparison_diff_conflicts_value.rb +209 -0
- data/lib/phrase/models/format.rb +60 -0
- data/lib/phrase/models/job.rb +16 -5
- data/lib/phrase/models/job_details.rb +12 -1
- data/lib/phrase/models/locale.rb +10 -1
- data/lib/phrase/models/locale_create_parameters.rb +14 -4
- data/lib/phrase/models/locale_details.rb +10 -1
- data/lib/phrase/models/locale_download_create_parameters.rb +21 -1
- data/lib/phrase/models/locale_update_parameters.rb +14 -4
- data/lib/phrase/models/repo_sync.rb +29 -1
- data/lib/phrase/models/repo_sync_create_parameters.rb +27 -1
- data/lib/phrase/version.rb +1 -1
- data/lib/phrase.rb +4 -0
- data/spec/api/branches_api_spec.rb +1 -1
- data/spec/api/formats_api_spec.rb +1 -1
- data/spec/api/screenshots_api_spec.rb +4 -4
- data/spec/models/branch_comparison_change_spec.rb +35 -0
- data/spec/models/branch_comparison_diff_conflicts_value_spec.rb +35 -0
- data/spec/models/branch_comparison_diff_spec.rb +41 -0
- data/spec/models/branch_comparison_spec.rb +47 -0
- data/spec/models/job_details_spec.rb +6 -0
- data/spec/models/job_spec.rb +6 -0
- data/spec/models/locale_create_parameters_spec.rb +6 -0
- data/spec/models/locale_details_spec.rb +6 -0
- data/spec/models/locale_download_create_parameters_spec.rb +12 -0
- data/spec/models/locale_spec.rb +6 -0
- data/spec/models/locale_update_parameters_spec.rb +6 -0
- data/spec/models/repo_sync_create_parameters_spec.rb +6 -0
- data/spec/models/repo_sync_spec.rb +6 -0
- metadata +18 -2
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
require 'date'
|
|
2
|
+
|
|
3
|
+
module Phrase
|
|
4
|
+
class BranchComparisonDiff
|
|
5
|
+
# Changes made to this resource type in the base branch since the branch was created.
|
|
6
|
+
attr_accessor :base_changes
|
|
7
|
+
|
|
8
|
+
# Changes made to this resource type in the feature branch.
|
|
9
|
+
attr_accessor :head_changes
|
|
10
|
+
|
|
11
|
+
# Conflicting changes present in both branches, keyed by conflict type. Possible conflict type keys: `changed_in_head_changed_in_base`, `added_in_head_added_in_base`, `changed_in_head_deleted_in_base`, `deleted_in_head_changed_in_base`. Each value contains `base` and `head` arrays of changed attribute objects.
|
|
12
|
+
attr_accessor :conflicts
|
|
13
|
+
|
|
14
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
15
|
+
def self.attribute_map
|
|
16
|
+
{
|
|
17
|
+
:'base_changes' => :'base_changes',
|
|
18
|
+
:'head_changes' => :'head_changes',
|
|
19
|
+
:'conflicts' => :'conflicts'
|
|
20
|
+
}
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Attribute type mapping.
|
|
24
|
+
def self.openapi_types
|
|
25
|
+
{
|
|
26
|
+
:'base_changes' => :'Array<BranchComparisonChange>',
|
|
27
|
+
:'head_changes' => :'Array<BranchComparisonChange>',
|
|
28
|
+
:'conflicts' => :'Hash<String, BranchComparisonDiffConflictsValue>'
|
|
29
|
+
}
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# List of attributes with nullable: true
|
|
33
|
+
def self.openapi_nullable
|
|
34
|
+
Set.new([
|
|
35
|
+
])
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Initializes the object
|
|
39
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
40
|
+
def initialize(attributes = {})
|
|
41
|
+
if (!attributes.is_a?(Hash))
|
|
42
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::BranchComparisonDiff` initialize method"
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
46
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
47
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
48
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::BranchComparisonDiff`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
49
|
+
end
|
|
50
|
+
h[k.to_sym] = v
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if attributes.key?(:'base_changes')
|
|
54
|
+
if (value = attributes[:'base_changes']).is_a?(Array)
|
|
55
|
+
self.base_changes = value
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
if attributes.key?(:'head_changes')
|
|
60
|
+
if (value = attributes[:'head_changes']).is_a?(Array)
|
|
61
|
+
self.head_changes = value
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
if attributes.key?(:'conflicts')
|
|
66
|
+
if (value = attributes[:'conflicts']).is_a?(Hash)
|
|
67
|
+
self.conflicts = value
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
73
|
+
# @return Array for valid properties with the reasons
|
|
74
|
+
def list_invalid_properties
|
|
75
|
+
invalid_properties = Array.new
|
|
76
|
+
invalid_properties
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Check to see if the all the properties in the model are valid
|
|
80
|
+
# @return true if the model is valid
|
|
81
|
+
def valid?
|
|
82
|
+
true
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Checks equality by comparing each attribute.
|
|
86
|
+
# @param [Object] Object to be compared
|
|
87
|
+
def ==(o)
|
|
88
|
+
return true if self.equal?(o)
|
|
89
|
+
self.class == o.class &&
|
|
90
|
+
base_changes == o.base_changes &&
|
|
91
|
+
head_changes == o.head_changes &&
|
|
92
|
+
conflicts == o.conflicts
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# @see the `==` method
|
|
96
|
+
# @param [Object] Object to be compared
|
|
97
|
+
def eql?(o)
|
|
98
|
+
self == o
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# Calculates hash code according to all attributes.
|
|
102
|
+
# @return [Integer] Hash code
|
|
103
|
+
def hash
|
|
104
|
+
[base_changes, head_changes, conflicts].hash
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Builds the object from hash
|
|
108
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
109
|
+
# @return [Object] Returns the model itself
|
|
110
|
+
def self.build_from_hash(attributes)
|
|
111
|
+
new.build_from_hash(attributes)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# Builds the object from hash
|
|
115
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
116
|
+
# @return [Object] Returns the model itself
|
|
117
|
+
def build_from_hash(attributes)
|
|
118
|
+
return nil unless attributes.is_a?(Hash)
|
|
119
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
120
|
+
if type =~ /\AArray<(.*)>/i
|
|
121
|
+
# check to ensure the input is an array given that the attribute
|
|
122
|
+
# is documented as an array but the input is not
|
|
123
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
124
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
125
|
+
end
|
|
126
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
127
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
128
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
self
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# Deserializes the data based on type
|
|
135
|
+
# @param string type Data type
|
|
136
|
+
# @param string value Value to be deserialized
|
|
137
|
+
# @return [Object] Deserialized data
|
|
138
|
+
def _deserialize(type, value)
|
|
139
|
+
case type.to_sym
|
|
140
|
+
when :DateTime
|
|
141
|
+
DateTime.parse(value)
|
|
142
|
+
when :Date
|
|
143
|
+
Date.parse(value)
|
|
144
|
+
when :Time
|
|
145
|
+
Time.parse(value)
|
|
146
|
+
when :String
|
|
147
|
+
value.to_s
|
|
148
|
+
when :Integer
|
|
149
|
+
value.to_i
|
|
150
|
+
when :Float
|
|
151
|
+
value.to_f
|
|
152
|
+
when :Boolean
|
|
153
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
154
|
+
true
|
|
155
|
+
else
|
|
156
|
+
false
|
|
157
|
+
end
|
|
158
|
+
when :Object
|
|
159
|
+
# generic object (usually a Hash), return directly
|
|
160
|
+
value
|
|
161
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
162
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
163
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
164
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
165
|
+
k_type = Regexp.last_match[:k_type]
|
|
166
|
+
v_type = Regexp.last_match[:v_type]
|
|
167
|
+
{}.tap do |hash|
|
|
168
|
+
value.each do |k, v|
|
|
169
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
else # model
|
|
173
|
+
Phrase.const_get(type).build_from_hash(value)
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
# Returns the string representation of the object
|
|
178
|
+
# @return [String] String presentation of the object
|
|
179
|
+
def to_s
|
|
180
|
+
to_hash.to_s
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
184
|
+
# @return [Hash] Returns the object in the form of hash
|
|
185
|
+
def to_body
|
|
186
|
+
to_hash
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# Returns the object in the form of hash
|
|
190
|
+
# @return [Hash] Returns the object in the form of hash
|
|
191
|
+
def to_hash
|
|
192
|
+
hash = {}
|
|
193
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
194
|
+
value = self.send(attr)
|
|
195
|
+
if value.nil?
|
|
196
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
197
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
hash[param] = _to_hash(value)
|
|
201
|
+
end
|
|
202
|
+
hash
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
# Outputs non-array value in the form of hash
|
|
206
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
207
|
+
# @param [Object] value Any valid value
|
|
208
|
+
# @return [Hash] Returns the value in the form of hash
|
|
209
|
+
def _to_hash(value)
|
|
210
|
+
if value.is_a?(Array)
|
|
211
|
+
value.compact.map { |v| _to_hash(v) }
|
|
212
|
+
elsif value.is_a?(Hash)
|
|
213
|
+
{}.tap do |hash|
|
|
214
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
215
|
+
end
|
|
216
|
+
elsif value.respond_to? :to_hash
|
|
217
|
+
value.to_hash
|
|
218
|
+
else
|
|
219
|
+
value
|
|
220
|
+
end
|
|
221
|
+
end
|
|
222
|
+
end
|
|
223
|
+
end
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
require 'date'
|
|
2
|
+
|
|
3
|
+
module Phrase
|
|
4
|
+
class BranchComparisonDiffConflictsValue
|
|
5
|
+
attr_accessor :base
|
|
6
|
+
|
|
7
|
+
attr_accessor :head
|
|
8
|
+
|
|
9
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
10
|
+
def self.attribute_map
|
|
11
|
+
{
|
|
12
|
+
:'base' => :'base',
|
|
13
|
+
:'head' => :'head'
|
|
14
|
+
}
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# Attribute type mapping.
|
|
18
|
+
def self.openapi_types
|
|
19
|
+
{
|
|
20
|
+
:'base' => :'Array<Hash<String, Object>>',
|
|
21
|
+
:'head' => :'Array<Hash<String, Object>>'
|
|
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::BranchComparisonDiffConflictsValue` 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::BranchComparisonDiffConflictsValue`. 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?(:'base')
|
|
47
|
+
if (value = attributes[:'base']).is_a?(Array)
|
|
48
|
+
self.base = value
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
if attributes.key?(:'head')
|
|
53
|
+
if (value = attributes[:'head']).is_a?(Array)
|
|
54
|
+
self.head = value
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
60
|
+
# @return Array for valid properties with the reasons
|
|
61
|
+
def list_invalid_properties
|
|
62
|
+
invalid_properties = Array.new
|
|
63
|
+
invalid_properties
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Check to see if the all the properties in the model are valid
|
|
67
|
+
# @return true if the model is valid
|
|
68
|
+
def valid?
|
|
69
|
+
true
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Checks equality by comparing each attribute.
|
|
73
|
+
# @param [Object] Object to be compared
|
|
74
|
+
def ==(o)
|
|
75
|
+
return true if self.equal?(o)
|
|
76
|
+
self.class == o.class &&
|
|
77
|
+
base == o.base &&
|
|
78
|
+
head == o.head
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# @see the `==` method
|
|
82
|
+
# @param [Object] Object to be compared
|
|
83
|
+
def eql?(o)
|
|
84
|
+
self == o
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Calculates hash code according to all attributes.
|
|
88
|
+
# @return [Integer] Hash code
|
|
89
|
+
def hash
|
|
90
|
+
[base, head].hash
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Builds the object from hash
|
|
94
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
95
|
+
# @return [Object] Returns the model itself
|
|
96
|
+
def self.build_from_hash(attributes)
|
|
97
|
+
new.build_from_hash(attributes)
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Builds the object from hash
|
|
101
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
102
|
+
# @return [Object] Returns the model itself
|
|
103
|
+
def build_from_hash(attributes)
|
|
104
|
+
return nil unless attributes.is_a?(Hash)
|
|
105
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
106
|
+
if type =~ /\AArray<(.*)>/i
|
|
107
|
+
# check to ensure the input is an array given that the attribute
|
|
108
|
+
# is documented as an array but the input is not
|
|
109
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
110
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
111
|
+
end
|
|
112
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
113
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
114
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
self
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# Deserializes the data based on type
|
|
121
|
+
# @param string type Data type
|
|
122
|
+
# @param string value Value to be deserialized
|
|
123
|
+
# @return [Object] Deserialized data
|
|
124
|
+
def _deserialize(type, value)
|
|
125
|
+
case type.to_sym
|
|
126
|
+
when :DateTime
|
|
127
|
+
DateTime.parse(value)
|
|
128
|
+
when :Date
|
|
129
|
+
Date.parse(value)
|
|
130
|
+
when :Time
|
|
131
|
+
Time.parse(value)
|
|
132
|
+
when :String
|
|
133
|
+
value.to_s
|
|
134
|
+
when :Integer
|
|
135
|
+
value.to_i
|
|
136
|
+
when :Float
|
|
137
|
+
value.to_f
|
|
138
|
+
when :Boolean
|
|
139
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
140
|
+
true
|
|
141
|
+
else
|
|
142
|
+
false
|
|
143
|
+
end
|
|
144
|
+
when :Object
|
|
145
|
+
# generic object (usually a Hash), return directly
|
|
146
|
+
value
|
|
147
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
148
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
149
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
150
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
151
|
+
k_type = Regexp.last_match[:k_type]
|
|
152
|
+
v_type = Regexp.last_match[:v_type]
|
|
153
|
+
{}.tap do |hash|
|
|
154
|
+
value.each do |k, v|
|
|
155
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
else # model
|
|
159
|
+
Phrase.const_get(type).build_from_hash(value)
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
# Returns the string representation of the object
|
|
164
|
+
# @return [String] String presentation of the object
|
|
165
|
+
def to_s
|
|
166
|
+
to_hash.to_s
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
170
|
+
# @return [Hash] Returns the object in the form of hash
|
|
171
|
+
def to_body
|
|
172
|
+
to_hash
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
# Returns the object in the form of hash
|
|
176
|
+
# @return [Hash] Returns the object in the form of hash
|
|
177
|
+
def to_hash
|
|
178
|
+
hash = {}
|
|
179
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
180
|
+
value = self.send(attr)
|
|
181
|
+
if value.nil?
|
|
182
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
183
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
hash[param] = _to_hash(value)
|
|
187
|
+
end
|
|
188
|
+
hash
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
# Outputs non-array value in the form of hash
|
|
192
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
193
|
+
# @param [Object] value Any valid value
|
|
194
|
+
# @return [Hash] Returns the value in the form of hash
|
|
195
|
+
def _to_hash(value)
|
|
196
|
+
if value.is_a?(Array)
|
|
197
|
+
value.compact.map { |v| _to_hash(v) }
|
|
198
|
+
elsif value.is_a?(Hash)
|
|
199
|
+
{}.tap do |hash|
|
|
200
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
201
|
+
end
|
|
202
|
+
elsif value.respond_to? :to_hash
|
|
203
|
+
value.to_hash
|
|
204
|
+
else
|
|
205
|
+
value
|
|
206
|
+
end
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
end
|
data/lib/phrase/models/format.rb
CHANGED
|
@@ -2,24 +2,34 @@ require 'date'
|
|
|
2
2
|
|
|
3
3
|
module Phrase
|
|
4
4
|
class Format
|
|
5
|
+
# Human-readable display name of the format.
|
|
5
6
|
attr_accessor :name
|
|
6
7
|
|
|
8
|
+
# Identifier used to reference this format in API requests, such as the file_format parameter on the uploads and downloads endpoints.
|
|
7
9
|
attr_accessor :api_name
|
|
8
10
|
|
|
11
|
+
# Human-readable summary of the format and its typical use case.
|
|
9
12
|
attr_accessor :description
|
|
10
13
|
|
|
14
|
+
# Default file extension associated with this format.
|
|
11
15
|
attr_accessor :extension
|
|
12
16
|
|
|
17
|
+
# Default character encoding used when reading or writing files in this format.
|
|
13
18
|
attr_accessor :default_encoding
|
|
14
19
|
|
|
20
|
+
# Whether locale files can be imported using this format.
|
|
15
21
|
attr_accessor :importable
|
|
16
22
|
|
|
23
|
+
# Whether locale files can be exported using this format.
|
|
17
24
|
attr_accessor :exportable
|
|
18
25
|
|
|
26
|
+
# Conventional file path pattern for this format. Contains locale_name as a placeholder for the locale identifier.
|
|
19
27
|
attr_accessor :default_file
|
|
20
28
|
|
|
29
|
+
# When true, exported files contain the default locale's content for any key that has no translation in the target locale.
|
|
21
30
|
attr_accessor :renders_default_locale
|
|
22
31
|
|
|
32
|
+
# When true, files in this format embed locale information so Phrase can detect the locale automatically on import.
|
|
23
33
|
attr_accessor :includes_locale_information
|
|
24
34
|
|
|
25
35
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
@@ -120,12 +130,62 @@ module Phrase
|
|
|
120
130
|
# @return Array for valid properties with the reasons
|
|
121
131
|
def list_invalid_properties
|
|
122
132
|
invalid_properties = Array.new
|
|
133
|
+
if @name.nil?
|
|
134
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
if @api_name.nil?
|
|
138
|
+
invalid_properties.push('invalid value for "api_name", api_name cannot be nil.')
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
if @description.nil?
|
|
142
|
+
invalid_properties.push('invalid value for "description", description cannot be nil.')
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
if @extension.nil?
|
|
146
|
+
invalid_properties.push('invalid value for "extension", extension cannot be nil.')
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
if @default_encoding.nil?
|
|
150
|
+
invalid_properties.push('invalid value for "default_encoding", default_encoding cannot be nil.')
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
if @importable.nil?
|
|
154
|
+
invalid_properties.push('invalid value for "importable", importable cannot be nil.')
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
if @exportable.nil?
|
|
158
|
+
invalid_properties.push('invalid value for "exportable", exportable cannot be nil.')
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
if @default_file.nil?
|
|
162
|
+
invalid_properties.push('invalid value for "default_file", default_file cannot be nil.')
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
if @renders_default_locale.nil?
|
|
166
|
+
invalid_properties.push('invalid value for "renders_default_locale", renders_default_locale cannot be nil.')
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
if @includes_locale_information.nil?
|
|
170
|
+
invalid_properties.push('invalid value for "includes_locale_information", includes_locale_information cannot be nil.')
|
|
171
|
+
end
|
|
172
|
+
|
|
123
173
|
invalid_properties
|
|
124
174
|
end
|
|
125
175
|
|
|
126
176
|
# Check to see if the all the properties in the model are valid
|
|
127
177
|
# @return true if the model is valid
|
|
128
178
|
def valid?
|
|
179
|
+
return false if @name.nil?
|
|
180
|
+
return false if @api_name.nil?
|
|
181
|
+
return false if @description.nil?
|
|
182
|
+
return false if @extension.nil?
|
|
183
|
+
return false if @default_encoding.nil?
|
|
184
|
+
return false if @importable.nil?
|
|
185
|
+
return false if @exportable.nil?
|
|
186
|
+
return false if @default_file.nil?
|
|
187
|
+
return false if @renders_default_locale.nil?
|
|
188
|
+
return false if @includes_locale_information.nil?
|
|
129
189
|
true
|
|
130
190
|
end
|
|
131
191
|
|
data/lib/phrase/models/job.rb
CHANGED
|
@@ -28,6 +28,9 @@ module Phrase
|
|
|
28
28
|
# The ID of the job template this job was created from, or null if no template was used.
|
|
29
29
|
attr_accessor :job_template_id
|
|
30
30
|
|
|
31
|
+
# The review due date for this job. Returns `null` when the project does not have review workflow enabled.
|
|
32
|
+
attr_accessor :review_due_date
|
|
33
|
+
|
|
31
34
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
32
35
|
def self.attribute_map
|
|
33
36
|
{
|
|
@@ -42,7 +45,8 @@ module Phrase
|
|
|
42
45
|
:'created_at' => :'created_at',
|
|
43
46
|
:'updated_at' => :'updated_at',
|
|
44
47
|
:'automation_id' => :'automation_id',
|
|
45
|
-
:'job_template_id' => :'job_template_id'
|
|
48
|
+
:'job_template_id' => :'job_template_id',
|
|
49
|
+
:'review_due_date' => :'review_due_date'
|
|
46
50
|
}
|
|
47
51
|
end
|
|
48
52
|
|
|
@@ -60,7 +64,8 @@ module Phrase
|
|
|
60
64
|
:'created_at' => :'DateTime',
|
|
61
65
|
:'updated_at' => :'DateTime',
|
|
62
66
|
:'automation_id' => :'String',
|
|
63
|
-
:'job_template_id' => :'String'
|
|
67
|
+
:'job_template_id' => :'String',
|
|
68
|
+
:'review_due_date' => :'DateTime'
|
|
64
69
|
}
|
|
65
70
|
end
|
|
66
71
|
|
|
@@ -69,7 +74,8 @@ module Phrase
|
|
|
69
74
|
Set.new([
|
|
70
75
|
:'due_date',
|
|
71
76
|
:'automation_id',
|
|
72
|
-
:'job_template_id'
|
|
77
|
+
:'job_template_id',
|
|
78
|
+
:'review_due_date'
|
|
73
79
|
])
|
|
74
80
|
end
|
|
75
81
|
|
|
@@ -135,6 +141,10 @@ module Phrase
|
|
|
135
141
|
if attributes.key?(:'job_template_id')
|
|
136
142
|
self.job_template_id = attributes[:'job_template_id']
|
|
137
143
|
end
|
|
144
|
+
|
|
145
|
+
if attributes.key?(:'review_due_date')
|
|
146
|
+
self.review_due_date = attributes[:'review_due_date']
|
|
147
|
+
end
|
|
138
148
|
end
|
|
139
149
|
|
|
140
150
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
@@ -166,7 +176,8 @@ module Phrase
|
|
|
166
176
|
created_at == o.created_at &&
|
|
167
177
|
updated_at == o.updated_at &&
|
|
168
178
|
automation_id == o.automation_id &&
|
|
169
|
-
job_template_id == o.job_template_id
|
|
179
|
+
job_template_id == o.job_template_id &&
|
|
180
|
+
review_due_date == o.review_due_date
|
|
170
181
|
end
|
|
171
182
|
|
|
172
183
|
# @see the `==` method
|
|
@@ -178,7 +189,7 @@ module Phrase
|
|
|
178
189
|
# Calculates hash code according to all attributes.
|
|
179
190
|
# @return [Integer] Hash code
|
|
180
191
|
def hash
|
|
181
|
-
[id, name, briefing, due_date, state, ticket_url, project, branch, created_at, updated_at, automation_id, job_template_id].hash
|
|
192
|
+
[id, name, briefing, due_date, state, ticket_url, project, branch, created_at, updated_at, automation_id, job_template_id, review_due_date].hash
|
|
182
193
|
end
|
|
183
194
|
|
|
184
195
|
# Builds the object from hash
|
|
@@ -28,6 +28,9 @@ module Phrase
|
|
|
28
28
|
# The ID of the job template this job was created from, or null if no template was used.
|
|
29
29
|
attr_accessor :job_template_id
|
|
30
30
|
|
|
31
|
+
# The review due date for this job. Returns `null` when the project does not have review workflow enabled.
|
|
32
|
+
attr_accessor :review_due_date
|
|
33
|
+
|
|
31
34
|
attr_accessor :owner
|
|
32
35
|
|
|
33
36
|
attr_accessor :job_tag_name
|
|
@@ -61,6 +64,7 @@ module Phrase
|
|
|
61
64
|
:'updated_at' => :'updated_at',
|
|
62
65
|
:'automation_id' => :'automation_id',
|
|
63
66
|
:'job_template_id' => :'job_template_id',
|
|
67
|
+
:'review_due_date' => :'review_due_date',
|
|
64
68
|
:'owner' => :'owner',
|
|
65
69
|
:'job_tag_name' => :'job_tag_name',
|
|
66
70
|
:'source_translations_updated_at' => :'source_translations_updated_at',
|
|
@@ -87,6 +91,7 @@ module Phrase
|
|
|
87
91
|
:'updated_at' => :'DateTime',
|
|
88
92
|
:'automation_id' => :'String',
|
|
89
93
|
:'job_template_id' => :'String',
|
|
94
|
+
:'review_due_date' => :'DateTime',
|
|
90
95
|
:'owner' => :'UserPreview',
|
|
91
96
|
:'job_tag_name' => :'String',
|
|
92
97
|
:'source_translations_updated_at' => :'DateTime',
|
|
@@ -104,6 +109,7 @@ module Phrase
|
|
|
104
109
|
:'due_date',
|
|
105
110
|
:'automation_id',
|
|
106
111
|
:'job_template_id',
|
|
112
|
+
:'review_due_date',
|
|
107
113
|
])
|
|
108
114
|
end
|
|
109
115
|
|
|
@@ -177,6 +183,10 @@ module Phrase
|
|
|
177
183
|
self.job_template_id = attributes[:'job_template_id']
|
|
178
184
|
end
|
|
179
185
|
|
|
186
|
+
if attributes.key?(:'review_due_date')
|
|
187
|
+
self.review_due_date = attributes[:'review_due_date']
|
|
188
|
+
end
|
|
189
|
+
|
|
180
190
|
if attributes.key?(:'owner')
|
|
181
191
|
self.owner = attributes[:'owner']
|
|
182
192
|
end
|
|
@@ -246,6 +256,7 @@ module Phrase
|
|
|
246
256
|
updated_at == o.updated_at &&
|
|
247
257
|
automation_id == o.automation_id &&
|
|
248
258
|
job_template_id == o.job_template_id &&
|
|
259
|
+
review_due_date == o.review_due_date &&
|
|
249
260
|
owner == o.owner &&
|
|
250
261
|
job_tag_name == o.job_tag_name &&
|
|
251
262
|
source_translations_updated_at == o.source_translations_updated_at &&
|
|
@@ -265,7 +276,7 @@ module Phrase
|
|
|
265
276
|
# Calculates hash code according to all attributes.
|
|
266
277
|
# @return [Integer] Hash code
|
|
267
278
|
def hash
|
|
268
|
-
[id, name, briefing, due_date, state, ticket_url, project, branch, created_at, updated_at, automation_id, job_template_id, owner, job_tag_name, source_translations_updated_at, source_locale, locales, keys, annotations, locked].hash
|
|
279
|
+
[id, name, briefing, due_date, state, ticket_url, project, branch, created_at, updated_at, automation_id, job_template_id, review_due_date, owner, job_tag_name, source_translations_updated_at, source_locale, locales, keys, annotations, locked].hash
|
|
269
280
|
end
|
|
270
281
|
|
|
271
282
|
# Builds the object from hash
|