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
@@ -12,36 +12,17 @@ require 'date'
12
12
  require 'time'
13
13
 
14
14
  module Gopad
15
- # Parameters to attach or unlink user team
16
- class UserTeamParams
17
- attr_accessor :team, :perm
18
-
19
- class EnumAttributeValidator
20
- attr_reader :datatype, :allowable_values
21
-
22
- def initialize(datatype, allowable_values)
23
- @allowable_values = allowable_values.map do |value|
24
- case datatype.to_s
25
- when /Integer/i
26
- value.to_i
27
- when /Float/i
28
- value.to_f
29
- else
30
- value
31
- end
32
- end
33
- end
34
-
35
- def valid?(value)
36
- !value || allowable_values.include?(value)
37
- end
38
- end
15
+ class ListGroupUsers200Response
16
+ attr_accessor :total, :limit, :offset, :group, :users
39
17
 
40
18
  # Attribute mapping from ruby-style variable name to JSON key.
41
19
  def self.attribute_map
42
20
  {
43
- team: :team,
44
- perm: :perm
21
+ total: :total,
22
+ limit: :limit,
23
+ offset: :offset,
24
+ group: :group,
25
+ users: :users
45
26
  }
46
27
  end
47
28
 
@@ -53,8 +34,11 @@ module Gopad
53
34
  # Attribute type mapping.
54
35
  def self.openapi_types
55
36
  {
56
- team: :String,
57
- perm: :String
37
+ total: :Integer,
38
+ limit: :Integer,
39
+ offset: :Integer,
40
+ group: :Group,
41
+ users: :'Array<UserGroup>'
58
42
  }
59
43
  end
60
44
 
@@ -68,27 +52,42 @@ module Gopad
68
52
  # @param [Hash] attributes Model attributes in the form of hash
69
53
  def initialize(attributes = {})
70
54
  unless attributes.is_a?(Hash)
71
- raise ArgumentError, 'The input argument (attributes) must be a hash in `Gopad::UserTeamParams` initialize method'
55
+ raise ArgumentError, 'The input argument (attributes) must be a hash in `Gopad::ListGroupUsers200Response` initialize method'
72
56
  end
73
57
 
74
58
  # check to see if the attribute exists and convert string to symbol for hash key
75
59
  attributes = attributes.each_with_object({}) do |(k, v), h|
76
60
  unless self.class.attribute_map.key?(k.to_sym)
77
- raise ArgumentError, "`#{k}` is not a valid attribute in `Gopad::UserTeamParams`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
61
+ raise ArgumentError,
62
+ "`#{k}` is not a valid attribute in `Gopad::ListGroupUsers200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
78
63
  end
79
64
 
80
65
  h[k.to_sym] = v
81
66
  end
82
67
 
83
- self.team = if attributes.key?(:team)
84
- attributes[:team]
85
- end
68
+ self.total = if attributes.key?(:total)
69
+ attributes[:total]
70
+ end
86
71
 
87
- self.perm = if attributes.key?(:perm)
88
- attributes[:perm]
89
- else
90
- 'user'
91
- end
72
+ self.limit = if attributes.key?(:limit)
73
+ attributes[:limit]
74
+ end
75
+
76
+ self.offset = if attributes.key?(:offset)
77
+ attributes[:offset]
78
+ end
79
+
80
+ if attributes.key?(:group)
81
+ self.group = attributes[:group]
82
+ end
83
+
84
+ if attributes.key?(:users)
85
+ if (value = attributes[:users]).is_a?(Array)
86
+ self.users = value
87
+ end
88
+ else
89
+ self.users = nil
90
+ end
92
91
  end
93
92
 
94
93
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -96,8 +95,20 @@ module Gopad
96
95
  def list_invalid_properties
97
96
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
98
97
  invalid_properties = []
