gopad 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,227 @@
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 AuthVerify
16
+ attr_accessor :username, :created_at
17
+
18
+ # Attribute mapping from ruby-style variable name to JSON key.
19
+ def self.attribute_map
20
+ {
21
+ username: :username,
22
+ created_at: :created_at
23
+ }
24
+ end
25
+
26
+ # Returns all the JSON keys this model knows about
27
+ def self.acceptable_attributes
28
+ attribute_map.values
29
+ end
30
+
31
+ # Attribute type mapping.
32
+ def self.openapi_types
33
+ {
34
+ username: :String,
35
+ created_at: :Time
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ :created_at
43
+ ])
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ unless attributes.is_a?(Hash)
50
+ raise ArgumentError, 'The input argument (attributes) must be a hash in `Gopad::AuthVerify` initialize method'
51
+ end
52
+
53
+ # check to see if the attribute exists and convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) do |(k, v), h|
55
+ unless self.class.attribute_map.key?(k.to_sym)
56
+ raise ArgumentError, "`#{k}` is not a valid attribute in `Gopad::AuthVerify`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
+ end
58
+
59
+ h[k.to_sym] = v
60
+ end
61
+
62
+ self.username = if attributes.key?(:username)
63
+ attributes[:username]
64
+ end
65
+
66
+ if attributes.key?(:created_at)
67
+ self.created_at = attributes[:created_at]
68
+ end
69
+ end
70
+
71
+ # Show invalid properties with the reasons. Usually used together with valid?
72
+ # @return Array for valid properties with the reasons
73
+ def list_invalid_properties
74
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
75
+ invalid_properties = []
76
+ if @username.nil?
77
+ invalid_properties.push('invalid value for "username", username cannot be nil.')
78
+ end
79
+
80
+ invalid_properties
81
+ end
82
+
83
+ # Check to see if the all the properties in the model are valid
84
+ # @return true if the model is valid
85
+ def valid?
86
+ warn '[DEPRECATED] the `valid?` method is obsolete'
87
+ return false if @username.nil?
88
+
89
+ true
90
+ end
91
+
92
+ # Checks equality by comparing each attribute.
93
+ # @param [Object] Object to be compared
94
+ def ==(other)
95
+ return true if equal?(other)
96
+
97
+ self.class == other.class &&
98
+ username == other.username &&
99
+ created_at == other.created_at
100
+ end
101
+
102
+ # @see the `==` method
103
+ # @param [Object] Object to be compared
104
+ def eql?(other)
105
+ self == other
106
+ end
107
+
108
+ # Calculates hash code according to all attributes.
109
+ # @return [Integer] Hash code
110
+ def hash
111
+ [username, created_at].hash
112
+ end
113
+
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
117
+ def self.build_from_hash(attributes)
118
+ return nil unless attributes.is_a?(Hash)
119
+
120
+ attributes = attributes.transform_keys(&:to_sym)
121
+ transformed_hash = {}
122
+ openapi_types.each_pair do |key, type|
123
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
124
+ transformed_hash[key.to_s] = nil
125
+ elsif type =~ /\AArray<(.*)>/i
126
+ # check to ensure the input is an array given that the attribute
127
+ # is documented as an array but the input is not
128
+ if attributes[attribute_map[key]].is_a?(Array)
129
+ transformed_hash[key.to_s] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
130
+ end
131
+ elsif !attributes[attribute_map[key]].nil?
132
+ transformed_hash[key.to_s] = _deserialize(type, attributes[attribute_map[key]])
133
+ end
134
+ end
135
+ new(transformed_hash)
136
+ end
137
+
138
+ # Deserializes the data based on type
139
+ # @param string type Data type
140
+ # @param string value Value to be deserialized
141
+ # @return [Object] Deserialized data
142
+ def self._deserialize(type, value)
143
+ case type.to_sym
144
+ when :Time
145
+ Time.parse(value)
146
+ when :Date
147
+ Date.parse(value)
148
+ when :String
149
+ value.to_s
150
+ when :Integer
151
+ value.to_i
152
+ when :Float
153
+ value.to_f
154
+ when :Boolean
155
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
156
+ true
157
+ else
158
+ false
159
+ end
160
+ when :Object
161
+ # generic object (usually a Hash), return directly
162
+ value
163
+ when /\AArray<(?<inner_type>.+)>\z/
164
+ inner_type = Regexp.last_match[:inner_type]
165
+ value.map { |v| _deserialize(inner_type, v) }
166
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
167
+ k_type = Regexp.last_match[:k_type]
168
+ v_type = Regexp.last_match[:v_type]
169
+ {}.tap do |hash|
170
+ value.each do |k, v|
171
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
172
+ end
173
+ end
174
+ else # model
175
+ # models (e.g. Pet) or oneOf
176
+ klass = Gopad.const_get(type)
177
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
178
+ end
179
+ end
180
+
181
+ # Returns the string representation of the object
182
+ # @return [String] String presentation of the object
183
+ def to_s
184
+ to_hash.to_s
185
+ end
186
+
187
+ # to_body is an alias to to_hash (backward compatibility)
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_body
190
+ to_hash
191
+ end
192
+
193
+ # Returns the object in the form of hash
194
+ # @return [Hash] Returns the object in the form of hash
195
+ def to_hash
196
+ hash = {}
197
+ self.class.attribute_map.each_pair do |attr, param|
198
+ value = send(attr)
199
+ if value.nil?
200
+ is_nullable = self.class.openapi_nullable.include?(attr)
201
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
202
+ end
203
+
204
+ hash[param] = _to_hash(value)
205
+ end
206
+ hash
207
+ end
208
+
209
+ # Outputs non-array value in the form of hash
210
+ # For object, use to_hash. Otherwise, just return the value
211
+ # @param [Object] value Any valid value
212
+ # @return [Hash] Returns the value in the form of hash
213
+ def _to_hash(value)
214
+ if value.is_a?(Array)
215
+ value.compact.map { |v| _to_hash(v) }
216
+ elsif value.is_a?(Hash)
217
+ {}.tap do |hash|
218
+ value.each { |k, v| hash[k] = _to_hash(v) }
219
+ end
220
+ elsif value.respond_to? :to_hash
221
+ value.to_hash
222
+ else
223
+ value
224
+ end
225
+ end
226
+ end
227
+ end
@@ -0,0 +1,297 @@
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
+ # Model to represent profile
16
+ class Profile
17
+ attr_accessor :id, :username, :password, :email, :fullname, :profile, :admin, :active, :created_at, :updated_at, :auths, :teams
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ id: :id,
23
+ username: :username,
24
+ password: :password,
25
+ email: :email,
26
+ fullname: :fullname,
27
+ profile: :profile,
28
+ admin: :admin,
29
+ active: :active,
30
+ created_at: :created_at,
31
+ updated_at: :updated_at,
32
+ auths: :auths,
33
+ teams: :teams
34
+ }
35
+ end
36
+
37
+ # Returns all the JSON keys this model knows about
38
+ def self.acceptable_attributes
39
+ attribute_map.values
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.openapi_types
44
+ {
45
+ id: :String,
46
+ username: :String,
47
+ password: :String,
48
+ email: :String,
49
+ fullname: :String,
50
+ profile: :String,
51
+ admin: :Boolean,
52
+ active: :Boolean,
53
+ created_at: :Time,
54
+ updated_at: :Time,
55
+ auths: :'Array<UserAuth>',
56
+ teams: :'Array<UserTeam>'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new(%i[
63
+ username
64
+ password
65
+ email
66
+ fullname
67
+ profile
68
+ auths
69
+ teams
70
+ ])
71
+ end
72
+
73
+ # Initializes the object
74
+ # @param [Hash] attributes Model attributes in the form of hash
75
+ def initialize(attributes = {})
76
+ unless attributes.is_a?(Hash)
77
+ raise ArgumentError, 'The input argument (attributes) must be a hash in `Gopad::Profile` initialize method'
78
+ end
79
+
80
+ # check to see if the attribute exists and convert string to symbol for hash key
81
+ attributes = attributes.each_with_object({}) do |(k, v), h|
82
+ unless self.class.attribute_map.key?(k.to_sym)
83
+ raise ArgumentError, "`#{k}` is not a valid attribute in `Gopad::Profile`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
84
+ end
85
+
86
+ h[k.to_sym] = v
87
+ end
88
+
89
+ if attributes.key?(:id)
90
+ self.id = attributes[:id]
91
+ end
92
+
93
+ if attributes.key?(:username)
94
+ self.username = attributes[:username]
95
+ end
96
+
97
+ if attributes.key?(:password)
98
+ self.password = attributes[:password]
99
+ end
100
+
101
+ if attributes.key?(:email)
102
+ self.email = attributes[:email]
103
+ end
104
+
105
+ if attributes.key?(:fullname)
106
+ self.fullname = attributes[:fullname]
107
+ end
108
+
109
+ if attributes.key?(:profile)
110
+ self.profile = attributes[:profile]
111
+ end
112
+
113
+ if attributes.key?(:admin)
114
+ self.admin = attributes[:admin]
115
+ end
116
+
117
+ if attributes.key?(:active)
118
+ self.active = attributes[:active]
119
+ end
120
+
121
+ if attributes.key?(:created_at)
122
+ self.created_at = attributes[:created_at]
123
+ end
124
+
125
+ if attributes.key?(:updated_at)
126
+ self.updated_at = attributes[:updated_at]
127
+ end
128
+
129
+ if attributes.key?(:auths) && (value = attributes[:auths]).is_a?(Array)
130
+ self.auths = value
131
+ end
132
+
133
+ if attributes.key?(:teams) && (value = attributes[:teams]).is_a?(Array)
134
+ self.teams = value
135
+ end
136
+ end
137
+
138
+ # Show invalid properties with the reasons. Usually used together with valid?
139
+ # @return Array for valid properties with the reasons
140
+ def list_invalid_properties
141
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
142
+ []
143
+ end
144
+
145
+ # Check to see if the all the properties in the model are valid
146
+ # @return true if the model is valid
147
+ def valid?
148
+ warn '[DEPRECATED] the `valid?` method is obsolete'
149
+ true
150
+ end
151
+
152
+ # Checks equality by comparing each attribute.
153
+ # @param [Object] Object to be compared
154
+ def ==(other)
155
+ return true if equal?(other)
156
+
157
+ self.class == other.class &&
158
+ id == other.id &&
159
+ username == other.username &&
160
+ password == other.password &&
161
+ email == other.email &&
162
+ fullname == other.fullname &&
163
+ profile == other.profile &&
164
+ admin == other.admin &&
165
+ active == other.active &&
166
+ created_at == other.created_at &&
167
+ updated_at == other.updated_at &&
168
+ auths == other.auths &&
169
+ teams == other.teams
170
+ end
171
+
172
+ # @see the `==` method
173
+ # @param [Object] Object to be compared
174
+ def eql?(other)
175
+ self == other
176
+ end
177
+
178
+ # Calculates hash code according to all attributes.
179
+ # @return [Integer] Hash code
180
+ def hash
181
+ [id, username, password, email, fullname, profile, admin, active, created_at, updated_at, auths, teams].hash
182
+ end
183
+
184
+ # Builds the object from hash
185
+ # @param [Hash] attributes Model attributes in the form of hash
186
+ # @return [Object] Returns the model itself
187
+ def self.build_from_hash(attributes)
188
+ return nil unless attributes.is_a?(Hash)
189
+
190
+ attributes = attributes.transform_keys(&:to_sym)
191
+ transformed_hash = {}
192
+ openapi_types.each_pair do |key, type|
193
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
194
+ transformed_hash[key.to_s] = nil
195
+ elsif type =~ /\AArray<(.*)>/i
196
+ # check to ensure the input is an array given that the attribute
197
+ # is documented as an array but the input is not
198
+ if attributes[attribute_map[key]].is_a?(Array)
199
+ transformed_hash[key.to_s] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
200
+ end
201
+ elsif !attributes[attribute_map[key]].nil?
202
+ transformed_hash[key.to_s] = _deserialize(type, attributes[attribute_map[key]])
203
+ end
204
+ end
205
+ new(transformed_hash)
206
+ end
207
+
208
+ # Deserializes the data based on type
209
+ # @param string type Data type
210
+ # @param string value Value to be deserialized
211
+ # @return [Object] Deserialized data
212
+ def self._deserialize(type, value)
213
+ case type.to_sym
214
+ when :Time
215
+ Time.parse(value)
216
+ when :Date
217
+ Date.parse(value)
218
+ when :String
219
+ value.to_s
220
+ when :Integer
221
+ value.to_i
222
+ when :Float
223
+ value.to_f
224
+ when :Boolean
225
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
226
+ true
227
+ else
228
+ false
229
+ end
230
+ when :Object
231
+ # generic object (usually a Hash), return directly
232
+ value
233
+ when /\AArray<(?<inner_type>.+)>\z/
234
+ inner_type = Regexp.last_match[:inner_type]
235
+ value.map { |v| _deserialize(inner_type, v) }
236
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
237
+ k_type = Regexp.last_match[:k_type]
238
+ v_type = Regexp.last_match[:v_type]
239
+ {}.tap do |hash|
240
+ value.each do |k, v|
241
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
242
+ end
243
+ end
244
+ else # model
245
+ # models (e.g. Pet) or oneOf
246
+ klass = Gopad.const_get(type)
247
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
248
+ end
249
+ end
250
+
251
+ # Returns the string representation of the object
252
+ # @return [String] String presentation of the object
253
+ def to_s
254
+ to_hash.to_s
255
+ end
256
+
257
+ # to_body is an alias to to_hash (backward compatibility)
258
+ # @return [Hash] Returns the object in the form of hash
259
+ def to_body
260
+ to_hash
261
+ end
262
+
263
+ # Returns the object in the form of hash
264
+ # @return [Hash] Returns the object in the form of hash
265
+ def to_hash
266
+ hash = {}
267
+ self.class.attribute_map.each_pair do |attr, param|
268
+ value = send(attr)
269
+ if value.nil?
270
+ is_nullable = self.class.openapi_nullable.include?(attr)
271
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
272
+ end
273
+
274
+ hash[param] = _to_hash(value)
275
+ end
276
+ hash
277
+ end
278
+
279
+ # Outputs non-array value in the form of hash
280
+ # For object, use to_hash. Otherwise, just return the value
281
+ # @param [Object] value Any valid value
282
+ # @return [Hash] Returns the value in the form of hash
283
+ def _to_hash(value)
284
+ if value.is_a?(Array)
285
+ value.compact.map { |v| _to_hash(v) }
286
+ elsif value.is_a?(Hash)
287
+ {}.tap do |hash|
288
+ value.each { |k, v| hash[k] = _to_hash(v) }
289
+ end
290
+ elsif value.respond_to? :to_hash
291
+ value.to_hash
292
+ else
293
+ value
294
+ end
295
+ end
296
+ end
297
+ end
@@ -84,9 +84,11 @@ module Gopad
84
84
  attributes[:user]
85
85
  end
86
86
 
87
- if attributes.key?(:perm)
88
- self.perm = attributes[:perm]
89
- end
87
+ self.perm = if attributes.key?(:perm)
88
+ attributes[:perm]
89
+ else
90
+ 'user'
91
+ end
90
92
  end
91
93
 
92
94
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -106,9 +106,11 @@ module Gopad
106
106
  self.team = attributes[:team]
107
107
  end
108
108
 
109
- if attributes.key?(:perm)
110
- self.perm = attributes[:perm]
111
- end
109
+ self.perm = if attributes.key?(:perm)
110
+ attributes[:perm]
111
+ else
112
+ 'user'
113
+ end
112
114
 
113
115
  if attributes.key?(:created_at)
114
116
  self.created_at = attributes[:created_at]
@@ -84,9 +84,11 @@ module Gopad
84
84
  attributes[:team]
85
85
  end
86
86
 
87
- if attributes.key?(:perm)
88
- self.perm = attributes[:perm]
89
- end
87
+ self.perm = if attributes.key?(:perm)
88
+ attributes[:perm]
89
+ else
90
+ 'user'
91
+ end
90
92
  end
91
93
 
92
94
  # Show invalid properties with the reasons. Usually used together with valid?
data/lib/gopad/version.rb CHANGED
@@ -9,5 +9,5 @@
9
9
  #
10
10
 
11
11
  module Gopad
12
- VERSION = '1.0.0'.freeze
12
+ VERSION = '1.1.0'.freeze
13
13
  end
data/lib/gopad.rb CHANGED
@@ -15,7 +15,11 @@ require 'gopad/version'
15
15
  require 'gopad/configuration'
16
16
 
17
17
  # Models
18
+ require 'gopad/models/auth_login'
19
+ require 'gopad/models/auth_token'
20
+ require 'gopad/models/auth_verify'
18
21
  require 'gopad/models/notification'
22
+ require 'gopad/models/profile'
19
23
  require 'gopad/models/team'
20
24
  require 'gopad/models/team_user_params'
21
25
  require 'gopad/models/team_users'
@@ -30,6 +34,7 @@ require 'gopad/models/validation'
30
34
 
31
35
  # APIs
32
36
  require 'gopad/api/auth_api'
37
+ require 'gopad/api/profile_api'
33
38
  require 'gopad/api/team_api'
34
39
  require 'gopad/api/user_api'
35
40
 
metadata CHANGED
@@ -1,63 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gopad
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Boerger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-28 00:00:00.000000000 Z
11
+ date: 2024-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.0.1
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '3.0'
19
+ version: 2.9.0
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- version: 1.0.1
30
- - - "<"
24
+ - - "~>"
31
25
  - !ruby/object:Gem::Version
32
- version: '3.0'
26
+ version: 2.9.0
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: faraday-multipart
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
- - - ">="
31
+ - - "~>"
38
32
  - !ruby/object:Gem::Version
39
- version: '0'
33
+ version: 1.0.4
40
34
  type: :runtime
41
35
  prerelease: false
42
36
  version_requirements: !ruby/object:Gem::Requirement
43
37
  requirements:
44
- - - ">="
38
+ - - "~>"
45
39
  - !ruby/object:Gem::Version
46
- version: '0'
40
+ version: 1.0.4
47
41
  - !ruby/object:Gem::Dependency
48
42
  name: marcel
49
43
  requirement: !ruby/object:Gem::Requirement
50
44
  requirements:
51
- - - ">="
45
+ - - "~>"
52
46
  - !ruby/object:Gem::Version
53
- version: '0'
47
+ version: 1.0.4
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
51
  requirements:
58
- - - ">="
52
+ - - "~>"
59
53
  - !ruby/object:Gem::Version
60
- version: '0'
54
+ version: 1.0.4
61
55
  description: OpenAPI client for Gopad
62
56
  email:
63
57
  - thomas@webhippie.de
@@ -72,12 +66,17 @@ files:
72
66
  - README.md
73
67
  - lib/gopad.rb
74
68
  - lib/gopad/api/auth_api.rb
69
+ - lib/gopad/api/profile_api.rb
75
70
  - lib/gopad/api/team_api.rb
76
71
  - lib/gopad/api/user_api.rb
77
72
  - lib/gopad/api_client.rb
78
73
  - lib/gopad/api_error.rb
79
74
  - lib/gopad/configuration.rb
75
+ - lib/gopad/models/auth_login.rb
76
+ - lib/gopad/models/auth_token.rb
77
+ - lib/gopad/models/auth_verify.rb
80
78
  - lib/gopad/models/notification.rb
79
+ - lib/gopad/models/profile.rb
81
80
  - lib/gopad/models/team.rb
82
81
  - lib/gopad/models/team_user_params.rb
83
82
  - lib/gopad/models/team_users.rb