phrase 2.25.0 → 3.0.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 +18 -0
- data/README.md +6 -5
- data/docs/AuthorizationCreateParameters.md +1 -1
- data/docs/AuthorizationsApi.md +1 -1
- data/docs/BlacklistedKeyCreateParameters.md +1 -1
- data/docs/BlacklistedKeysApi.md +1 -1
- data/docs/BranchCreateParameters.md +1 -1
- data/docs/BranchesApi.md +1 -1
- data/docs/DistributionCreateParameters.md +2 -2
- data/docs/DistributionsApi.md +1 -1
- data/docs/FigmaAttachmentCreateParameters.md +1 -1
- data/docs/FigmaAttachmentsApi.md +1 -1
- data/docs/GlossariesApi.md +1 -1
- data/docs/GlossaryCreateParameters.md +1 -1
- data/docs/GlossaryTermCreateParameters.md +1 -1
- data/docs/GlossaryTermTranslationCreateParameters.md +2 -2
- data/docs/GlossaryTermTranslationsApi.md +1 -1
- data/docs/GlossaryTermsApi.md +1 -1
- data/docs/ICUApi.md +4 -4
- data/docs/InvitationCreateParameters.md +2 -2
- data/docs/InvitationsApi.md +1 -1
- data/docs/JobCreateParameters.md +1 -1
- data/docs/JobsApi.md +1 -1
- data/docs/KeyCreateParameters.md +2 -2
- data/docs/KeyLink.md +7 -7
- data/docs/KeyLinksBatchDestroyParameters.md +3 -1
- data/docs/KeyUpdateParameters.md +1 -1
- data/docs/KeysApi.md +1 -1
- data/docs/LinkedKeysApi.md +4 -6
- data/docs/LocaleCreateParameters.md +3 -3
- data/docs/LocaleUpdateParameters.md +1 -1
- data/docs/LocalesApi.md +3 -3
- data/docs/OrderCreateParameters.md +4 -4
- data/docs/OrdersApi.md +1 -1
- data/docs/ProjectCreateParameters.md +2 -2
- data/docs/ProjectUpdateParameters.md +1 -1
- data/docs/ProjectsApi.md +1 -1
- data/docs/ScreenshotMarkerCreateParameters.md +1 -1
- data/docs/ScreenshotMarkersApi.md +1 -1
- data/docs/ScreenshotUpdateParameters.md +1 -1
- data/docs/SpaceCreateParameters.md +1 -1
- data/docs/SpacesApi.md +2 -2
- data/docs/SpacesProjectsCreateParameters.md +1 -1
- data/docs/StyleGuidesApi.md +1 -1
- data/docs/StyleguideCreateParameters.md +1 -1
- data/docs/TagCreateParameters.md +1 -1
- data/docs/TagsApi.md +1 -1
- data/docs/TeamCreateParameters.md +1 -1
- data/docs/TeamsApi.md +4 -4
- data/docs/TeamsProjectsCreateParameters.md +1 -1
- data/docs/TeamsSpacesCreateParameters.md +1 -1
- data/docs/TeamsUsersCreateParameters.md +1 -1
- data/docs/TranslationCreateParameters.md +1 -1
- data/docs/TranslationDetails.md +3 -1
- data/docs/TranslationParent.md +19 -0
- data/docs/UploadsApi.md +10 -10
- data/docs/VariableCreateParameters.md +1 -1
- data/docs/VariablesApi.md +1 -1
- data/docs/WebhookCreateParameters.md +1 -1
- data/docs/WebhooksApi.md +1 -1
- data/lib/phrase/api/icu_api.rb +4 -4
- data/lib/phrase/api/linked_keys_api.rb +2 -5
- data/lib/phrase/api/locales_api.rb +2 -2
- data/lib/phrase/api/uploads_api.rb +26 -14
- data/lib/phrase/models/authorization_create_parameters.rb +5 -0
- data/lib/phrase/models/blacklisted_key_create_parameters.rb +5 -0
- data/lib/phrase/models/branch_create_parameters.rb +5 -0
- data/lib/phrase/models/distribution_create_parameters.rb +10 -0
- data/lib/phrase/models/figma_attachment_create_parameters.rb +5 -0
- data/lib/phrase/models/glossary_create_parameters.rb +5 -0
- data/lib/phrase/models/glossary_term_create_parameters.rb +5 -0
- data/lib/phrase/models/glossary_term_translation_create_parameters.rb +10 -0
- data/lib/phrase/models/invitation_create_parameters.rb +10 -0
- data/lib/phrase/models/job_create_parameters.rb +5 -0
- data/lib/phrase/models/key_create_parameters.rb +5 -0
- data/lib/phrase/models/key_link.rb +0 -35
- data/lib/phrase/models/key_links_batch_destroy_parameters.rb +16 -4
- data/lib/phrase/models/locale_create_parameters.rb +11 -1
- data/lib/phrase/models/locale_update_parameters.rb +1 -1
- data/lib/phrase/models/order_create_parameters.rb +12 -2
- data/lib/phrase/models/project_create_parameters.rb +5 -0
- data/lib/phrase/models/screenshot_marker_create_parameters.rb +5 -0
- data/lib/phrase/models/space_create_parameters.rb +5 -0
- data/lib/phrase/models/spaces_projects_create_parameters.rb +5 -0
- data/lib/phrase/models/styleguide_create_parameters.rb +5 -0
- data/lib/phrase/models/tag_create_parameters.rb +5 -0
- data/lib/phrase/models/team_create_parameters.rb +5 -0
- data/lib/phrase/models/teams_projects_create_parameters.rb +5 -0
- data/lib/phrase/models/teams_spaces_create_parameters.rb +5 -0
- data/lib/phrase/models/teams_users_create_parameters.rb +5 -0
- data/lib/phrase/models/translation_create_parameters.rb +1 -1
- data/lib/phrase/models/translation_details.rb +13 -4
- data/lib/phrase/models/translation_parent.rb +205 -0
- data/lib/phrase/models/variable_create_parameters.rb +5 -0
- data/lib/phrase/models/webhook_create_parameters.rb +5 -0
- data/lib/phrase/version.rb +1 -1
- data/lib/phrase.rb +1 -0
- data/spec/api/icu_api_spec.rb +2 -2
- data/spec/api/linked_keys_api_spec.rb +1 -2
- data/spec/api/locales_api_spec.rb +1 -1
- data/spec/api/uploads_api_spec.rb +2 -2
- data/spec/models/key_links_batch_destroy_parameters_spec.rb +6 -0
- data/spec/models/translation_details_spec.rb +6 -0
- data/spec/models/translation_parent_spec.rb +35 -0
- metadata +240 -236
@@ -0,0 +1,205 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module Phrase
|
4
|
+
class TranslationParent
|
5
|
+
attr_accessor :id
|
6
|
+
|
7
|
+
attr_accessor :content
|
8
|
+
|
9
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
10
|
+
def self.attribute_map
|
11
|
+
{
|
12
|
+
:'id' => :'id',
|
13
|
+
:'content' => :'content'
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
# Attribute type mapping.
|
18
|
+
def self.openapi_types
|
19
|
+
{
|
20
|
+
:'id' => :'String',
|
21
|
+
:'content' => :'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::TranslationParent` 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::TranslationParent`. 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?(:'id')
|
47
|
+
self.id = attributes[:'id']
|
48
|
+
end
|
49
|
+
|
50
|
+
if attributes.key?(:'content')
|
51
|
+
self.content = attributes[:'content']
|
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
|
+
id == o.id &&
|
74
|
+
content == o.content
|
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
|
+
[id, content].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 :Time
|
127
|
+
Time.parse(value)
|
128
|
+
when :String
|
129
|
+
value.to_s
|
130
|
+
when :Integer
|
131
|
+
value.to_i
|
132
|
+
when :Float
|
133
|
+
value.to_f
|
134
|
+
when :Boolean
|
135
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
136
|
+
true
|
137
|
+
else
|
138
|
+
false
|
139
|
+
end
|
140
|
+
when :Object
|
141
|
+
# generic object (usually a Hash), return directly
|
142
|
+
value
|
143
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
144
|
+
inner_type = Regexp.last_match[:inner_type]
|
145
|
+
value.map { |v| _deserialize(inner_type, v) }
|
146
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
147
|
+
k_type = Regexp.last_match[:k_type]
|
148
|
+
v_type = Regexp.last_match[:v_type]
|
149
|
+
{}.tap do |hash|
|
150
|
+
value.each do |k, v|
|
151
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
else # model
|
155
|
+
Phrase.const_get(type).build_from_hash(value)
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
# Returns the string representation of the object
|
160
|
+
# @return [String] String presentation of the object
|
161
|
+
def to_s
|
162
|
+
to_hash.to_s
|
163
|
+
end
|
164
|
+
|
165
|
+
# to_body is an alias to to_hash (backward compatibility)
|
166
|
+
# @return [Hash] Returns the object in the form of hash
|
167
|
+
def to_body
|
168
|
+
to_hash
|
169
|
+
end
|
170
|
+
|
171
|
+
# Returns the object in the form of hash
|
172
|
+
# @return [Hash] Returns the object in the form of hash
|
173
|
+
def to_hash
|
174
|
+
hash = {}
|
175
|
+
self.class.attribute_map.each_pair do |attr, param|
|
176
|
+
value = self.send(attr)
|
177
|
+
if value.nil?
|
178
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
179
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
180
|
+
end
|
181
|
+
|
182
|
+
hash[param] = _to_hash(value)
|
183
|
+
end
|
184
|
+
hash
|
185
|
+
end
|
186
|
+
|
187
|
+
# Outputs non-array value in the form of hash
|
188
|
+
# For object, use to_hash. Otherwise, just return the value
|
189
|
+
# @param [Object] value Any valid value
|
190
|
+
# @return [Hash] Returns the value in the form of hash
|
191
|
+
def _to_hash(value)
|
192
|
+
if value.is_a?(Array)
|
193
|
+
value.compact.map { |v| _to_hash(v) }
|
194
|
+
elsif value.is_a?(Hash)
|
195
|
+
{}.tap do |hash|
|
196
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
197
|
+
end
|
198
|
+
elsif value.respond_to? :to_hash
|
199
|
+
value.to_hash
|
200
|
+
else
|
201
|
+
value
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
@@ -58,12 +58,17 @@ module Phrase
|
|
58
58
|
# @return Array for valid properties with the reasons
|
59
59
|
def list_invalid_properties
|
60
60
|
invalid_properties = Array.new
|
61
|
+
if @name.nil?
|
62
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
63
|
+
end
|
64
|
+
|
61
65
|
invalid_properties
|
62
66
|
end
|
63
67
|
|
64
68
|
# Check to see if the all the properties in the model are valid
|
65
69
|
# @return true if the model is valid
|
66
70
|
def valid?
|
71
|
+
return false if @name.nil?
|
67
72
|
true
|
68
73
|
end
|
69
74
|
|
@@ -94,12 +94,17 @@ module Phrase
|
|
94
94
|
# @return Array for valid properties with the reasons
|
95
95
|
def list_invalid_properties
|
96
96
|
invalid_properties = Array.new
|
97
|
+
if @callback_url.nil?
|
98
|
+
invalid_properties.push('invalid value for "callback_url", callback_url cannot be nil.')
|
99
|
+
end
|
100
|
+
|
97
101
|
invalid_properties
|
98
102
|
end
|
99
103
|
|
100
104
|
# Check to see if the all the properties in the model are valid
|
101
105
|
# @return true if the model is valid
|
102
106
|
def valid?
|
107
|
+
return false if @callback_url.nil?
|
103
108
|
true
|
104
109
|
end
|
105
110
|
|
data/lib/phrase/version.rb
CHANGED
data/lib/phrase.rb
CHANGED
@@ -202,6 +202,7 @@ require 'phrase/models/translation_include_parameters'
|
|
202
202
|
require 'phrase/models/translation_key'
|
203
203
|
require 'phrase/models/translation_key_details'
|
204
204
|
require 'phrase/models/translation_order'
|
205
|
+
require 'phrase/models/translation_parent'
|
205
206
|
require 'phrase/models/translation_review_parameters'
|
206
207
|
require 'phrase/models/translation_unverify_parameters'
|
207
208
|
require 'phrase/models/translation_update_parameters'
|
data/spec/api/icu_api_spec.rb
CHANGED
@@ -21,8 +21,8 @@ describe 'ICUApi' do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
# unit tests for icu_skeleton
|
24
|
-
# Build
|
25
|
-
# Returns
|
24
|
+
# Build ICU skeletons
|
25
|
+
# Returns ICU skeletons for multiple locale codes based on a source content.
|
26
26
|
# @param icu_skeleton_parameters
|
27
27
|
# @param [Hash] opts the optional parameters
|
28
28
|
# @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional)
|
@@ -28,7 +28,6 @@ describe 'LinkedKeysApi' do
|
|
28
28
|
# @param key_links_batch_destroy_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 [Boolean] :unlink_parent Whether to unlink the parent key as well and unmark it as linked-key.
|
32
31
|
# @return [nil]
|
33
32
|
describe 'key_links_batch_destroy test' do
|
34
33
|
it 'should work' do
|
@@ -67,7 +66,7 @@ describe 'LinkedKeysApi' do
|
|
67
66
|
end
|
68
67
|
|
69
68
|
# unit tests for key_links_index
|
70
|
-
#
|
69
|
+
# List child keys of a parent key
|
71
70
|
# Returns detailed information about a parent key, including its linked child keys.
|
72
71
|
# @param project_id Project ID
|
73
72
|
# @param id Parent Translation Key ID
|
@@ -87,7 +87,7 @@ describe 'LocalesApi' do
|
|
87
87
|
# @option opts [Boolean] :skip_unverified_translations Indicates whether the locale file should skip all unverified translations. This parameter is deprecated and should be replaced with <code>include_unverified_translations</code>.
|
88
88
|
# @option opts [Boolean] :include_unverified_translations if set to false unverified translations are excluded
|
89
89
|
# @option opts [Boolean] :use_last_reviewed_version If set to true the last reviewed version of a translation is used. This is only available if the review workflow is enabled for the project.
|
90
|
-
# @option opts [String] :fallback_locale_id If a key has no translation in the locale being downloaded the translation in the fallback locale will be used. Provide the
|
90
|
+
# @option opts [String] :fallback_locale_id If a key has no translation in the locale being downloaded the translation in the fallback locale will be used. Provide the ID of the locale that should be used as the fallback. Requires include_empty_translations to be set to <code>true</code>.
|
91
91
|
# @option opts [String] :source_locale_id Provides the source language of a corresponding job as the source language of the generated locale file. This parameter will be ignored unless used in combination with a <code>tag</code> parameter indicating a specific job.
|
92
92
|
# @return [File]
|
93
93
|
describe 'locale_download test' do
|
@@ -29,7 +29,7 @@ describe 'UploadsApi' do
|
|
29
29
|
# @option opts [String] :branch specify the branch to use
|
30
30
|
# @option opts [File] :file File to be imported
|
31
31
|
# @option opts [String] :file_format File format. Auto-detected when possible and not specified.
|
32
|
-
# @option opts [String] :locale_id Locale of the file's content. Can be the name or
|
32
|
+
# @option opts [String] :locale_id Locale of the file's content. Can be the name or id of the locale. Preferred is id.
|
33
33
|
# @option opts [String] :tags List of tags separated by comma to be associated with the new keys contained in the upload.
|
34
34
|
# @option opts [Boolean] :update_translations Indicates whether existing translations should be updated with the file content.
|
35
35
|
# @option opts [Boolean] :update_descriptions Existing key descriptions will be updated with the file content. Empty descriptions overwrite existing descriptions.
|
@@ -53,7 +53,7 @@ describe 'UploadsApi' do
|
|
53
53
|
end
|
54
54
|
|
55
55
|
it 'should work' do
|
56
|
-
@api_instance.upload_create('project_id',
|
56
|
+
@api_instance.upload_create('project_id', File.new('Gemfile'), "yml", "en")
|
57
57
|
|
58
58
|
expect(a_request(:post, 'https://api.phrase.com/v2/projects/project_id/uploads')
|
59
59
|
.with { |req|
|
@@ -98,4 +98,10 @@ describe 'TranslationDetails' do
|
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
101
|
+
describe 'test attribute "linked_translation"' do
|
102
|
+
it 'should work' do
|
103
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
101
107
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'json'
|
3
|
+
require 'date'
|
4
|
+
|
5
|
+
# Unit tests for Phrase::TranslationParent
|
6
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
7
|
+
# Please update as you see appropriate
|
8
|
+
describe 'TranslationParent' do
|
9
|
+
before do
|
10
|
+
# run before each test
|
11
|
+
@instance = Phrase::TranslationParent.new
|
12
|
+
end
|
13
|
+
|
14
|
+
after do
|
15
|
+
# run after each test
|
16
|
+
end
|
17
|
+
|
18
|
+
describe 'test an instance of TranslationParent' do
|
19
|
+
it 'should create an instance of TranslationParent' do
|
20
|
+
expect(@instance).to be_instance_of(Phrase::TranslationParent)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
describe 'test attribute "id"' 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 "content"' 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
|