phrase 1.0.8 → 1.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +19 -3
- data/docs/BranchName.md +17 -0
- data/docs/Invitation.md +9 -1
- data/docs/InvitationCreateParameters.md +4 -0
- data/docs/InvitationUpdateParameters.md +4 -0
- data/docs/InvitationUpdateSettingsParameters.md +19 -0
- data/docs/InvitationsApi.md +66 -0
- data/docs/Job.md +5 -3
- data/docs/JobDetails.md +4 -2
- data/docs/JobLocale.md +3 -1
- data/docs/LocalesApi.md +2 -0
- data/docs/Member.md +7 -1
- data/docs/MemberProjectDetail.md +35 -0
- data/docs/MemberProjectDetailProjectRoles.md +19 -0
- data/docs/MemberSpaces.md +25 -0
- data/docs/MemberUpdateParameters.md +4 -0
- data/docs/MemberUpdateSettingsParameters.md +19 -0
- data/docs/MembersApi.md +66 -0
- data/docs/ProjectUpdateParameters.md +43 -9
- data/docs/Variable.md +23 -0
- data/docs/VariableCreateParameters.md +19 -0
- data/docs/VariableUpdateParameters.md +19 -0
- data/docs/VariablesApi.md +331 -0
- data/docs/Webhook.md +2 -0
- data/docs/WebhookCreateParameters.md +3 -1
- data/docs/WebhookUpdateParameters.md +3 -1
- data/lib/phrase.rb +10 -0
- data/lib/phrase/api/invitations_api.rb +80 -0
- data/lib/phrase/api/locales_api.rb +3 -0
- data/lib/phrase/api/members_api.rb +80 -0
- data/lib/phrase/api/variables_api.rb +378 -0
- data/lib/phrase/models/branch_name.rb +194 -0
- data/lib/phrase/models/invitation.rb +48 -4
- data/lib/phrase/models/invitation_create_parameters.rb +25 -1
- data/lib/phrase/models/invitation_update_parameters.rb +25 -1
- data/lib/phrase/models/invitation_update_settings_parameters.rb +207 -0
- data/lib/phrase/models/job.rb +22 -13
- data/lib/phrase/models/job_details.rb +19 -10
- data/lib/phrase/models/job_locale.rb +13 -4
- data/lib/phrase/models/member.rb +35 -4
- data/lib/phrase/models/member_project_detail.rb +285 -0
- data/lib/phrase/models/member_project_detail_project_roles.rb +203 -0
- data/lib/phrase/models/member_spaces.rb +230 -0
- data/lib/phrase/models/member_update_parameters.rb +25 -1
- data/lib/phrase/models/member_update_settings_parameters.rb +207 -0
- data/lib/phrase/models/project_update_parameters.rb +183 -13
- data/lib/phrase/models/variable.rb +221 -0
- data/lib/phrase/models/variable_create_parameters.rb +205 -0
- data/lib/phrase/models/variable_update_parameters.rb +205 -0
- data/lib/phrase/models/webhook.rb +10 -1
- data/lib/phrase/models/webhook_create_parameters.rb +14 -4
- data/lib/phrase/models/webhook_update_parameters.rb +14 -4
- data/lib/phrase/version.rb +1 -1
- data/spec/api/invitations_api_spec.rb +15 -0
- data/spec/api/locales_api_spec.rb +1 -0
- data/spec/api/members_api_spec.rb +15 -0
- data/spec/api/variables_api_spec.rb +95 -0
- data/spec/models/branch_name_spec.rb +29 -0
- data/spec/models/invitation_create_parameters_spec.rb +12 -0
- data/spec/models/invitation_spec.rb +24 -0
- data/spec/models/invitation_update_parameters_spec.rb +12 -0
- data/spec/models/invitation_update_settings_parameters_spec.rb +35 -0
- data/spec/models/job_details_spec.rb +9 -3
- data/spec/models/job_locale_spec.rb +6 -0
- data/spec/models/job_spec.rb +9 -3
- data/spec/models/member_project_detail_project_roles_spec.rb +35 -0
- data/spec/models/member_project_detail_spec.rb +83 -0
- data/spec/models/member_spaces_spec.rb +53 -0
- data/spec/models/member_spec.rb +18 -0
- data/spec/models/member_update_parameters_spec.rb +12 -0
- data/spec/models/member_update_settings_parameters_spec.rb +35 -0
- data/spec/models/project_update_parameters_spec.rb +103 -1
- data/spec/models/variable_create_parameters_spec.rb +35 -0
- data/spec/models/variable_spec.rb +47 -0
- data/spec/models/variable_update_parameters_spec.rb +35 -0
- data/spec/models/webhook_create_parameters_spec.rb +6 -0
- data/spec/models/webhook_spec.rb +6 -0
- data/spec/models/webhook_update_parameters_spec.rb +6 -0
- metadata +205 -165
@@ -0,0 +1,194 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module Phrase
|
4
|
+
class BranchName
|
5
|
+
attr_accessor :name
|
6
|
+
|
7
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
8
|
+
def self.attribute_map
|
9
|
+
{
|
10
|
+
:'name' => :'name'
|
11
|
+
}
|
12
|
+
end
|
13
|
+
|
14
|
+
# Attribute type mapping.
|
15
|
+
def self.openapi_types
|
16
|
+
{
|
17
|
+
:'name' => :'String'
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
# List of attributes with nullable: true
|
22
|
+
def self.openapi_nullable
|
23
|
+
Set.new([
|
24
|
+
])
|
25
|
+
end
|
26
|
+
|
27
|
+
# Initializes the object
|
28
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
29
|
+
def initialize(attributes = {})
|
30
|
+
if (!attributes.is_a?(Hash))
|
31
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::BranchName` initialize method"
|
32
|
+
end
|
33
|
+
|
34
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
35
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
36
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
37
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::BranchName`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
38
|
+
end
|
39
|
+
h[k.to_sym] = v
|
40
|
+
}
|
41
|
+
|
42
|
+
if attributes.key?(:'name')
|
43
|
+
self.name = attributes[:'name']
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
48
|
+
# @return Array for valid properties with the reasons
|
49
|
+
def list_invalid_properties
|
50
|
+
invalid_properties = Array.new
|
51
|
+
invalid_properties
|
52
|
+
end
|
53
|
+
|
54
|
+
# Check to see if the all the properties in the model are valid
|
55
|
+
# @return true if the model is valid
|
56
|
+
def valid?
|
57
|
+
true
|
58
|
+
end
|
59
|
+
|
60
|
+
# Checks equality by comparing each attribute.
|
61
|
+
# @param [Object] Object to be compared
|
62
|
+
def ==(o)
|
63
|
+
return true if self.equal?(o)
|
64
|
+
self.class == o.class &&
|
65
|
+
name == o.name
|
66
|
+
end
|
67
|
+
|
68
|
+
# @see the `==` method
|
69
|
+
# @param [Object] Object to be compared
|
70
|
+
def eql?(o)
|
71
|
+
self == o
|
72
|
+
end
|
73
|
+
|
74
|
+
# Calculates hash code according to all attributes.
|
75
|
+
# @return [Integer] Hash code
|
76
|
+
def hash
|
77
|
+
[name].hash
|
78
|
+
end
|
79
|
+
|
80
|
+
# Builds the object from hash
|
81
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
82
|
+
# @return [Object] Returns the model itself
|
83
|
+
def self.build_from_hash(attributes)
|
84
|
+
new.build_from_hash(attributes)
|
85
|
+
end
|
86
|
+
|
87
|
+
# Builds the object from hash
|
88
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
89
|
+
# @return [Object] Returns the model itself
|
90
|
+
def build_from_hash(attributes)
|
91
|
+
return nil unless attributes.is_a?(Hash)
|
92
|
+
self.class.openapi_types.each_pair do |key, type|
|
93
|
+
if type =~ /\AArray<(.*)>/i
|
94
|
+
# check to ensure the input is an array given that the attribute
|
95
|
+
# is documented as an array but the input is not
|
96
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
97
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
98
|
+
end
|
99
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
100
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
101
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
102
|
+
end
|
103
|
+
|
104
|
+
self
|
105
|
+
end
|
106
|
+
|
107
|
+
# Deserializes the data based on type
|
108
|
+
# @param string type Data type
|
109
|
+
# @param string value Value to be deserialized
|
110
|
+
# @return [Object] Deserialized data
|
111
|
+
def _deserialize(type, value)
|
112
|
+
case type.to_sym
|
113
|
+
when :DateTime
|
114
|
+
DateTime.parse(value)
|
115
|
+
when :Date
|
116
|
+
Date.parse(value)
|
117
|
+
when :String
|
118
|
+
value.to_s
|
119
|
+
when :Integer
|
120
|
+
value.to_i
|
121
|
+
when :Float
|
122
|
+
value.to_f
|
123
|
+
when :Boolean
|
124
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
125
|
+
true
|
126
|
+
else
|
127
|
+
false
|
128
|
+
end
|
129
|
+
when :Object
|
130
|
+
# generic object (usually a Hash), return directly
|
131
|
+
value
|
132
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
133
|
+
inner_type = Regexp.last_match[:inner_type]
|
134
|
+
value.map { |v| _deserialize(inner_type, v) }
|
135
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
136
|
+
k_type = Regexp.last_match[:k_type]
|
137
|
+
v_type = Regexp.last_match[:v_type]
|
138
|
+
{}.tap do |hash|
|
139
|
+
value.each do |k, v|
|
140
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
else # model
|
144
|
+
Phrase.const_get(type).build_from_hash(value)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
# Returns the string representation of the object
|
149
|
+
# @return [String] String presentation of the object
|
150
|
+
def to_s
|
151
|
+
to_hash.to_s
|
152
|
+
end
|
153
|
+
|
154
|
+
# to_body is an alias to to_hash (backward compatibility)
|
155
|
+
# @return [Hash] Returns the object in the form of hash
|
156
|
+
def to_body
|
157
|
+
to_hash
|
158
|
+
end
|
159
|
+
|
160
|
+
# Returns the object in the form of hash
|
161
|
+
# @return [Hash] Returns the object in the form of hash
|
162
|
+
def to_hash
|
163
|
+
hash = {}
|
164
|
+
self.class.attribute_map.each_pair do |attr, param|
|
165
|
+
value = self.send(attr)
|
166
|
+
if value.nil?
|
167
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
168
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
169
|
+
end
|
170
|
+
|
171
|
+
hash[param] = _to_hash(value)
|
172
|
+
end
|
173
|
+
hash
|
174
|
+
end
|
175
|
+
|
176
|
+
# Outputs non-array value in the form of hash
|
177
|
+
# For object, use to_hash. Otherwise, just return the value
|
178
|
+
# @param [Object] value Any valid value
|
179
|
+
# @return [Hash] Returns the value in the form of hash
|
180
|
+
def _to_hash(value)
|
181
|
+
if value.is_a?(Array)
|
182
|
+
value.compact.map { |v| _to_hash(v) }
|
183
|
+
elsif value.is_a?(Hash)
|
184
|
+
{}.tap do |hash|
|
185
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
186
|
+
end
|
187
|
+
elsif value.respond_to? :to_hash
|
188
|
+
value.to_hash
|
189
|
+
else
|
190
|
+
value
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|
@@ -14,14 +14,22 @@ module Phrase
|
|
14
14
|
|
15
15
|
attr_accessor :locales
|
16
16
|
|
17
|
+
attr_accessor :default_locale_codes
|
18
|
+
|
17
19
|
attr_accessor :permissions
|
18
20
|
|
21
|
+
attr_accessor :locale_ids
|
22
|
+
|
19
23
|
attr_accessor :created_at
|
20
24
|
|
21
25
|
attr_accessor :updated_at
|
22
26
|
|
23
27
|
attr_accessor :accepted_at
|
24
28
|
|
29
|
+
attr_accessor :spaces
|
30
|
+
|
31
|
+
attr_accessor :project_role
|
32
|
+
|
25
33
|
# Attribute mapping from ruby-style variable name to JSON key.
|
26
34
|
def self.attribute_map
|
27
35
|
{
|
@@ -31,10 +39,14 @@ module Phrase
|
|
31
39
|
:'state' => :'state',
|
32
40
|
:'projects' => :'projects',
|
33
41
|
:'locales' => :'locales',
|
42
|
+
:'default_locale_codes' => :'default_locale_codes',
|
34
43
|
:'permissions' => :'permissions',
|
44
|
+
:'locale_ids' => :'locale_ids',
|
35
45
|
:'created_at' => :'created_at',
|
36
46
|
:'updated_at' => :'updated_at',
|
37
|
-
:'accepted_at' => :'accepted_at'
|
47
|
+
:'accepted_at' => :'accepted_at',
|
48
|
+
:'spaces' => :'spaces',
|
49
|
+
:'project_role' => :'project_role'
|
38
50
|
}
|
39
51
|
end
|
40
52
|
|
@@ -47,10 +59,14 @@ module Phrase
|
|
47
59
|
:'state' => :'String',
|
48
60
|
:'projects' => :'Array<ProjectShort>',
|
49
61
|
:'locales' => :'Array<LocalePreview>',
|
62
|
+
:'default_locale_codes' => :'Array<String>',
|
50
63
|
:'permissions' => :'Object',
|
64
|
+
:'locale_ids' => :'Array<String>',
|
51
65
|
:'created_at' => :'DateTime',
|
52
66
|
:'updated_at' => :'DateTime',
|
53
|
-
:'accepted_at' => :'DateTime'
|
67
|
+
:'accepted_at' => :'DateTime',
|
68
|
+
:'spaces' => :'Array<MemberSpaces>',
|
69
|
+
:'project_role' => :'Array<MemberProjectDetailProjectRoles>'
|
54
70
|
}
|
55
71
|
end
|
56
72
|
|
@@ -103,10 +119,22 @@ module Phrase
|
|
103
119
|
end
|
104
120
|
end
|
105
121
|
|
122
|
+
if attributes.key?(:'default_locale_codes')
|
123
|
+
if (value = attributes[:'default_locale_codes']).is_a?(Array)
|
124
|
+
self.default_locale_codes = value
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
106
128
|
if attributes.key?(:'permissions')
|
107
129
|
self.permissions = attributes[:'permissions']
|
108
130
|
end
|
109
131
|
|
132
|
+
if attributes.key?(:'locale_ids')
|
133
|
+
if (value = attributes[:'locale_ids']).is_a?(Array)
|
134
|
+
self.locale_ids = value
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
110
138
|
if attributes.key?(:'created_at')
|
111
139
|
self.created_at = attributes[:'created_at']
|
112
140
|
end
|
@@ -118,6 +146,18 @@ module Phrase
|
|
118
146
|
if attributes.key?(:'accepted_at')
|
119
147
|
self.accepted_at = attributes[:'accepted_at']
|
120
148
|
end
|
149
|
+
|
150
|
+
if attributes.key?(:'spaces')
|
151
|
+
if (value = attributes[:'spaces']).is_a?(Array)
|
152
|
+
self.spaces = value
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
if attributes.key?(:'project_role')
|
157
|
+
if (value = attributes[:'project_role']).is_a?(Array)
|
158
|
+
self.project_role = value
|
159
|
+
end
|
160
|
+
end
|
121
161
|
end
|
122
162
|
|
123
163
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -144,10 +184,14 @@ module Phrase
|
|
144
184
|
state == o.state &&
|
145
185
|
projects == o.projects &&
|
146
186
|
locales == o.locales &&
|
187
|
+
default_locale_codes == o.default_locale_codes &&
|
147
188
|
permissions == o.permissions &&
|
189
|
+
locale_ids == o.locale_ids &&
|
148
190
|
created_at == o.created_at &&
|
149
191
|
updated_at == o.updated_at &&
|
150
|
-
accepted_at == o.accepted_at
|
192
|
+
accepted_at == o.accepted_at &&
|
193
|
+
spaces == o.spaces &&
|
194
|
+
project_role == o.project_role
|
151
195
|
end
|
152
196
|
|
153
197
|
# @see the `==` method
|
@@ -159,7 +203,7 @@ module Phrase
|
|
159
203
|
# Calculates hash code according to all attributes.
|
160
204
|
# @return [Integer] Hash code
|
161
205
|
def hash
|
162
|
-
[id, email, role, state, projects, locales, permissions, created_at, updated_at, accepted_at].hash
|
206
|
+
[id, email, role, state, projects, locales, default_locale_codes, permissions, locale_ids, created_at, updated_at, accepted_at, spaces, project_role].hash
|
163
207
|
end
|
164
208
|
|
165
209
|
# Builds the object from hash
|
@@ -14,6 +14,12 @@ module Phrase
|
|
14
14
|
# List of locale ids the invited user has access to.
|
15
15
|
attr_accessor :locale_ids
|
16
16
|
|
17
|
+
# List of spaces the user is assigned to.
|
18
|
+
attr_accessor :space_ids
|
19
|
+
|
20
|
+
# List of default locales for the user.
|
21
|
+
attr_accessor :default_locale_codes
|
22
|
+
|
17
23
|
# Additional permissions depending on invitation role. Available permissions are <code>create_upload</code> and <code>review_translations</code>
|
18
24
|
attr_accessor :permissions
|
19
25
|
|
@@ -24,6 +30,8 @@ module Phrase
|
|
24
30
|
:'role' => :'role',
|
25
31
|
:'project_ids' => :'project_ids',
|
26
32
|
:'locale_ids' => :'locale_ids',
|
33
|
+
:'space_ids' => :'space_ids',
|
34
|
+
:'default_locale_codes' => :'default_locale_codes',
|
27
35
|
:'permissions' => :'permissions'
|
28
36
|
}
|
29
37
|
end
|
@@ -35,6 +43,8 @@ module Phrase
|
|
35
43
|
:'role' => :'String',
|
36
44
|
:'project_ids' => :'String',
|
37
45
|
:'locale_ids' => :'String',
|
46
|
+
:'space_ids' => :'Array<String>',
|
47
|
+
:'default_locale_codes' => :'Array<String>',
|
38
48
|
:'permissions' => :'Hash<String, String>'
|
39
49
|
}
|
40
50
|
end
|
@@ -76,6 +86,18 @@ module Phrase
|
|
76
86
|
self.locale_ids = attributes[:'locale_ids']
|
77
87
|
end
|
78
88
|
|
89
|
+
if attributes.key?(:'space_ids')
|
90
|
+
if (value = attributes[:'space_ids']).is_a?(Array)
|
91
|
+
self.space_ids = value
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
if attributes.key?(:'default_locale_codes')
|
96
|
+
if (value = attributes[:'default_locale_codes']).is_a?(Array)
|
97
|
+
self.default_locale_codes = value
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
79
101
|
if attributes.key?(:'permissions')
|
80
102
|
if (value = attributes[:'permissions']).is_a?(Hash)
|
81
103
|
self.permissions = value
|
@@ -105,6 +127,8 @@ module Phrase
|
|
105
127
|
role == o.role &&
|
106
128
|
project_ids == o.project_ids &&
|
107
129
|
locale_ids == o.locale_ids &&
|
130
|
+
space_ids == o.space_ids &&
|
131
|
+
default_locale_codes == o.default_locale_codes &&
|
108
132
|
permissions == o.permissions
|
109
133
|
end
|
110
134
|
|
@@ -117,7 +141,7 @@ module Phrase
|
|
117
141
|
# Calculates hash code according to all attributes.
|
118
142
|
# @return [Integer] Hash code
|
119
143
|
def hash
|
120
|
-
[email, role, project_ids, locale_ids, permissions].hash
|
144
|
+
[email, role, project_ids, locale_ids, space_ids, default_locale_codes, permissions].hash
|
121
145
|
end
|
122
146
|
|
123
147
|
# Builds the object from hash
|
@@ -11,6 +11,12 @@ module Phrase
|
|
11
11
|
# List of locale ids the invited user has access to
|
12
12
|
attr_accessor :locale_ids
|
13
13
|
|
14
|
+
# List of spaces the user is assigned to.
|
15
|
+
attr_accessor :space_ids
|
16
|
+
|
17
|
+
# List of default locales for the user.
|
18
|
+
attr_accessor :default_locale_codes
|
19
|
+
|
14
20
|
# Additional permissions depending on invitation role.
|
15
21
|
attr_accessor :permissions
|
16
22
|
|
@@ -20,6 +26,8 @@ module Phrase
|
|
20
26
|
:'role' => :'role',
|
21
27
|
:'project_ids' => :'project_ids',
|
22
28
|
:'locale_ids' => :'locale_ids',
|
29
|
+
:'space_ids' => :'space_ids',
|
30
|
+
:'default_locale_codes' => :'default_locale_codes',
|
23
31
|
:'permissions' => :'permissions'
|
24
32
|
}
|
25
33
|
end
|
@@ -30,6 +38,8 @@ module Phrase
|
|
30
38
|
:'role' => :'String',
|
31
39
|
:'project_ids' => :'String',
|
32
40
|
:'locale_ids' => :'String',
|
41
|
+
:'space_ids' => :'Array<String>',
|
42
|
+
:'default_locale_codes' => :'Array<String>',
|
33
43
|
:'permissions' => :'Hash<String, String>'
|
34
44
|
}
|
35
45
|
end
|
@@ -67,6 +77,18 @@ module Phrase
|
|
67
77
|
self.locale_ids = attributes[:'locale_ids']
|
68
78
|
end
|
69
79
|
|
80
|
+
if attributes.key?(:'space_ids')
|
81
|
+
if (value = attributes[:'space_ids']).is_a?(Array)
|
82
|
+
self.space_ids = value
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
if attributes.key?(:'default_locale_codes')
|
87
|
+
if (value = attributes[:'default_locale_codes']).is_a?(Array)
|
88
|
+
self.default_locale_codes = value
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
70
92
|
if attributes.key?(:'permissions')
|
71
93
|
if (value = attributes[:'permissions']).is_a?(Hash)
|
72
94
|
self.permissions = value
|
@@ -95,6 +117,8 @@ module Phrase
|
|
95
117
|
role == o.role &&
|
96
118
|
project_ids == o.project_ids &&
|
97
119
|
locale_ids == o.locale_ids &&
|
120
|
+
space_ids == o.space_ids &&
|
121
|
+
default_locale_codes == o.default_locale_codes &&
|
98
122
|
permissions == o.permissions
|
99
123
|
end
|
100
124
|
|
@@ -107,7 +131,7 @@ module Phrase
|
|
107
131
|
# Calculates hash code according to all attributes.
|
108
132
|
# @return [Integer] Hash code
|
109
133
|
def hash
|
110
|
-
[role, project_ids, locale_ids, permissions].hash
|
134
|
+
[role, project_ids, locale_ids, space_ids, default_locale_codes, permissions].hash
|
111
135
|
end
|
112
136
|
|
113
137
|
# Builds the object from hash
|
@@ -0,0 +1,207 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module Phrase
|
4
|
+
class InvitationUpdateSettingsParameters
|
5
|
+
# Member role, can be any of of Manager, Developer, Translator
|
6
|
+
attr_accessor :project_role
|
7
|
+
|
8
|
+
# List of locale ids the user has access to.
|
9
|
+
attr_accessor :locale_ids
|
10
|
+
|
11
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
12
|
+
def self.attribute_map
|
13
|
+
{
|
14
|
+
:'project_role' => :'project_role',
|
15
|
+
:'locale_ids' => :'locale_ids'
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
# Attribute type mapping.
|
20
|
+
def self.openapi_types
|
21
|
+
{
|
22
|
+
:'project_role' => :'String',
|
23
|
+
:'locale_ids' => :'Array<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::InvitationUpdateSettingsParameters` 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::InvitationUpdateSettingsParameters`. 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?(:'project_role')
|
49
|
+
self.project_role = attributes[:'project_role']
|
50
|
+
end
|
51
|
+
|
52
|
+
if attributes.key?(:'locale_ids')
|
53
|
+
if (value = attributes[:'locale_ids']).is_a?(Array)
|
54
|
+
self.locale_ids = 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
|
+
project_role == o.project_role &&
|
78
|
+
locale_ids == o.locale_ids
|
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
|
+
[project_role, locale_ids].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 :String
|
131
|
+
value.to_s
|
132
|
+
when :Integer
|
133
|
+
value.to_i
|
134
|
+
when :Float
|
135
|
+
value.to_f
|
136
|
+
when :Boolean
|
137
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
138
|
+
true
|
139
|
+
else
|
140
|
+
false
|
141
|
+
end
|
142
|
+
when :Object
|
143
|
+
# generic object (usually a Hash), return directly
|
144
|
+
value
|
145
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
146
|
+
inner_type = Regexp.last_match[:inner_type]
|
147
|
+
value.map { |v| _deserialize(inner_type, v) }
|
148
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
149
|
+
k_type = Regexp.last_match[:k_type]
|
150
|
+
v_type = Regexp.last_match[:v_type]
|
151
|
+
{}.tap do |hash|
|
152
|
+
value.each do |k, v|
|
153
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
else # model
|
157
|
+
Phrase.const_get(type).build_from_hash(value)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
# Returns the string representation of the object
|
162
|
+
# @return [String] String presentation of the object
|
163
|
+
def to_s
|
164
|
+
to_hash.to_s
|
165
|
+
end
|
166
|
+
|
167
|
+
# to_body is an alias to to_hash (backward compatibility)
|
168
|
+
# @return [Hash] Returns the object in the form of hash
|
169
|
+
def to_body
|
170
|
+
to_hash
|
171
|
+
end
|
172
|
+
|
173
|
+
# Returns the object in the form of hash
|
174
|
+
# @return [Hash] Returns the object in the form of hash
|
175
|
+
def to_hash
|
176
|
+
hash = {}
|
177
|
+
self.class.attribute_map.each_pair do |attr, param|
|
178
|
+
value = self.send(attr)
|
179
|
+
if value.nil?
|
180
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
181
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
182
|
+
end
|
183
|
+
|
184
|
+
hash[param] = _to_hash(value)
|
185
|
+
end
|
186
|
+
hash
|
187
|
+
end
|
188
|
+
|
189
|
+
# Outputs non-array value in the form of hash
|
190
|
+
# For object, use to_hash. Otherwise, just return the value
|
191
|
+
# @param [Object] value Any valid value
|
192
|
+
# @return [Hash] Returns the value in the form of hash
|
193
|
+
def _to_hash(value)
|
194
|
+
if value.is_a?(Array)
|
195
|
+
value.compact.map { |v| _to_hash(v) }
|
196
|
+
elsif value.is_a?(Hash)
|
197
|
+
{}.tap do |hash|
|
198
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
199
|
+
end
|
200
|
+
elsif value.respond_to? :to_hash
|
201
|
+
value.to_hash
|
202
|
+
else
|
203
|
+
value
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|