phrase 3.6.0 → 3.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/README.md +4 -3
- data/docs/CommentCreateParameters.md +5 -3
- data/docs/CommentCreateParameters1.md +19 -0
- data/docs/CommentRepliesApi.md +6 -8
- data/docs/CommentsApi.md +2 -6
- data/docs/KeyCreateParameters.md +3 -1
- data/docs/KeyUpdateParameters.md +1 -1
- data/docs/ProjectCreateParameters.md +1 -1
- data/docs/ProjectUpdateParameters.md +1 -1
- data/docs/ScreenshotUpdateParameters.md +1 -1
- data/docs/UploadsApi.md +2 -2
- data/lib/phrase/api/comment_replies_api.rb +12 -10
- data/lib/phrase/api/comments_api.rb +0 -6
- data/lib/phrase/api/uploads_api.rb +2 -2
- data/lib/phrase/models/comment_create_parameters.rb +25 -8
- data/lib/phrase/models/comment_create_parameters1.rb +212 -0
- data/lib/phrase/models/key_create_parameters.rb +11 -1
- data/lib/phrase/version.rb +1 -1
- data/lib/phrase.rb +1 -0
- data/spec/api/comment_replies_api_spec.rb +1 -2
- data/spec/api/comments_api_spec.rb +0 -2
- data/spec/models/comment_create_parameters1_spec.rb +35 -0
- data/spec/models/comment_create_parameters_spec.rb +7 -1
- data/spec/models/key_create_parameters_spec.rb +6 -0
- metadata +247 -243
@@ -0,0 +1,212 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module Phrase
|
4
|
+
class CommentCreateParameters1
|
5
|
+
# Reply message body
|
6
|
+
attr_accessor :message
|
7
|
+
|
8
|
+
# Specify the branch to use
|
9
|
+
attr_accessor :branch
|
10
|
+
|
11
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
12
|
+
def self.attribute_map
|
13
|
+
{
|
14
|
+
:'message' => :'message',
|
15
|
+
:'branch' => :'branch'
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
# Attribute type mapping.
|
20
|
+
def self.openapi_types
|
21
|
+
{
|
22
|
+
:'message' => :'String',
|
23
|
+
:'branch' => :'String'
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
# List of attributes with nullable: true
|
28
|
+
def self.openapi_nullable
|
29
|
+
Set.new([
|
30
|
+
])
|
31
|
+
end
|
32
|
+
|
33
|
+
# Initializes the object
|
34
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
35
|
+
def initialize(attributes = {})
|
36
|
+
if (!attributes.is_a?(Hash))
|
37
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::CommentCreateParameters1` initialize method"
|
38
|
+
end
|
39
|
+
|
40
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
41
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
42
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
43
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::CommentCreateParameters1`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
44
|
+
end
|
45
|
+
h[k.to_sym] = v
|
46
|
+
}
|
47
|
+
|
48
|
+
if attributes.key?(:'message')
|
49
|
+
self.message = attributes[:'message']
|
50
|
+
end
|
51
|
+
|
52
|
+
if attributes.key?(:'branch')
|
53
|
+
self.branch = attributes[:'branch']
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
58
|
+
# @return Array for valid properties with the reasons
|
59
|
+
def list_invalid_properties
|
60
|
+
invalid_properties = Array.new
|
61
|
+
if @message.nil?
|
62
|
+
invalid_properties.push('invalid value for "message", message cannot be nil.')
|
63
|
+
end
|
64
|
+
|
65
|
+
invalid_properties
|
66
|
+
end
|
67
|
+
|
68
|
+
# Check to see if the all the properties in the model are valid
|
69
|
+
# @return true if the model is valid
|
70
|
+
def valid?
|
71
|
+
return false if @message.nil?
|
72
|
+
true
|
73
|
+
end
|
74
|
+
|
75
|
+
# Checks equality by comparing each attribute.
|
76
|
+
# @param [Object] Object to be compared
|
77
|
+
def ==(o)
|
78
|
+
return true if self.equal?(o)
|
79
|
+
self.class == o.class &&
|
80
|
+
message == o.message &&
|
81
|
+
branch == o.branch
|
82
|
+
end
|
83
|
+
|
84
|
+
# @see the `==` method
|
85
|
+
# @param [Object] Object to be compared
|
86
|
+
def eql?(o)
|
87
|
+
self == o
|
88
|
+
end
|
89
|
+
|
90
|
+
# Calculates hash code according to all attributes.
|
91
|
+
# @return [Integer] Hash code
|
92
|
+
def hash
|
93
|
+
[message, branch].hash
|
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 self.build_from_hash(attributes)
|
100
|
+
new.build_from_hash(attributes)
|
101
|
+
end
|
102
|
+
|
103
|
+
# Builds the object from hash
|
104
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
105
|
+
# @return [Object] Returns the model itself
|
106
|
+
def build_from_hash(attributes)
|
107
|
+
return nil unless attributes.is_a?(Hash)
|
108
|
+
self.class.openapi_types.each_pair do |key, type|
|
109
|
+
if type =~ /\AArray<(.*)>/i
|
110
|
+
# check to ensure the input is an array given that the attribute
|
111
|
+
# is documented as an array but the input is not
|
112
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
113
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
114
|
+
end
|
115
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
116
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
117
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
118
|
+
end
|
119
|
+
|
120
|
+
self
|
121
|
+
end
|
122
|
+
|
123
|
+
# Deserializes the data based on type
|
124
|
+
# @param string type Data type
|
125
|
+
# @param string value Value to be deserialized
|
126
|
+
# @return [Object] Deserialized data
|
127
|
+
def _deserialize(type, value)
|
128
|
+
case type.to_sym
|
129
|
+
when :DateTime
|
130
|
+
DateTime.parse(value)
|
131
|
+
when :Date
|
132
|
+
Date.parse(value)
|
133
|
+
when :Time
|
134
|
+
Time.parse(value)
|
135
|
+
when :String
|
136
|
+
value.to_s
|
137
|
+
when :Integer
|
138
|
+
value.to_i
|
139
|
+
when :Float
|
140
|
+
value.to_f
|
141
|
+
when :Boolean
|
142
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
143
|
+
true
|
144
|
+
else
|
145
|
+
false
|
146
|
+
end
|
147
|
+
when :Object
|
148
|
+
# generic object (usually a Hash), return directly
|
149
|
+
value
|
150
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
151
|
+
inner_type = Regexp.last_match[:inner_type]
|
152
|
+
value.map { |v| _deserialize(inner_type, v) }
|
153
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
154
|
+
k_type = Regexp.last_match[:k_type]
|
155
|
+
v_type = Regexp.last_match[:v_type]
|
156
|
+
{}.tap do |hash|
|
157
|
+
value.each do |k, v|
|
158
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
159
|
+
end
|
160
|
+
end
|
161
|
+
else # model
|
162
|
+
Phrase.const_get(type).build_from_hash(value)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
# Returns the string representation of the object
|
167
|
+
# @return [String] String presentation of the object
|
168
|
+
def to_s
|
169
|
+
to_hash.to_s
|
170
|
+
end
|
171
|
+
|
172
|
+
# to_body is an alias to to_hash (backward compatibility)
|
173
|
+
# @return [Hash] Returns the object in the form of hash
|
174
|
+
def to_body
|
175
|
+
to_hash
|
176
|
+
end
|
177
|
+
|
178
|
+
# Returns the object in the form of hash
|
179
|
+
# @return [Hash] Returns the object in the form of hash
|
180
|
+
def to_hash
|
181
|
+
hash = {}
|
182
|
+
self.class.attribute_map.each_pair do |attr, param|
|
183
|
+
value = self.send(attr)
|
184
|
+
if value.nil?
|
185
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
186
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
187
|
+
end
|
188
|
+
|
189
|
+
hash[param] = _to_hash(value)
|
190
|
+
end
|
191
|
+
hash
|
192
|
+
end
|
193
|
+
|
194
|
+
# Outputs non-array value in the form of hash
|
195
|
+
# For object, use to_hash. Otherwise, just return the value
|
196
|
+
# @param [Object] value Any valid value
|
197
|
+
# @return [Hash] Returns the value in the form of hash
|
198
|
+
def _to_hash(value)
|
199
|
+
if value.is_a?(Array)
|
200
|
+
value.compact.map { |v| _to_hash(v) }
|
201
|
+
elsif value.is_a?(Hash)
|
202
|
+
{}.tap do |hash|
|
203
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
204
|
+
end
|
205
|
+
elsif value.respond_to? :to_hash
|
206
|
+
value.to_hash
|
207
|
+
else
|
208
|
+
value
|
209
|
+
end
|
210
|
+
end
|
211
|
+
end
|
212
|
+
end
|
@@ -38,6 +38,9 @@ module Phrase
|
|
38
38
|
# Creates a translation in the default locale with the specified content
|
39
39
|
attr_accessor :default_translation_content
|
40
40
|
|
41
|
+
# Indicates whether the key should be autotranslated to other locales based on the copy provided in `default_translation_content`.
|
42
|
+
attr_accessor :autotranslate
|
43
|
+
|
41
44
|
# Indicates whether the key should be exported with \"xml:space=preserve\". Supported by several XML-based formats.
|
42
45
|
attr_accessor :xml_space_preserve
|
43
46
|
|
@@ -68,6 +71,7 @@ module Phrase
|
|
68
71
|
:'remove_screenshot' => :'remove_screenshot',
|
69
72
|
:'unformatted' => :'unformatted',
|
70
73
|
:'default_translation_content' => :'default_translation_content',
|
74
|
+
:'autotranslate' => :'autotranslate',
|
71
75
|
:'xml_space_preserve' => :'xml_space_preserve',
|
72
76
|
:'original_file' => :'original_file',
|
73
77
|
:'localized_format_string' => :'localized_format_string',
|
@@ -91,6 +95,7 @@ module Phrase
|
|
91
95
|
:'remove_screenshot' => :'Boolean',
|
92
96
|
:'unformatted' => :'Boolean',
|
93
97
|
:'default_translation_content' => :'String',
|
98
|
+
:'autotranslate' => :'Boolean',
|
94
99
|
:'xml_space_preserve' => :'Boolean',
|
95
100
|
:'original_file' => :'String',
|
96
101
|
:'localized_format_string' => :'String',
|
@@ -168,6 +173,10 @@ module Phrase
|
|
168
173
|
self.default_translation_content = attributes[:'default_translation_content']
|
169
174
|
end
|
170
175
|
|
176
|
+
if attributes.key?(:'autotranslate')
|
177
|
+
self.autotranslate = attributes[:'autotranslate']
|
178
|
+
end
|
179
|
+
|
171
180
|
if attributes.key?(:'xml_space_preserve')
|
172
181
|
self.xml_space_preserve = attributes[:'xml_space_preserve']
|
173
182
|
end
|
@@ -224,6 +233,7 @@ module Phrase
|
|
224
233
|
remove_screenshot == o.remove_screenshot &&
|
225
234
|
unformatted == o.unformatted &&
|
226
235
|
default_translation_content == o.default_translation_content &&
|
236
|
+
autotranslate == o.autotranslate &&
|
227
237
|
xml_space_preserve == o.xml_space_preserve &&
|
228
238
|
original_file == o.original_file &&
|
229
239
|
localized_format_string == o.localized_format_string &&
|
@@ -240,7 +250,7 @@ module Phrase
|
|
240
250
|
# Calculates hash code according to all attributes.
|
241
251
|
# @return [Integer] Hash code
|
242
252
|
def hash
|
243
|
-
[branch, name, description, plural, name_plural, data_type, tags, max_characters_allowed, screenshot, remove_screenshot, unformatted, default_translation_content, xml_space_preserve, original_file, localized_format_string, localized_format_key, custom_metadata].hash
|
253
|
+
[branch, name, description, plural, name_plural, data_type, tags, max_characters_allowed, screenshot, remove_screenshot, unformatted, default_translation_content, autotranslate, xml_space_preserve, original_file, localized_format_string, localized_format_key, custom_metadata].hash
|
244
254
|
end
|
245
255
|
|
246
256
|
# Builds the object from hash
|
data/lib/phrase/version.rb
CHANGED
data/lib/phrase.rb
CHANGED
@@ -31,6 +31,7 @@ require 'phrase/models/branch_name'
|
|
31
31
|
require 'phrase/models/branch_update_parameters'
|
32
32
|
require 'phrase/models/comment'
|
33
33
|
require 'phrase/models/comment_create_parameters'
|
34
|
+
require 'phrase/models/comment_create_parameters1'
|
34
35
|
require 'phrase/models/comment_mark_read_parameters'
|
35
36
|
require 'phrase/models/comment_reaction'
|
36
37
|
require 'phrase/models/comment_update_parameters'
|
@@ -48,10 +48,9 @@ describe 'CommentRepliesApi' do
|
|
48
48
|
# @param project_id Project ID
|
49
49
|
# @param key_id Translation Key ID
|
50
50
|
# @param comment_id Comment ID
|
51
|
+
# @param comment_create_parameters1
|
51
52
|
# @param [Hash] opts the optional parameters
|
52
53
|
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
53
|
-
# @option opts [String] :branch specify the branch to use
|
54
|
-
# @option opts [String] :message specify the message for the comment
|
55
54
|
# @return [Comment]
|
56
55
|
describe 'reply_create test' do
|
57
56
|
it 'should work' do
|
@@ -28,8 +28,6 @@ describe 'CommentsApi' do
|
|
28
28
|
# @param comment_create_parameters
|
29
29
|
# @param [Hash] opts the optional parameters
|
30
30
|
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
31
|
-
# @option opts [String] :message specify the message for the comment
|
32
|
-
# @option opts [Array<String>] :locale_ids specify the locales for the comment
|
33
31
|
# @return [Comment]
|
34
32
|
describe 'comment_create test' do
|
35
33
|
it 'should work' do
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'json'
|
3
|
+
require 'date'
|
4
|
+
|
5
|
+
# Unit tests for Phrase::CommentCreateParameters1
|
6
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
7
|
+
# Please update as you see appropriate
|
8
|
+
describe 'CommentCreateParameters1' do
|
9
|
+
before do
|
10
|
+
# run before each test
|
11
|
+
@instance = Phrase::CommentCreateParameters1.new
|
12
|
+
end
|
13
|
+
|
14
|
+
after do
|
15
|
+
# run after each test
|
16
|
+
end
|
17
|
+
|
18
|
+
describe 'test an instance of CommentCreateParameters1' do
|
19
|
+
it 'should create an instance of CommentCreateParameters1' do
|
20
|
+
expect(@instance).to be_instance_of(Phrase::CommentCreateParameters1)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
describe 'test attribute "message"' do
|
24
|
+
it 'should work' do
|
25
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'test attribute "branch"' do
|
30
|
+
it 'should work' do
|
31
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -20,13 +20,19 @@ describe 'CommentCreateParameters' do
|
|
20
20
|
expect(@instance).to be_instance_of(Phrase::CommentCreateParameters)
|
21
21
|
end
|
22
22
|
end
|
23
|
+
describe 'test attribute "message"' do
|
24
|
+
it 'should work' do
|
25
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
23
29
|
describe 'test attribute "branch"' do
|
24
30
|
it 'should work' do
|
25
31
|
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
26
32
|
end
|
27
33
|
end
|
28
34
|
|
29
|
-
describe 'test attribute "
|
35
|
+
describe 'test attribute "locale_ids"' do
|
30
36
|
it 'should work' do
|
31
37
|
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
32
38
|
end
|
@@ -92,6 +92,12 @@ describe 'KeyCreateParameters' do
|
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
95
|
+
describe 'test attribute "autotranslate"' do
|
96
|
+
it 'should work' do
|
97
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
95
101
|
describe 'test attribute "xml_space_preserve"' do
|
96
102
|
it 'should work' do
|
97
103
|
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|