gopad 1.13.0 → 1.14.0

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 (30) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -0
  3. data/README.md +3 -3
  4. data/lib/gopad/api/auth_api.rb +99 -47
  5. data/lib/gopad/api/{team_api.rb → group_api.rb} +175 -185
  6. data/lib/gopad/api/profile_api.rb +12 -12
  7. data/lib/gopad/api/user_api.rb +99 -109
  8. data/lib/gopad/configuration.rb +0 -7
  9. data/lib/gopad/models/{users.rb → create_group_request.rb} +19 -17
  10. data/lib/gopad/models/create_user_request.rb +258 -0
  11. data/lib/gopad/models/{teams.rb → delete_group_from_user_request.rb} +20 -20
  12. data/lib/gopad/models/{team_users.rb → delete_user_from_group_request.rb} +20 -27
  13. data/lib/gopad/models/{team.rb → group.rb} +9 -17
  14. data/lib/gopad/models/{user_team_params.rb → list_group_users200_response.rb} +61 -58
  15. data/lib/gopad/models/list_groups200_response.rb +260 -0
  16. data/lib/gopad/models/list_providers200_response.rb +236 -0
  17. data/lib/gopad/models/{team_user_params.rb → list_user_groups200_response.rb} +59 -56
  18. data/lib/gopad/models/list_users200_response.rb +260 -0
  19. data/lib/gopad/models/{auth_login.rb → login_auth_request.rb} +4 -3
  20. data/lib/gopad/models/permit_group_user_request.rb +232 -0
  21. data/lib/gopad/models/permit_user_group_request.rb +232 -0
  22. data/lib/gopad/models/profile.rb +8 -8
  23. data/lib/gopad/models/{user_teams.rb → provider.rb} +28 -21
  24. data/lib/gopad/models/update_profile_request.rb +238 -0
  25. data/lib/gopad/models/update_user_request.rb +254 -0
  26. data/lib/gopad/models/user.rb +5 -13
  27. data/lib/gopad/models/{user_team.rb → user_group.rb} +22 -22
  28. data/lib/gopad/version.rb +1 -1
  29. data/lib/gopad.rb +18 -10
  30. metadata +20 -12
