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
data/lib/phrase/models/job.rb
CHANGED
@@ -14,12 +14,14 @@ module Phrase
|
|
14
14
|
|
15
15
|
attr_accessor :ticket_url
|
16
16
|
|
17
|
+
attr_accessor :project
|
18
|
+
|
19
|
+
attr_accessor :branch
|
20
|
+
|
17
21
|
attr_accessor :created_at
|
18
22
|
|
19
23
|
attr_accessor :updated_at
|
20
24
|
|
21
|
-
attr_accessor :project
|
22
|
-
|
23
25
|
# Attribute mapping from ruby-style variable name to JSON key.
|
24
26
|
def self.attribute_map
|
25
27
|
{
|
@@ -29,9 +31,10 @@ module Phrase
|
|
29
31
|
:'due_date' => :'due_date',
|
30
32
|
:'state' => :'state',
|
31
33
|
:'ticket_url' => :'ticket_url',
|
34
|
+
:'project' => :'project',
|
35
|
+
:'branch' => :'branch',
|
32
36
|
:'created_at' => :'created_at',
|
33
|
-
:'updated_at' => :'updated_at'
|
34
|
-
:'project' => :'project'
|
37
|
+
:'updated_at' => :'updated_at'
|
35
38
|
}
|
36
39
|
end
|
37
40
|
|
@@ -44,9 +47,10 @@ module Phrase
|
|
44
47
|
:'due_date' => :'DateTime',
|
45
48
|
:'state' => :'String',
|
46
49
|
:'ticket_url' => :'String',
|
50
|
+
:'project' => :'ProjectShort',
|
51
|
+
:'branch' => :'BranchName',
|
47
52
|
:'created_at' => :'DateTime',
|
48
|
-
:'updated_at' => :'DateTime'
|
49
|
-
:'project' => :'ProjectShort'
|
53
|
+
:'updated_at' => :'DateTime'
|
50
54
|
}
|
51
55
|
end
|
52
56
|
|
@@ -95,6 +99,14 @@ module Phrase
|
|
95
99
|
self.ticket_url = attributes[:'ticket_url']
|
96
100
|
end
|
97
101
|
|
102
|
+
if attributes.key?(:'project')
|
103
|
+
self.project = attributes[:'project']
|
104
|
+
end
|
105
|
+
|
106
|
+
if attributes.key?(:'branch')
|
107
|
+
self.branch = attributes[:'branch']
|
108
|
+
end
|
109
|
+
|
98
110
|
if attributes.key?(:'created_at')
|
99
111
|
self.created_at = attributes[:'created_at']
|
100
112
|
end
|
@@ -102,10 +114,6 @@ module Phrase
|
|
102
114
|
if attributes.key?(:'updated_at')
|
103
115
|
self.updated_at = attributes[:'updated_at']
|
104
116
|
end
|
105
|
-
|
106
|
-
if attributes.key?(:'project')
|
107
|
-
self.project = attributes[:'project']
|
108
|
-
end
|
109
117
|
end
|
110
118
|
|
111
119
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -132,9 +140,10 @@ module Phrase
|
|
132
140
|
due_date == o.due_date &&
|
133
141
|
state == o.state &&
|
134
142
|
ticket_url == o.ticket_url &&
|
143
|
+
project == o.project &&
|
144
|
+
branch == o.branch &&
|
135
145
|
created_at == o.created_at &&
|
136
|
-
updated_at == o.updated_at
|
137
|
-
project == o.project
|
146
|
+
updated_at == o.updated_at
|
138
147
|
end
|
139
148
|
|
140
149
|
# @see the `==` method
|
@@ -146,7 +155,7 @@ module Phrase
|
|
146
155
|
# Calculates hash code according to all attributes.
|
147
156
|
# @return [Integer] Hash code
|
148
157
|
def hash
|
149
|
-
[id, name, briefing, due_date, state, ticket_url, created_at, updated_at
|
158
|
+
[id, name, briefing, due_date, state, ticket_url, project, branch, created_at, updated_at].hash
|
150
159
|
end
|
151
160
|
|
152
161
|
# Builds the object from hash
|
@@ -14,12 +14,14 @@ module Phrase
|
|
14
14
|
|
15
15
|
attr_accessor :ticket_url
|
16
16
|
|
17
|
+
attr_accessor :project
|
18
|
+
|
19
|
+
attr_accessor :branch
|
20
|
+
|
17
21
|
attr_accessor :created_at
|
18
22
|
|
19
23
|
attr_accessor :updated_at
|
20
24
|
|
21
|
-
attr_accessor :project
|
22
|
-
|
23
25
|
attr_accessor :owner
|
24
26
|
|
25
27
|
attr_accessor :job_tag_name
|
@@ -37,9 +39,10 @@ module Phrase
|
|
37
39
|
:'due_date' => :'due_date',
|
38
40
|
:'state' => :'state',
|
39
41
|
:'ticket_url' => :'ticket_url',
|
42
|
+
:'project' => :'project',
|
43
|
+
:'branch' => :'branch',
|
40
44
|
:'created_at' => :'created_at',
|
41
45
|
:'updated_at' => :'updated_at',
|
42
|
-
:'project' => :'project',
|
43
46
|
:'owner' => :'owner',
|
44
47
|
:'job_tag_name' => :'job_tag_name',
|
45
48
|
:'locales' => :'locales',
|
@@ -56,9 +59,10 @@ module Phrase
|
|
56
59
|
:'due_date' => :'DateTime',
|
57
60
|
:'state' => :'String',
|
58
61
|
:'ticket_url' => :'String',
|
62
|
+
:'project' => :'ProjectShort',
|
63
|
+
:'branch' => :'BranchName',
|
59
64
|
:'created_at' => :'DateTime',
|
60
65
|
:'updated_at' => :'DateTime',
|
61
|
-
:'project' => :'ProjectShort',
|
62
66
|
:'owner' => :'UserPreview',
|
63
67
|
:'job_tag_name' => :'String',
|
64
68
|
:'locales' => :'Array<LocalePreview>',
|
@@ -119,6 +123,14 @@ module Phrase
|
|
119
123
|
self.ticket_url = attributes[:'ticket_url']
|
120
124
|
end
|
121
125
|
|
126
|
+
if attributes.key?(:'project')
|
127
|
+
self.project = attributes[:'project']
|
128
|
+
end
|
129
|
+
|
130
|
+
if attributes.key?(:'branch')
|
131
|
+
self.branch = attributes[:'branch']
|
132
|
+
end
|
133
|
+
|
122
134
|
if attributes.key?(:'created_at')
|
123
135
|
self.created_at = attributes[:'created_at']
|
124
136
|
end
|
@@ -127,10 +139,6 @@ module Phrase
|
|
127
139
|
self.updated_at = attributes[:'updated_at']
|
128
140
|
end
|
129
141
|
|
130
|
-
if attributes.key?(:'project')
|
131
|
-
self.project = attributes[:'project']
|
132
|
-
end
|
133
|
-
|
134
142
|
if attributes.key?(:'owner')
|
135
143
|
self.owner = attributes[:'owner']
|
136
144
|
end
|
@@ -176,9 +184,10 @@ module Phrase
|
|
176
184
|
due_date == o.due_date &&
|
177
185
|
state == o.state &&
|
178
186
|
ticket_url == o.ticket_url &&
|
187
|
+
project == o.project &&
|
188
|
+
branch == o.branch &&
|
179
189
|
created_at == o.created_at &&
|
180
190
|
updated_at == o.updated_at &&
|
181
|
-
project == o.project &&
|
182
191
|
owner == o.owner &&
|
183
192
|
job_tag_name == o.job_tag_name &&
|
184
193
|
locales == o.locales &&
|
@@ -194,7 +203,7 @@ module Phrase
|
|
194
203
|
# Calculates hash code according to all attributes.
|
195
204
|
# @return [Integer] Hash code
|
196
205
|
def hash
|
197
|
-
[id, name, briefing, due_date, state, ticket_url, created_at, updated_at,
|
206
|
+
[id, name, briefing, due_date, state, ticket_url, project, branch, created_at, updated_at, owner, job_tag_name, locales, keys].hash
|
198
207
|
end
|
199
208
|
|
200
209
|
# Builds the object from hash
|
@@ -10,13 +10,16 @@ module Phrase
|
|
10
10
|
|
11
11
|
attr_accessor :users
|
12
12
|
|
13
|
+
attr_accessor :completed
|
14
|
+
|
13
15
|
# Attribute mapping from ruby-style variable name to JSON key.
|
14
16
|
def self.attribute_map
|
15
17
|
{
|
16
18
|
:'id' => :'id',
|
17
19
|
:'job' => :'job',
|
18
20
|
:'locale' => :'locale',
|
19
|
-
:'users' => :'users'
|
21
|
+
:'users' => :'users',
|
22
|
+
:'completed' => :'completed'
|
20
23
|
}
|
21
24
|
end
|
22
25
|
|
@@ -26,7 +29,8 @@ module Phrase
|
|
26
29
|
:'id' => :'String',
|
27
30
|
:'job' => :'JobPreview',
|
28
31
|
:'locale' => :'LocalePreview',
|
29
|
-
:'users' => :'Array<UserPreview>'
|
32
|
+
:'users' => :'Array<UserPreview>',
|
33
|
+
:'completed' => :'Boolean'
|
30
34
|
}
|
31
35
|
end
|
32
36
|
|
@@ -68,6 +72,10 @@ module Phrase
|
|
68
72
|
self.users = value
|
69
73
|
end
|
70
74
|
end
|
75
|
+
|
76
|
+
if attributes.key?(:'completed')
|
77
|
+
self.completed = attributes[:'completed']
|
78
|
+
end
|
71
79
|
end
|
72
80
|
|
73
81
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -91,7 +99,8 @@ module Phrase
|
|
91
99
|
id == o.id &&
|
92
100
|
job == o.job &&
|
93
101
|
locale == o.locale &&
|
94
|
-
users == o.users
|
102
|
+
users == o.users &&
|
103
|
+
completed == o.completed
|
95
104
|
end
|
96
105
|
|
97
106
|
# @see the `==` method
|
@@ -103,7 +112,7 @@ module Phrase
|
|
103
112
|
# Calculates hash code according to all attributes.
|
104
113
|
# @return [Integer] Hash code
|
105
114
|
def hash
|
106
|
-
[id, job, locale, users].hash
|
115
|
+
[id, job, locale, users, completed].hash
|
107
116
|
end
|
108
117
|
|
109
118
|
# Builds the object from hash
|
data/lib/phrase/models/member.rb
CHANGED
@@ -12,6 +12,12 @@ module Phrase
|
|
12
12
|
|
13
13
|
attr_accessor :projects
|
14
14
|
|
15
|
+
attr_accessor :permissions
|
16
|
+
|
17
|
+
attr_accessor :default_locale_codes
|
18
|
+
|
19
|
+
attr_accessor :spaces
|
20
|
+
|
15
21
|
# Attribute mapping from ruby-style variable name to JSON key.
|
16
22
|
def self.attribute_map
|
17
23
|
{
|
@@ -19,7 +25,10 @@ module Phrase
|
|
19
25
|
:'email' => :'email',
|
20
26
|
:'username' => :'username',
|
21
27
|
:'role' => :'role',
|
22
|
-
:'projects' => :'projects'
|
28
|
+
:'projects' => :'projects',
|
29
|
+
:'permissions' => :'permissions',
|
30
|
+
:'default_locale_codes' => :'default_locale_codes',
|
31
|
+
:'spaces' => :'spaces'
|
23
32
|
}
|
24
33
|
end
|
25
34
|
|
@@ -30,7 +39,10 @@ module Phrase
|
|
30
39
|
:'email' => :'String',
|
31
40
|
:'username' => :'String',
|
32
41
|
:'role' => :'String',
|
33
|
-
:'projects' => :'Array<ProjectLocales>'
|
42
|
+
:'projects' => :'Array<ProjectLocales>',
|
43
|
+
:'permissions' => :'Object',
|
44
|
+
:'default_locale_codes' => :'Array<String>',
|
45
|
+
:'spaces' => :'Array<MemberSpaces>'
|
34
46
|
}
|
35
47
|
end
|
36
48
|
|
@@ -76,6 +88,22 @@ module Phrase
|
|
76
88
|
self.projects = value
|
77
89
|
end
|
78
90
|
end
|
91
|
+
|
92
|
+
if attributes.key?(:'permissions')
|
93
|
+
self.permissions = attributes[:'permissions']
|
94
|
+
end
|
95
|
+
|
96
|
+
if attributes.key?(:'default_locale_codes')
|
97
|
+
if (value = attributes[:'default_locale_codes']).is_a?(Array)
|
98
|
+
self.default_locale_codes = value
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
if attributes.key?(:'spaces')
|
103
|
+
if (value = attributes[:'spaces']).is_a?(Array)
|
104
|
+
self.spaces = value
|
105
|
+
end
|
106
|
+
end
|
79
107
|
end
|
80
108
|
|
81
109
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -100,7 +128,10 @@ module Phrase
|
|
100
128
|
email == o.email &&
|
101
129
|
username == o.username &&
|
102
130
|
role == o.role &&
|
103
|
-
projects == o.projects
|
131
|
+
projects == o.projects &&
|
132
|
+
permissions == o.permissions &&
|
133
|
+
default_locale_codes == o.default_locale_codes &&
|
134
|
+
spaces == o.spaces
|
104
135
|
end
|
105
136
|
|
106
137
|
# @see the `==` method
|
@@ -112,7 +143,7 @@ module Phrase
|
|
112
143
|
# Calculates hash code according to all attributes.
|
113
144
|
# @return [Integer] Hash code
|
114
145
|
def hash
|
115
|
-
[id, email, username, role, projects].hash
|
146
|
+
[id, email, username, role, projects, permissions, default_locale_codes, spaces].hash
|
116
147
|
end
|
117
148
|
|
118
149
|
# Builds the object from hash
|
@@ -0,0 +1,285 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module Phrase
|
4
|
+
class MemberProjectDetail
|
5
|
+
attr_accessor :id
|
6
|
+
|
7
|
+
attr_accessor :email
|
8
|
+
|
9
|
+
attr_accessor :username
|
10
|
+
|
11
|
+
attr_accessor :role
|
12
|
+
|
13
|
+
attr_accessor :projects
|
14
|
+
|
15
|
+
attr_accessor :permissions
|
16
|
+
|
17
|
+
attr_accessor :locale_ids
|
18
|
+
|
19
|
+
attr_accessor :default_locale_codes
|
20
|
+
|
21
|
+
attr_accessor :spaces
|
22
|
+
|
23
|
+
attr_accessor :project_roles
|
24
|
+
|
25
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
26
|
+
def self.attribute_map
|
27
|
+
{
|
28
|
+
:'id' => :'id',
|
29
|
+
:'email' => :'email',
|
30
|
+
:'username' => :'username',
|
31
|
+
:'role' => :'role',
|
32
|
+
:'projects' => :'projects',
|
33
|
+
:'permissions' => :'permissions',
|
34
|
+
:'locale_ids' => :'locale_ids',
|
35
|
+
:'default_locale_codes' => :'default_locale_codes',
|
36
|
+
:'spaces' => :'spaces',
|
37
|
+
:'project_roles' => :'project_roles'
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
# Attribute type mapping.
|
42
|
+
def self.openapi_types
|
43
|
+
{
|
44
|
+
:'id' => :'String',
|
45
|
+
:'email' => :'String',
|
46
|
+
:'username' => :'String',
|
47
|
+
:'role' => :'String',
|
48
|
+
:'projects' => :'Array<ProjectLocales>',
|
49
|
+
:'permissions' => :'Object',
|
50
|
+
:'locale_ids' => :'Array<String>',
|
51
|
+
:'default_locale_codes' => :'Array<String>',
|
52
|
+
:'spaces' => :'Array<MemberSpaces>',
|
53
|
+
:'project_roles' => :'Array<MemberProjectDetailProjectRoles>'
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
# List of attributes with nullable: true
|
58
|
+
def self.openapi_nullable
|
59
|
+
Set.new([
|
60
|
+
])
|
61
|
+
end
|
62
|
+
|
63
|
+
# Initializes the object
|
64
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
65
|
+
def initialize(attributes = {})
|
66
|
+
if (!attributes.is_a?(Hash))
|
67
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::MemberProjectDetail` initialize method"
|
68
|
+
end
|
69
|
+
|
70
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
71
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
72
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
73
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::MemberProjectDetail`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
74
|
+
end
|
75
|
+
h[k.to_sym] = v
|
76
|
+
}
|
77
|
+
|
78
|
+
if attributes.key?(:'id')
|
79
|
+
self.id = attributes[:'id']
|
80
|
+
end
|
81
|
+
|
82
|
+
if attributes.key?(:'email')
|
83
|
+
self.email = attributes[:'email']
|
84
|
+
end
|
85
|
+
|
86
|
+
if attributes.key?(:'username')
|
87
|
+
self.username = attributes[:'username']
|
88
|
+
end
|
89
|
+
|
90
|
+
if attributes.key?(:'role')
|
91
|
+
self.role = attributes[:'role']
|
92
|
+
end
|
93
|
+
|
94
|
+
if attributes.key?(:'projects')
|
95
|
+
if (value = attributes[:'projects']).is_a?(Array)
|
96
|
+
self.projects = value
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
if attributes.key?(:'permissions')
|
101
|
+
self.permissions = attributes[:'permissions']
|
102
|
+
end
|
103
|
+
|
104
|
+
if attributes.key?(:'locale_ids')
|
105
|
+
if (value = attributes[:'locale_ids']).is_a?(Array)
|
106
|
+
self.locale_ids = value
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
if attributes.key?(:'default_locale_codes')
|
111
|
+
if (value = attributes[:'default_locale_codes']).is_a?(Array)
|
112
|
+
self.default_locale_codes = value
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
if attributes.key?(:'spaces')
|
117
|
+
if (value = attributes[:'spaces']).is_a?(Array)
|
118
|
+
self.spaces = value
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
if attributes.key?(:'project_roles')
|
123
|
+
if (value = attributes[:'project_roles']).is_a?(Array)
|
124
|
+
self.project_roles = value
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
130
|
+
# @return Array for valid properties with the reasons
|
131
|
+
def list_invalid_properties
|
132
|
+
invalid_properties = Array.new
|
133
|
+
invalid_properties
|
134
|
+
end
|
135
|
+
|
136
|
+
# Check to see if the all the properties in the model are valid
|
137
|
+
# @return true if the model is valid
|
138
|
+
def valid?
|
139
|
+
true
|
140
|
+
end
|
141
|
+
|
142
|
+
# Checks equality by comparing each attribute.
|
143
|
+
# @param [Object] Object to be compared
|
144
|
+
def ==(o)
|
145
|
+
return true if self.equal?(o)
|
146
|
+
self.class == o.class &&
|
147
|
+
id == o.id &&
|
148
|
+
email == o.email &&
|
149
|
+
username == o.username &&
|
150
|
+
role == o.role &&
|
151
|
+
projects == o.projects &&
|
152
|
+
permissions == o.permissions &&
|
153
|
+
locale_ids == o.locale_ids &&
|
154
|
+
default_locale_codes == o.default_locale_codes &&
|
155
|
+
spaces == o.spaces &&
|
156
|
+
project_roles == o.project_roles
|
157
|
+
end
|
158
|
+
|
159
|
+
# @see the `==` method
|
160
|
+
# @param [Object] Object to be compared
|
161
|
+
def eql?(o)
|
162
|
+
self == o
|
163
|
+
end
|
164
|
+
|
165
|
+
# Calculates hash code according to all attributes.
|
166
|
+
# @return [Integer] Hash code
|
167
|
+
def hash
|
168
|
+
[id, email, username, role, projects, permissions, locale_ids, default_locale_codes, spaces, project_roles].hash
|
169
|
+
end
|
170
|
+
|
171
|
+
# Builds the object from hash
|
172
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
173
|
+
# @return [Object] Returns the model itself
|
174
|
+
def self.build_from_hash(attributes)
|
175
|
+
new.build_from_hash(attributes)
|
176
|
+
end
|
177
|
+
|
178
|
+
# Builds the object from hash
|
179
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
180
|
+
# @return [Object] Returns the model itself
|
181
|
+
def build_from_hash(attributes)
|
182
|
+
return nil unless attributes.is_a?(Hash)
|
183
|
+
self.class.openapi_types.each_pair do |key, type|
|
184
|
+
if type =~ /\AArray<(.*)>/i
|
185
|
+
# check to ensure the input is an array given that the attribute
|
186
|
+
# is documented as an array but the input is not
|
187
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
188
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
189
|
+
end
|
190
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
191
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
192
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
193
|
+
end
|
194
|
+
|
195
|
+
self
|
196
|
+
end
|
197
|
+
|
198
|
+
# Deserializes the data based on type
|
199
|
+
# @param string type Data type
|
200
|
+
# @param string value Value to be deserialized
|
201
|
+
# @return [Object] Deserialized data
|
202
|
+
def _deserialize(type, value)
|
203
|
+
case type.to_sym
|
204
|
+
when :DateTime
|
205
|
+
DateTime.parse(value)
|
206
|
+
when :Date
|
207
|
+
Date.parse(value)
|
208
|
+
when :String
|
209
|
+
value.to_s
|
210
|
+
when :Integer
|
211
|
+
value.to_i
|
212
|
+
when :Float
|
213
|
+
value.to_f
|
214
|
+
when :Boolean
|
215
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
216
|
+
true
|
217
|
+
else
|
218
|
+
false
|
219
|
+
end
|
220
|
+
when :Object
|
221
|
+
# generic object (usually a Hash), return directly
|
222
|
+
value
|
223
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
224
|
+
inner_type = Regexp.last_match[:inner_type]
|
225
|
+
value.map { |v| _deserialize(inner_type, v) }
|
226
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
227
|
+
k_type = Regexp.last_match[:k_type]
|
228
|
+
v_type = Regexp.last_match[:v_type]
|
229
|
+
{}.tap do |hash|
|
230
|
+
value.each do |k, v|
|
231
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
232
|
+
end
|
233
|
+
end
|
234
|
+
else # model
|
235
|
+
Phrase.const_get(type).build_from_hash(value)
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
# Returns the string representation of the object
|
240
|
+
# @return [String] String presentation of the object
|
241
|
+
def to_s
|
242
|
+
to_hash.to_s
|
243
|
+
end
|
244
|
+
|
245
|
+
# to_body is an alias to to_hash (backward compatibility)
|
246
|
+
# @return [Hash] Returns the object in the form of hash
|
247
|
+
def to_body
|
248
|
+
to_hash
|
249
|
+
end
|
250
|
+
|
251
|
+
# Returns the object in the form of hash
|
252
|
+
# @return [Hash] Returns the object in the form of hash
|
253
|
+
def to_hash
|
254
|
+
hash = {}
|
255
|
+
self.class.attribute_map.each_pair do |attr, param|
|
256
|
+
value = self.send(attr)
|
257
|
+
if value.nil?
|
258
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
259
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
260
|
+
end
|
261
|
+
|
262
|
+
hash[param] = _to_hash(value)
|
263
|
+
end
|
264
|
+
hash
|
265
|
+
end
|
266
|
+
|
267
|
+
# Outputs non-array value in the form of hash
|
268
|
+
# For object, use to_hash. Otherwise, just return the value
|
269
|
+
# @param [Object] value Any valid value
|
270
|
+
# @return [Hash] Returns the value in the form of hash
|
271
|
+
def _to_hash(value)
|
272
|
+
if value.is_a?(Array)
|
273
|
+
value.compact.map { |v| _to_hash(v) }
|
274
|
+
elsif value.is_a?(Hash)
|
275
|
+
{}.tap do |hash|
|
276
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
277
|
+
end
|
278
|
+
elsif value.respond_to? :to_hash
|
279
|
+
value.to_hash
|
280
|
+
else
|
281
|
+
value
|
282
|
+
end
|
283
|
+
end
|
284
|
+
end
|
285
|
+
end
|