99
- if @team.nil?
100
- invalid_properties.push('invalid value for "team", team cannot be nil.')
98
+ if @total.nil?
99
+ invalid_properties.push('invalid value for "total", total cannot be nil.')
100
+ end
101
+
102
+ if @limit.nil?
103
+ invalid_properties.push('invalid value for "limit", limit cannot be nil.')
104
+ end
105
+
106
+ if @offset.nil?
107
+ invalid_properties.push('invalid value for "offset", offset cannot be nil.')
108
+ end
109
+
110
+ if @users.nil?
111
+ invalid_properties.push('invalid value for "users", users cannot be nil.')
101
112
  end
102
113
 
103
114
  invalid_properties
@@ -107,33 +118,25 @@ module Gopad
107
118
  # @return true if the model is valid
108
119
  def valid?
109
120
  warn '[DEPRECATED] the `valid?` method is obsolete'
110
- return false if @team.nil?
111
-
112
- perm_validator = EnumAttributeValidator.new('String', %w[user admin owner])
113
- return false unless perm_validator.valid?(@perm)
121
+ return false if @total.nil?
122
+ return false if @limit.nil?
123
+ return false if @offset.nil?
124
+ return false if @users.nil?
114
125
 
115
126
  true
116
127
  end
117
128
 
118
- # Custom attribute writer method checking allowed values (enum).
119
- # @param [Object] perm Object to be assigned
120
- def perm=(perm)
121
- validator = EnumAttributeValidator.new('String', %w[user admin owner])
122
- unless validator.valid?(perm)
123
- raise ArgumentError, "invalid value for \"perm\", must be one of #{validator.allowable_values}."
124
- end
125
-
126
- @perm = perm
127
- end
128
-
129
129
  # Checks equality by comparing each attribute.
130
130
  # @param [Object] Object to be compared
131
131
  def ==(other)
132
132
  return true if equal?(other)
133
133
 
134
134
  self.class == other.class &&
135
- team == other.team &&
136
- perm == other.perm
135
+ total == other.total &&
136
+ limit == other.limit &&
137
+ offset == other.offset &&
138
+ group == other.group &&
139
+ users == other.users
137
140
  end
138
141
 
139
142
  # @see the `==` method
@@ -145,7 +148,7 @@ module Gopad
145
148
  # Calculates hash code according to all attributes.
146
149
  # @return [Integer] Hash code
147
150
  def hash
148
- [team, perm].hash
151
+ [total, limit, offset, group, users].hash
149
152
  end
150
153
 
151
154
  # Builds the object from hash