@@ -0,0 +1,254 @@
1
+ # Gopad OpenAPI
2
+ #
3
+ # API definition for Gopad, Etherpad for markdown with go
4
+ #
5
+ # The version of the OpenAPI document: 1.0.0-alpha1
6
+ # Contact: gopad@webhippie.de
7
+ # Generated by: https://openapi-generator.tech
8
+ # Generator version: 7.6.0
9
+ #
10
+
11
+ require 'date'
12
+ require 'time'
13
+
14
+ module Gopad
15
+ class UpdateUserRequest
16
+ attr_accessor :username, :password, :email, :fullname, :admin, :active
17
+
18
+ # Attribute mapping from ruby-style variable name to JSON key.
19
+ def self.attribute_map
20
+ {
21
+ username: :username,
22
+ password: :password,
23
+ email: :email,
24
+ fullname: :fullname,
25
+ admin: :admin,
26
+ active: :active
27
+ }
28
+ end
29
+
30
+ # Returns all the JSON keys this model knows about
31
+ def self.acceptable_attributes
32
+ attribute_map.values
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ username: :String,
39
+ password: :String,
40
+ email: :String,
41
+ fullname: :String,
42
+ admin: :Boolean,
43
+ active: :Boolean
44
+ }
45
+ end
46
+
47
+ # List of attributes with nullable: true
48
+ def self.openapi_nullable
49
+ Set.new(%i[
50
+ username
51
+ password
52
+ email
53
+ fullname
54
+ admin
55
+ active
56
+ ])
57
+ end
58
+
59
+ # Initializes the object
60
+ # @param [Hash] attributes Model attributes in the form of hash
61
+ def initialize(attributes = {})
62
+ unless attributes.is_a?(Hash)
63
+ raise ArgumentError, 'The input argument (attributes) must be a hash in `Gopad::UpdateUserRequest` initialize method'
64
+ end
65
+
66
+ # check to see if the attribute exists and convert string to symbol for hash key
67
+ attributes = attributes.each_with_object({}) do |(k, v), h|
68
+ unless self.class.attribute_map.key?(k.to_sym)
69
+ raise ArgumentError,
70
+ "`#{k}` is not a valid attribute in `Gopad::UpdateUserRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
71
+ end
72
+
73
+ h[k.to_sym] = v
74
+ end
75
+
76
+ if attributes.key?(:username)
77
+ self.username = attributes[:username]
78
+ end
79
+
80
+ if attributes.key?(:password)
81
+ self.password = attributes[:password]
82
+ end
83
+
84
+ if attributes.key?(:email)
85
+ self.email = attributes[:email]
86
+ end
87
+
88
+ if attributes.key?(:fullname)
89
+ self.fullname = attributes[:fullname]
90
+ end
91
+
92
+ if attributes.key?(:admin)
93
+ self.admin = attributes[:admin]
94
+ end
95
+
96
+ if attributes.key?(:active)
97
+ self.active = attributes[:active]
98
+ end
99
+ end
100
+
101
+ # Show invalid properties with the reasons. Usually used together with valid?
102
+ # @return Array for valid properties with the reasons
103
+ def list_invalid_properties
104
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
105
+ []
106
+ end
107
+
108
+ # Check to see if the all the properties in the model are valid
109
+ # @return true if the model is valid
110
+ def valid?
111
+ warn '[DEPRECATED] the `valid?` method is obsolete'
112
+ true
113
+ end
114
+
115
+ # Checks equality by comparing each attribute.
116
+ # @param [Object] Object to be compared
117
+ def ==(other)
118
+ return true if equal?(other)
119
+
120
+ self.class == other.class &&
121
+ username == other.username &&
122
+ password == other.password &&
123
+ email == other.email &&
124
+ fullname == other.fullname &&
125
+ admin == other.admin &&
126
+ active == other.active
127
+ end
128
+
129
+ # @see the `==` method
130
+ # @param [Object] Object to be compared
131
+ def eql?(other)
132
+ self == other
133
+ end
134
+
135
+ # Calculates hash code according to all attributes.
136
+ # @return [Integer] Hash code
137
+ def hash
138
+ [username, password, email, fullname, admin, active].hash
139
+ end
140
+
141
+ # Builds the object from hash
142
+ # @param [Hash] attributes Model attributes in the form of hash
143
+ # @return [Object] Returns the model itself
144
+ def self.build_from_hash(attributes)
145
+ return nil unless attributes.is_a?(Hash)
146
+
147
+ attributes = attributes.transform_keys(&:to_sym)
148
+ transformed_hash = {}
149
+ openapi_types.each_pair do |key, type|
150
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
151
+ transformed_hash[key.to_s] = nil
152
+ elsif type =~ /\AArray<(.*)>/i
153
+ # check to ensure the input is an array given that the attribute
154
+ # is documented as an array but the input is not
155
+ if attributes[attribute_map[key]].is_a?(Array)
156
+ transformed_hash[key.to_s] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
157
+ end
158
+ elsif !attributes[attribute_map[key]].nil?
159
+ transformed_hash[key.to_s] = _deserialize(type, attributes[attribute_map[key]])
160
+ end
161
+ end
162
+ new(transformed_hash)
163
+ end
164
+
165
+ # Deserializes the data based on type
166
+ # @param string type Data type
167
+ # @param string value Value to be deserialized
168
+ # @return [Object] Deserialized data
169
+ def self._deserialize(type, value)
170
+ case type.to_sym
171
+ when :Time
172
+ Time.parse(value)
173
+ when :Date
174
+ Date.parse(value)
175
+ when :String
176
+ value.to_s
177
+ when :Integer
178
+ value.to_i
179
+ when :Float
180
+ value.to_f
181
+ when :Boolean
182
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
183
+ true
184
+ else
185
+ false
186
+ end
187
+ when :Object
188
+ # generic object (usually a Hash), return directly
189
+ value
190
+ when /\AArray<(?<inner_type>.+)>\z/
191
+ inner_type = Regexp.last_match[:inner_type]
192
+ value.map { |v| _deserialize(inner_type, v) }
193
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
194
+ k_type = Regexp.last_match[:k_type]
195
+ v_type = Regexp.last_match[:v_type]
196
+ {}.tap do |hash|
197
+ value.each do |k, v|
198
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
199
+ end
200
+ end
201
+ else # model
202
+ # models (e.g. Pet) or oneOf
203
+ klass = Gopad.const_get(type)
204
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
205
+ end
206
+ end
207
+
208
+ # Returns the string representation of the object
209
+ # @return [String] String presentation of the object
210
+ def to_s
211
+ to_hash.to_s
212
+ end
213
+
214
+ # to_body is an alias to to_hash (backward compatibility)
215
+ # @return [Hash] Returns the object in the form of hash
216
+ def to_body
217
+ to_hash
218
+ end
219
+
220
+ # Returns the object in the form of hash
221
+ # @return [Hash] Returns the object in the form of hash
222
+ def to_hash
223
+ hash = {}
224
+ self.class.attribute_map.each_pair do |attr, param|
225
+ value = send(attr)
226
+ if value.nil?
227
+ is_nullable = self.class.openapi_nullable.include?(attr)
228
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
229
+ end
230
+
231
+ hash[param] = _to_hash(value)
232
+ end
233
+ hash
234
+ end
235
+
236
+ # Outputs non-array value in the form of hash
237
+ # For object, use to_hash. Otherwise, just return the value
238
+ # @param [Object] value Any valid value
239
+ # @return [Hash] Returns the value in the form of hash
240
+ def _to_hash(value)
241
+ if value.is_a?(Array)
242
+ value.compact.map { |v| _to_hash(v) }
243
+ elsif value.is_a?(Hash)
244
+ {}.tap do |hash|
245
+ value.each { |k, v| hash[k] = _to_hash(v) }
246
+ end
247
+ elsif value.respond_to? :to_hash
248
+ value.to_hash
249
+ else
250
+ value
251
+ end
252
+ end
253
+ end
254
+ end
@@ -14,7 +14,7 @@ require 'time'
14
14
  module Gopad
