phrase 1.0.10 → 1.0.11

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.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -3
  3. data/docs/Invitation.md +5 -1
  4. data/docs/InvitationCreateParameters.md +4 -0
  5. data/docs/InvitationUpdateParameters.md +4 -0
  6. data/docs/Member.md +7 -1
  7. data/docs/MemberProjectDetail.md +35 -0
  8. data/docs/MemberProjectDetailProjectRoles.md +19 -0
  9. data/docs/MemberSpaces.md +25 -0
  10. data/docs/MemberUpdateParameters.md +4 -0
  11. data/docs/MemberUpdateSettingsParameters.md +19 -0
  12. data/docs/MembersApi.md +66 -0
  13. data/lib/phrase.rb +4 -0
  14. data/lib/phrase/api/members_api.rb +80 -0
  15. data/lib/phrase/models/invitation.rb +26 -4
  16. data/lib/phrase/models/invitation_create_parameters.rb +25 -1
  17. data/lib/phrase/models/invitation_update_parameters.rb +25 -1
  18. data/lib/phrase/models/member.rb +35 -4
  19. data/lib/phrase/models/member_project_detail.rb +285 -0
  20. data/lib/phrase/models/member_project_detail_project_roles.rb +203 -0
  21. data/lib/phrase/models/member_spaces.rb +230 -0
  22. data/lib/phrase/models/member_update_parameters.rb +25 -1
  23. data/lib/phrase/models/member_update_settings_parameters.rb +207 -0
  24. data/lib/phrase/version.rb +1 -1
  25. data/spec/api/members_api_spec.rb +15 -0
  26. data/spec/models/invitation_create_parameters_spec.rb +12 -0
  27. data/spec/models/invitation_spec.rb +12 -0
  28. data/spec/models/invitation_update_parameters_spec.rb +12 -0
  29. data/spec/models/member_project_detail_project_roles_spec.rb +35 -0
  30. data/spec/models/member_project_detail_spec.rb +83 -0
  31. data/spec/models/member_spaces_spec.rb +53 -0
  32. data/spec/models/member_spec.rb +18 -0
  33. data/spec/models/member_update_parameters_spec.rb +12 -0
  34. data/spec/models/member_update_settings_parameters_spec.rb +35 -0
  35. metadata +18 -2
@@ -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
@@ -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