@@ -0,0 +1,260 @@
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 ListGroups200Response
16
+ attr_accessor :total, :limit, :offset, :groups
17
+
18
+ # Attribute mapping from ruby-style variable name to JSON key.
19
+ def self.attribute_map
20
+ {
21
+ total: :total,
22
+ limit: :limit,
23
+ offset: :offset,
24
+ groups: :groups
25
+ }
26
+ end
27
+
28
+ # Returns all the JSON keys this model knows about
29
+ def self.acceptable_attributes
30
+ attribute_map.values
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.openapi_types
35
+ {
36
+ total: :Integer,
37
+ limit: :Integer,
38
+ offset: :Integer,
39
+ groups: :'Array<Group>'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ unless attributes.is_a?(Hash)
53
+ raise ArgumentError, 'The input argument (attributes) must be a hash in `Gopad::ListGroups200Response` initialize method'
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) do |(k, v), h|
58
+ unless self.class.attribute_map.key?(k.to_sym)
59
+ raise ArgumentError,
60
+ "`#{k}` is not a valid attribute in `Gopad::ListGroups200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
61
+ end
62
+
63
+ h[k.to_sym] = v
64
+ end
65
+
66
+ self.total = if attributes.key?(:total)
67
+ attributes[:total]
68
+ end
69
+
70
+ self.limit = if attributes.key?(:limit)
71
+ attributes[:limit]
72
+ end
73
+
74
+ self.offset = if attributes.key?(:offset)
75
+ attributes[:offset]
76
+ end
77
+
78
+ if attributes.key?(:groups)
79
+ if (value = attributes[:groups]).is_a?(Array)
80
+ self.groups = value
81
+ end
82
+ else
83
+ self.groups = nil
84
+ end
85
+ end
86
+
87
+ # Show invalid properties with the reasons. Usually used together with valid?
88
+ # @return Array for valid properties with the reasons
89
+ def list_invalid_properties
90
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
91
+ invalid_properties = []
92
+ if @total.nil?
93
+ invalid_properties.push('invalid value for "total", total cannot be nil.')
94
+ end
95
+
96
+ if @limit.nil?
97
+ invalid_properties.push('invalid value for "limit", limit cannot be nil.')
98
+ end
99
+
100
+ if @offset.nil?
101
+ invalid_properties.push('invalid value for "offset", offset cannot be nil.')
102
+ end
103
+
104
+ if @groups.nil?
105
+ invalid_properties.push('invalid value for "groups", groups cannot be nil.')
106
+ end
107
+
108
+ invalid_properties
109
+ end
110
+
111
+ # Check to see if the all the properties in the model are valid
112
+ # @return true if the model is valid
113
+ def valid?
114
+ warn '[DEPRECATED] the `valid?` method is obsolete'
115
+ return false if @total.nil?
116
+ return false if @limit.nil?
117
+ return false if @offset.nil?
118
+ return false if @groups.nil?
119
+
120
+ true
121
+ end
122
+
123
+ # Checks equality by comparing each attribute.
124
+ # @param [Object] Object to be compared
125
+ def ==(other)
126
+ return true if equal?(other)
127
+
128
+ self.class == other.class &&
129
+ total == other.total &&
130
+ limit == other.limit &&
131
+ offset == other.offset &&
132
+ groups == other.groups
133
+ end
134
+
135
+ # @see the `==` method
136
+ # @param [Object] Object to be compared
137
+ def eql?(other)
138
+ self == other
139
+ end
140
+
141
+ # Calculates hash code according to all attributes.
142
+ # @return [Integer] Hash code
143
+ def hash
144
+ [total, limit, offset, groups].hash
145
+ end
146
+
147
+ # Builds the object from hash
148
+ # @param [Hash] attributes Model attributes in the form of hash
149
+ # @return [Object] Returns the model itself
150
+ def self.build_from_hash(attributes)
151
+ return nil unless attributes.is_a?(Hash)
152
+
153
+ attributes = attributes.transform_keys(&:to_sym)
154
+ transformed_hash = {}
155
+ openapi_types.each_pair do |key, type|
156
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
157
+ transformed_hash[key.to_s] = nil
158
+ elsif type =~ /\AArray<(.*)>/i
159
+ # check to ensure the input is an array given that the attribute
160
+ # is documented as an array but the input is not
161
+ if attributes[attribute_map[key]].is_a?(Array)
162
+ transformed_hash[key.to_s] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
163
+ end
164
+ elsif !attributes[attribute_map[key]].nil?
165
+ transformed_hash[key.to_s] = _deserialize(type, attributes[attribute_map[key]])
166
+ end
167
+ end
168
+ new(transformed_hash)
169
+ end
170
+
171
+ # Deserializes the data based on type
172
+ # @param string type Data type
173
+ # @param string value Value to be deserialized
174
+ # @return [Object] Deserialized data
175
+ def self._deserialize(type, value)
176
+ case type.to_sym
177
+ when :Time
178
+ Time.parse(value)
179
+ when :Date
180
+ Date.parse(value)
181
+ when :String
182
+ value.to_s
183
+ when :Integer
184
+ value.to_i
185
+ when :Float
186
+ value.to_f
187
+ when :Boolean
188
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
189
+ true
190
+ else
191
+ false
192
+ end
193
+ when :Object
194
+ # generic object (usually a Hash), return directly
195
+ value
196
+ when /\AArray<(?<inner_type>.+)>\z/
197
+ inner_type = Regexp.last_match[:inner_type]
198
+ value.map { |v| _deserialize(inner_type, v) }
199
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
200
+ k_type = Regexp.last_match[:k_type]
201
+ v_type = Regexp.last_match[:v_type]
202
+ {}.tap do |hash|
203
+ value.each do |k, v|
204
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
205
+ end
206
+ end
207
+ else # model
208
+ # models (e.g. Pet) or oneOf
209
+ klass = Gopad.const_get(type)
210
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
211
+ end
212
+ end
213
+
214
+ # Returns the string representation of the object
215
+ # @return [String] String presentation of the object
216
+ def to_s
217
+ to_hash.to_s
218
+ end
219
+
220
+ # to_body is an alias to to_hash (backward compatibility)
221
+ # @return [Hash] Returns the object in the form of hash
222
+ def to_body
223
+ to_hash
224
+ end
225
+
226
+ # Returns the object in the form of hash
227
+ # @return [Hash] Returns the object in the form of hash
228
+ def to_hash
229
+ hash = {}
230
+ self.class.attribute_map.each_pair do |attr, param|
231
+ value = send(attr)
232
+ if value.nil?
233
+ is_nullable = self.class.openapi_nullable.include?(attr)
234
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
235
+ end
236
+
237
+ hash[param] = _to_hash(value)
238
+ end
239
+ hash
240
+ end
241
+
242
+ # Outputs non-array value in the form of hash
243
+ # For object, use to_hash. Otherwise, just return the value
244
+ # @param [Object] value Any valid value
245
+ # @return [Hash] Returns the value in the form of hash
246
+ def _to_hash(value)
247
+ if value.is_a?(Array)
248
+ value.compact.map { |v| _to_hash(v) }
249
+ elsif value.is_a?(Hash)
250
+ {}.tap do |hash|
251
+ value.each { |k, v| hash[k] = _to_hash(v) }
252
+ end
253
+ elsif value.respond_to? :to_hash
254
+ value.to_hash
255
+ else
256
+ value
257
+ end
258
+ end
259
+ end
260
+ end
@@ -0,0 +1,236 @@
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 ListProviders200Response
16
+ attr_accessor :total, :providers
17
+
18
+ # Attribute mapping from ruby-style variable name to JSON key.
19
+ def self.attribute_map
20
+ {
21
+ total: :total,
22
+ providers: :providers
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
+ total: :Integer,
35
+ providers: :'Array<Provider>'
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ unless attributes.is_a?(Hash)
49
+ raise ArgumentError, 'The input argument (attributes) must be a hash in `Gopad::ListProviders200Response` initialize method'
50
+ end
51
+
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) do |(k, v), h|
54
+ unless self.class.attribute_map.key?(k.to_sym)
55
+ raise ArgumentError,
56
+ "`#{k}` is not a valid attribute in `Gopad::ListProviders200Response`. 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.total = if attributes.key?(:total)
63
+ attributes[:total]
64
+ end
65
+
66
+ if attributes.key?(:providers)
67
+ if (value = attributes[:providers]).is_a?(Array)
68
+ self.providers = value
69
+ end
70
+ else
71
+ self.providers = nil
72
+ end
73
+ end
74
+
75
+ # Show invalid properties with the reasons. Usually used together with valid?
76
+ # @return Array for valid properties with the reasons
77
+ def list_invalid_properties
78
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
79
+ invalid_properties = []
80
+ if @total.nil?
81
+ invalid_properties.push('invalid value for "total", total cannot be nil.')
82
+ end
83
+
84
+ if @providers.nil?
85
+ invalid_properties.push('invalid value for "providers", providers cannot be nil.')
86
+ end
87
+
88
+ invalid_properties
89
+ end
90
+
91
+ # Check to see if the all the properties in the model are valid
92
+ # @return true if the model is valid
93
+ def valid?
94
+ warn '[DEPRECATED] the `valid?` method is obsolete'
95
+ return false if @total.nil?
96
+ return false if @providers.nil?
97
+
98
+ true
99
+ end
100
+
101
+ # Checks equality by comparing each attribute.
102
+ # @param [Object] Object to be compared
103
+ def ==(other)
104
+ return true if equal?(other)
105
+
106
+ self.class == other.class &&
107
+ total == other.total &&
108
+ providers == other.providers
109
+ end
110
+
111
+ # @see the `==` method
112
+ # @param [Object] Object to be compared
113
+ def eql?(other)
114
+ self == other
115
+ end
116
+
117
+ # Calculates hash code according to all attributes.
118
+ # @return [Integer] Hash code
119
+ def hash
120
+ [total, providers].hash
121
+ end
122
+
123
+ # Builds the object from hash
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ # @return [Object] Returns the model itself
126
+ def self.build_from_hash(attributes)
127
+ return nil unless attributes.is_a?(Hash)
128
+
129
+ attributes = attributes.transform_keys(&:to_sym)
130
+ transformed_hash = {}
131
+ openapi_types.each_pair do |key, type|
132
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
133
+ transformed_hash[key.to_s] = nil
134
+ elsif type =~ /\AArray<(.*)>/i
135
+ # check to ensure the input is an array given that the attribute
136
+ # is documented as an array but the input is not
137
+ if attributes[attribute_map[key]].is_a?(Array)
138
+ transformed_hash[key.to_s] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
139
+ end
140
+ elsif !attributes[attribute_map[key]].nil?
141
+ transformed_hash[key.to_s] = _deserialize(type, attributes[attribute_map[key]])
142
+ end
143
+ end
144
+ new(transformed_hash)
145
+ end
146
+
147
+ # Deserializes the data based on type
148
+ # @param string type Data type
149
+ # @param string value Value to be deserialized
150
+ # @return [Object] Deserialized data
151
+ def self._deserialize(type, value)
152
+ case type.to_sym
153
+ when :Time
154
+ Time.parse(value)
155
+ when :Date
156
+ Date.parse(value)
157
+ when :String
158
+ value.to_s
159
+ when :Integer
160
+ value.to_i
161
+ when :Float
162
+ value.to_f
163
+ when :Boolean
164
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
165
+ true
166
+ else
167
+ false
168
+ end
169
+ when :Object
170
+ # generic object (usually a Hash), return directly
171
+ value
172
+ when /\AArray<(?<inner_type>.+)>\z/
173
+ inner_type = Regexp.last_match[:inner_type]
174
+ value.map { |v| _deserialize(inner_type, v) }
175
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
176
+ k_type = Regexp.last_match[:k_type]
177
+ v_type = Regexp.last_match[:v_type]
178
+ {}.tap do |hash|
179
+ value.each do |k, v|
180
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
181
+ end
182
+ end
183
+ else # model
184
+ # models (e.g. Pet) or oneOf
185
+ klass = Gopad.const_get(type)
186
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
187
+ end
188
+ end
189
+
190
+ # Returns the string representation of the object
191
+ # @return [String] String presentation of the object
192
+ def to_s
193
+ to_hash.to_s
194
+ end
195
+
196
+ # to_body is an alias to to_hash (backward compatibility)
197
+ # @return [Hash] Returns the object in the form of hash
198
+ def to_body
199
+ to_hash
200
+ end
201
+
202
+ # Returns the object in the form of hash
203
+ # @return [Hash] Returns the object in the form of hash
204
+ def to_hash
205
+ hash = {}
206
+ self.class.attribute_map.each_pair do |attr, param|
207
+ value = send(attr)
208
+ if value.nil?
209
+ is_nullable = self.class.openapi_nullable.include?(attr)
210
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
211
+ end
212
+
213
+ hash[param] = _to_hash(value)
214
+ end
215
+ hash
216
+ end
217
+
218
+ # Outputs non-array value in the form of hash
219
+ # For object, use to_hash. Otherwise, just return the value
220
+ # @param [Object] value Any valid value
221
+ # @return [Hash] Returns the value in the form of hash
222
+ def _to_hash(value)
223
+ if value.is_a?(Array)
224
+ value.compact.map { |v| _to_hash(v) }
225
+ elsif value.is_a?(Hash)
226
+ {}.tap do |hash|
227
+ value.each { |k, v| hash[k] = _to_hash(v) }
228
+ end
229
+ elsif value.respond_to? :to_hash
230
+ value.to_hash
231
+ else
232
+ value
233
+ end
234
+ end
235
+ end
236
+ end