15
15
  # Model to represent user
16
16
  class User
17
- attr_accessor :id, :username, :password, :email, :fullname, :profile, :admin, :active, :created_at, :updated_at, :auths, :teams
17
+ attr_accessor :id, :username, :password, :email, :fullname, :profile, :admin, :active, :created_at, :updated_at, :auths
18
18
 
19
19
  # Attribute mapping from ruby-style variable name to JSON key.
20
20
  def self.attribute_map
@@ -29,8 +29,7 @@ module Gopad
29
29
  active: :active,
30
30
  created_at: :created_at,
31
31
  updated_at: :updated_at,
32
- auths: :auths,
33
- teams: :teams
32
+ auths: :auths
34
33
  }
35
34
  end
36
35
 
@@ -52,8 +51,7 @@ module Gopad
52
51
  active: :Boolean,
53
52
  created_at: :Time,
54
53
  updated_at: :Time,
55
- auths: :'Array<UserAuth>',
56
- teams: :'Array<UserTeam>'
54
+ auths: :'Array<UserAuth>'
57
55
  }
58
56
  end
59
57
 
@@ -68,7 +66,6 @@ module Gopad
68
66
  admin
69
67
  active
70
68
  auths
71
- teams
72
69
  ])
73
70
  end
74
71
 
@@ -131,10 +128,6 @@ module Gopad
131
128
  if attributes.key?(:auths) && (value = attributes[:auths]).is_a?(Array)
132
129
  self.auths = value
133
130
  end
134
-
135
- if attributes.key?(:teams) && (value = attributes[:teams]).is_a?(Array)
136
- self.teams = value
137
- end
138
131
  end
139
132
 
140
133
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -167,8 +160,7 @@ module Gopad
167
160
  active == other.active &&
168
161
  created_at == other.created_at &&
169
162
  updated_at == other.updated_at &&
170
- auths == other.auths &&
171
- teams == other.teams
163
+ auths == other.auths
172
164
  end
173
165
 
174
166
  # @see the `==` method
@@ -180,7 +172,7 @@ module Gopad
180
172
  # Calculates hash code according to all attributes.
181
173
  # @return [Integer] Hash code
182
174
  def hash
183
- [id, username, password, email, fullname, profile, admin, active, created_at, updated_at, auths, teams].hash
175
+ [id, username, password, email, fullname, profile, admin, active, created_at, updated_at, auths].hash
184
176
  end
185
177
 
186
178
  # Builds the object from hash
@@ -12,9 +12,9 @@ require 'date'
12
12
  require 'time'
13
13
 
14
14
  module Gopad
15
- # Model to represent user team
16
- class UserTeam
17
- attr_accessor :user_id, :user, :team_id, :team, :perm, :created_at, :updated_at
15
+ # Model to represent user group
16
+ class UserGroup
17
+ attr_accessor :user_id, :user, :group_id, :group, :perm, :created_at, :updated_at
18
18
 
19
19
  class EnumAttributeValidator
20
20
  attr_reader :datatype, :allowable_values
@@ -42,8 +42,8 @@ module Gopad
42
42
  {
43
43
  user_id: :user_id,
44
44
  user: :user,
45
- team_id: :team_id,
46
- team: :team,
45
+ group_id: :group_id,
46
+ group: :group,
47
47
  perm: :perm,
48
48
  created_at: :created_at,
49
49
  updated_at: :updated_at
@@ -60,8 +60,8 @@ module Gopad
60
60
  {
61
61
  user_id: :String,
62
62
  user: :User,
63
- team_id: :String,
64
- team: :Team,
63
+ group_id: :String,
64
+ group: :Group,
65
65
  perm: :String,
66
66
  created_at: :Time,
67
67
  updated_at: :Time
@@ -78,13 +78,13 @@ module Gopad
78
78
  # @param [Hash] attributes Model attributes in the form of hash
79
79
  def initialize(attributes = {})
80
80
  unless attributes.is_a?(Hash)
81
- raise ArgumentError, 'The input argument (attributes) must be a hash in `Gopad::UserTeam` initialize method'
81
+ raise ArgumentError, 'The input argument (attributes) must be a hash in `Gopad::UserGroup` initialize method'
82
82
  end
83
83
 
84
84
  # check to see if the attribute exists and convert string to symbol for hash key
85
85
  attributes = attributes.each_with_object({}) do |(k, v), h|
86
86
  unless self.class.attribute_map.key?(k.to_sym)
87
- raise ArgumentError, "`#{k}` is not a valid attribute in `Gopad::UserTeam`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
87
+ raise ArgumentError, "`#{k}` is not a valid attribute in `Gopad::UserGroup`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
88
88
  end
89
89
 
90
90
  h[k.to_sym] = v
@@ -98,12 +98,12 @@ module Gopad
98
98
  self.user = attributes[:user]
99
99
  end
100
100
 
101
- self.team_id = if attributes.key?(:team_id)
102
- attributes[:team_id]
103
- end
101
+ self.group_id = if attributes.key?(:group_id)
102
+ attributes[:group_id]
103
+ end
104
104
 
105
- if attributes.key?(:team)
106
- self.team = attributes[:team]
105
+ if attributes.key?(:group)
106
+ self.group = attributes[:group]
107
107
  end
108
108
 
109
109
  self.perm = if attributes.key?(:perm)
@@ -130,8 +130,8 @@ module Gopad
130
130
  invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
131
131
  end
132
132
 
133
- if @team_id.nil?
134
- invalid_properties.push('invalid value for "team_id", team_id cannot be nil.')
133
+ if @group_id.nil?
134
+ invalid_properties.push('invalid value for "group_id", group_id cannot be nil.')
135
135
  end
136
136
 
137
137
  invalid_properties
@@ -142,9 +142,9 @@ module Gopad
142
142
  def valid?
143
143
  warn '[DEPRECATED] the `valid?` method is obsolete'
144
144
  return false if @user_id.nil?
145
- return false if @team_id.nil?
145
+ return false if @group_id.nil?
146
146
 
147
- perm_validator = EnumAttributeValidator.new('String', %w[user admin owner])
147
+ perm_validator = EnumAttributeValidator.new('String', %w[owner user admin])
148
148
  return false unless perm_validator.valid?(@perm)
149
149
 
150
150
  true
@@ -153,7 +153,7 @@ module Gopad
153
153
  # Custom attribute writer method checking allowed values (enum).
154
154
  # @param [Object] perm Object to be assigned
155
155
  def perm=(perm)
156
- validator = EnumAttributeValidator.new('String', %w[user admin owner])
156
+ validator = EnumAttributeValidator.new('String', %w[owner user admin])
157
157
  unless validator.valid?(perm)
158
158
  raise ArgumentError, "invalid value for \"perm\", must be one of #{validator.allowable_values}."
159
159
  end
@@ -169,8 +169,8 @@ module Gopad
169
169
  self.class == other.class &&
170
170
  user_id == other.user_id &&
171
171
  user == other.user &&
172
- team_id == other.team_id &&
173
- team == other.team &&
172
+ group_id == other.group_id &&
173
+ group == other.group &&
174
174
  perm == other.perm &&
175
175
  created_at == other.created_at &&
176
176
  updated_at == other.updated_at
@@ -185,7 +185,7 @@ module Gopad
185
185
  # Calculates hash code according to all attributes.
186
186
  # @return [Integer] Hash code
187
187
  def hash
188
- [user_id, user, team_id, team, perm, created_at, updated_at].hash
188
+ [user_id, user, group_id, group, perm, created_at, updated_at].hash
189
189
  end
190
190
 
191
191
  # Builds the object from hash
data/lib/gopad/version.rb CHANGED
@@ -9,5 +9,5 @@
9
9
  #
10
10
 
11
11
  module Gopad
12
- VERSION = '1.13.0'.freeze
12
+ VERSION = '1.14.0'.freeze
13
13
  end
data/lib/gopad.rb CHANGED
@@ -15,27 +15,35 @@ require 'gopad/version'
15
15
  require 'gopad/configuration'
16
16
 
17
17
  # Models
18
- require 'gopad/models/auth_login'
19
18
  require 'gopad/models/auth_token'
20
19
  require 'gopad/models/auth_verify'
20
+ require 'gopad/models/create_group_request'
21
+ require 'gopad/models/create_user_request'
22
+ require 'gopad/models/delete_group_from_user_request'
23
+ require 'gopad/models/delete_user_from_group_request'
24
+ require 'gopad/models/group'
25
+ require 'gopad/models/list_group_users200_response'
26
+ require 'gopad/models/list_groups200_response'
27
+ require 'gopad/models/list_providers200_response'
28
+ require 'gopad/models/list_user_groups200_response'
29
+ require 'gopad/models/list_users200_response'
30
+ require 'gopad/models/login_auth_request'
21
31
  require 'gopad/models/notification'
32
+ require 'gopad/models/permit_group_user_request'
33
+ require 'gopad/models/permit_user_group_request'
22
34
  require 'gopad/models/profile'
23
- require 'gopad/models/team'
24
- require 'gopad/models/team_user_params'
25
- require 'gopad/models/team_users'
26
- require 'gopad/models/teams'
35
+ require 'gopad/models/provider'
36
+ require 'gopad/models/update_profile_request'
37
+ require 'gopad/models/update_user_request'
27
38
  require 'gopad/models/user'
28
39
  require 'gopad/models/user_auth'
29
- require 'gopad/models/user_team'
30
- require 'gopad/models/user_team_params'
31
- require 'gopad/models/user_teams'
32
- require 'gopad/models/users'
40
+ require 'gopad/models/user_group'
33
41
  require 'gopad/models/validation'
34
42
 
35
43
  # APIs
36
44
  require 'gopad/api/auth_api'
45
+ require 'gopad/api/group_api'
37
46
  require 'gopad/api/profile_api'
38
- require 'gopad/api/team_api'
39
47
  require 'gopad/api/user_api'
40
48
 
41
49
  module Gopad
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gopad
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.0
4
+ version: 1.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Boerger
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-02-17 00:00:00.000000000 Z
10
+ date: 2025-02-24 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: faraday
@@ -65,27 +65,35 @@ files:
65
65
  - README.md
66
66
  - lib/gopad.rb
67
67
  - lib/gopad/api/auth_api.rb
68
+ - lib/gopad/api/group_api.rb
68
69
  - lib/gopad/api/profile_api.rb
69
- - lib/gopad/api/team_api.rb
70
70
  - lib/gopad/api/user_api.rb
71
71
  - lib/gopad/api_client.rb
72
72
  - lib/gopad/api_error.rb
73
73
  - lib/gopad/configuration.rb
74
- - lib/gopad/models/auth_login.rb
75
74
  - lib/gopad/models/auth_token.rb
76
75
  - lib/gopad/models/auth_verify.rb
76
+ - lib/gopad/models/create_group_request.rb
77
+ - lib/gopad/models/create_user_request.rb
78
+ - lib/gopad/models/delete_group_from_user_request.rb
79
+ - lib/gopad/models/delete_user_from_group_request.rb
80
+ - lib/gopad/models/group.rb
81
+ - lib/gopad/models/list_group_users200_response.rb
82
+ - lib/gopad/models/list_groups200_response.rb
83
+ - lib/gopad/models/list_providers200_response.rb
84
+ - lib/gopad/models/list_user_groups200_response.rb
85
+ - lib/gopad/models/list_users200_response.rb
86
+ - lib/gopad/models/login_auth_request.rb
77
87
  - lib/gopad/models/notification.rb
88
+ - lib/gopad/models/permit_group_user_request.rb
89
+ - lib/gopad/models/permit_user_group_request.rb
78
90
  - lib/gopad/models/profile.rb
79
- - lib/gopad/models/team.rb
80
- - lib/gopad/models/team_user_params.rb
81
- - lib/gopad/models/team_users.rb
82
- - lib/gopad/models/teams.rb
91
+ - lib/gopad/models/provider.rb
92
+ - lib/gopad/models/update_profile_request.rb
93
+ - lib/gopad/models/update_user_request.rb
83
94
  - lib/gopad/models/user.rb
84
95
  - lib/gopad/models/user_auth.rb
85
- - lib/gopad/models/user_team.rb
86
- - lib/gopad/models/user_team_params.rb
87
- - lib/gopad/models/user_teams.rb
88
- - lib/gopad/models/users.rb
96
+ - lib/gopad/models/user_group.rb
89
97
  - lib/gopad/models/validation.rb
90
98
  - lib/gopad/version.rb
91
99
  homepage: https://github.com/gopad/gopad-ruby