svix 1.15.0 → 1.17.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,14 +23,20 @@ module Svix
23
23
 
24
24
  attr_accessor :custom_font_family
25
25
 
26
+ attr_accessor :custom_font_family_url
27
+
26
28
  attr_accessor :custom_logo_url
27
29
 
28
30
  attr_accessor :custom_theme_override
29
31
 
32
+ attr_accessor :display_name
33
+
30
34
  attr_accessor :enable_channels
31
35
 
32
36
  attr_accessor :enable_integration_management
33
37
 
38
+ attr_accessor :enable_message_tags
39
+
34
40
  attr_accessor :enable_transformations
35
41
 
36
42
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -40,10 +46,13 @@ module Svix
40
46
  :'color_palette_light' => :'colorPaletteLight',
41
47
  :'custom_color' => :'customColor',
42
48
  :'custom_font_family' => :'customFontFamily',
49
+ :'custom_font_family_url' => :'customFontFamilyUrl',
43
50
  :'custom_logo_url' => :'customLogoUrl',
44
51
  :'custom_theme_override' => :'customThemeOverride',
52
+ :'display_name' => :'displayName',
45
53
  :'enable_channels' => :'enableChannels',
46
54
  :'enable_integration_management' => :'enableIntegrationManagement',
55
+ :'enable_message_tags' => :'enableMessageTags',
47
56
  :'enable_transformations' => :'enableTransformations'
48
57
  }
49
58
  end
@@ -60,10 +69,13 @@ module Svix
60
69
  :'color_palette_light' => :'CustomColorPalette',
61
70
  :'custom_color' => :'String',
62
71
  :'custom_font_family' => :'String',
72
+ :'custom_font_family_url' => :'String',
63
73
  :'custom_logo_url' => :'String',
64
74
  :'custom_theme_override' => :'CustomThemeOverride',
75
+ :'display_name' => :'String',
65
76
  :'enable_channels' => :'Boolean',
66
77
  :'enable_integration_management' => :'Boolean',
78
+ :'enable_message_tags' => :'Boolean',
67
79
  :'enable_transformations' => :'Boolean'
68
80
  }
69
81
  end
@@ -71,9 +83,10 @@ module Svix
71
83
  # List of attributes with nullable: true
72
84
  def self.openapi_nullable
73
85
  Set.new([
74
- :'custom_color',
75
86
  :'custom_font_family',
87
+ :'custom_font_family_url',
76
88
  :'custom_logo_url',
89
+ :'display_name',
77
90
  ])
78
91
  end
79
92
 
@@ -108,6 +121,10 @@ module Svix
108
121
  self.custom_font_family = attributes[:'custom_font_family']
109
122
  end
110
123
 
124
+ if attributes.key?(:'custom_font_family_url')
125
+ self.custom_font_family_url = attributes[:'custom_font_family_url']
126
+ end
127
+
111
128
  if attributes.key?(:'custom_logo_url')
112
129
  self.custom_logo_url = attributes[:'custom_logo_url']
113
130
  end
@@ -116,6 +133,10 @@ module Svix
116
133
  self.custom_theme_override = attributes[:'custom_theme_override']
117
134
  end
118
135
 
136
+ if attributes.key?(:'display_name')
137
+ self.display_name = attributes[:'display_name']
138
+ end
139
+
119
140
  if attributes.key?(:'enable_channels')
120
141
  self.enable_channels = attributes[:'enable_channels']
121
142
  else
@@ -128,6 +149,12 @@ module Svix
128
149
  self.enable_integration_management = false
129
150
  end
130
151
 
152
+ if attributes.key?(:'enable_message_tags')
153
+ self.enable_message_tags = attributes[:'enable_message_tags']
154
+ else
155
+ self.enable_message_tags = false
156
+ end
157
+
131
158
  if attributes.key?(:'enable_transformations')
132
159
  self.enable_transformations = attributes[:'enable_transformations']
133
160
  else
@@ -144,6 +171,14 @@ module Svix
144
171
  invalid_properties.push("invalid value for \"custom_font_family\", must conform to the pattern #{pattern}.")
145
172
  end
146
173
 
174
+ if !@custom_font_family_url.nil? && @custom_font_family_url.to_s.length > 65536
175
+ invalid_properties.push('invalid value for "custom_font_family_url", the character length must be smaller than or equal to 65536.')
176
+ end
177
+
178
+ if !@custom_font_family_url.nil? && @custom_font_family_url.to_s.length < 1
179
+ invalid_properties.push('invalid value for "custom_font_family_url", the character length must be great than or equal to 1.')
180
+ end
181
+
147
182
  if !@custom_logo_url.nil? && @custom_logo_url.to_s.length > 65536
148
183
  invalid_properties.push('invalid value for "custom_logo_url", the character length must be smaller than or equal to 65536.')
149
184
  end
@@ -159,6 +194,8 @@ module Svix
159
194
  # @return true if the model is valid
160
195
  def valid?
161
196
  return false if !@custom_font_family.nil? && @custom_font_family !~ Regexp.new(/^[a-zA-Z0-9\-_ ]+$/)
197
+ return false if !@custom_font_family_url.nil? && @custom_font_family_url.to_s.length > 65536
198
+ return false if !@custom_font_family_url.nil? && @custom_font_family_url.to_s.length < 1
162
199
  return false if !@custom_logo_url.nil? && @custom_logo_url.to_s.length > 65536
163
200
  return false if !@custom_logo_url.nil? && @custom_logo_url.to_s.length < 1
164
201
  true
@@ -175,6 +212,20 @@ module Svix
175
212
  @custom_font_family = custom_font_family
176
213
  end
177
214
 
215
+ # Custom attribute writer method with validation
216
+ # @param [Object] custom_font_family_url Value to be assigned
217
+ def custom_font_family_url=(custom_font_family_url)
218
+ if !custom_font_family_url.nil? && custom_font_family_url.to_s.length > 65536
219
+ fail ArgumentError, 'invalid value for "custom_font_family_url", the character length must be smaller than or equal to 65536.'
220
+ end
221
+
222
+ if !custom_font_family_url.nil? && custom_font_family_url.to_s.length < 1
223
+ fail ArgumentError, 'invalid value for "custom_font_family_url", the character length must be great than or equal to 1.'
224
+ end
225
+
226
+ @custom_font_family_url = custom_font_family_url
227
+ end
228
+
178
229
  # Custom attribute writer method with validation
179
230
  # @param [Object] custom_logo_url Value to be assigned
180
231
  def custom_logo_url=(custom_logo_url)
@@ -198,10 +249,13 @@ module Svix
198
249
  color_palette_light == o.color_palette_light &&
199
250
  custom_color == o.custom_color &&
200
251
  custom_font_family == o.custom_font_family &&
252
+ custom_font_family_url == o.custom_font_family_url &&
201
253
  custom_logo_url == o.custom_logo_url &&
202
254
  custom_theme_override == o.custom_theme_override &&
255
+ display_name == o.display_name &&
203
256
  enable_channels == o.enable_channels &&
204
257
  enable_integration_management == o.enable_integration_management &&
258
+ enable_message_tags == o.enable_message_tags &&
205
259
  enable_transformations == o.enable_transformations
206
260
  end
207
261
 
@@ -214,7 +268,7 @@ module Svix
214
268
  # Calculates hash code according to all attributes.
215
269
  # @return [Integer] Hash code
216
270
  def hash
217
- [color_palette_dark, color_palette_light, custom_color, custom_font_family, custom_logo_url, custom_theme_override, enable_channels, enable_integration_management, enable_transformations].hash
271
+ [color_palette_dark, color_palette_light, custom_color, custom_font_family, custom_font_family_url, custom_logo_url, custom_theme_override, display_name, enable_channels, enable_integration_management, enable_message_tags, enable_transformations].hash
218
272
  end
219
273
 
220
274
  # Builds the object from hash
@@ -67,15 +67,30 @@ module Svix
67
67
  # @return Array for valid properties with the reasons
68
68
  def list_invalid_properties
69
69
  invalid_properties = Array.new
70
+ if !@base.nil? && @base < 0
71
+ invalid_properties.push('invalid value for "base", must be greater than or equal to 0.')
72
+ end
73
+
70
74
  invalid_properties
71
75
  end
72
76
 
73
77
  # Check to see if the all the properties in the model are valid
74
78
  # @return true if the model is valid
75
79
  def valid?
80
+ return false if !@base.nil? && @base < 0
76
81
  true
77
82
  end
78
83
 
84
+ # Custom attribute writer method with validation
85
+ # @param [Object] base Value to be assigned
86
+ def base=(base)
87
+ if !base.nil? && base < 0
88
+ fail ArgumentError, 'invalid value for "base", must be greater than or equal to 0.'
89
+ end
90
+
91
+ @base = base
92
+ end
93
+
79
94
  # Checks equality by comparing each attribute.
80
95
  # @param [Object] Object to be compared
81
96
  def ==(o)
@@ -0,0 +1,223 @@
1
+ =begin
2
+ #Svix API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 1.1.1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.2.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Svix
17
+ class GenerateIn
18
+ attr_accessor :prompt
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'prompt' => :'prompt'
24
+ }
25
+ end
26
+
27
+ # Returns all the JSON keys this model knows about
28
+ def self.acceptable_attributes
29
+ attribute_map.values
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'prompt' => :'String'
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
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Svix::GenerateIn` 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({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Svix::GenerateIn`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
59
+
60
+ if attributes.key?(:'prompt')
61
+ self.prompt = attributes[:'prompt']
62
+ end
63
+ end
64
+
65
+ # Show invalid properties with the reasons. Usually used together with valid?
66
+ # @return Array for valid properties with the reasons
67
+ def list_invalid_properties
68
+ invalid_properties = Array.new
69
+ if @prompt.nil?
70
+ invalid_properties.push('invalid value for "prompt", prompt cannot be nil.')
71
+ end
72
+
73
+ invalid_properties
74
+ end
75
+
76
+ # Check to see if the all the properties in the model are valid
77
+ # @return true if the model is valid
78
+ def valid?
79
+ return false if @prompt.nil?
80
+ true
81
+ end
82
+
83
+ # Checks equality by comparing each attribute.
84
+ # @param [Object] Object to be compared
85
+ def ==(o)
86
+ return true if self.equal?(o)
87
+ self.class == o.class &&
88
+ prompt == o.prompt
89
+ end
90
+
91
+ # @see the `==` method
92
+ # @param [Object] Object to be compared
93
+ def eql?(o)
94
+ self == o
95
+ end
96
+
97
+ # Calculates hash code according to all attributes.
98
+ # @return [Integer] Hash code
99
+ def hash
100
+ [prompt].hash
101
+ end
102
+
103
+ # Builds the object from hash
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ # @return [Object] Returns the model itself
106
+ def self.build_from_hash(attributes)
107
+ new.build_from_hash(attributes)
108
+ end
109
+
110
+ # Builds the object from hash
111
+ # @param [Hash] attributes Model attributes in the form of hash
112
+ # @return [Object] Returns the model itself
113
+ def build_from_hash(attributes)
114
+ return nil unless attributes.is_a?(Hash)
115
+ self.class.openapi_types.each_pair do |key, type|
116
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
117
+ self.send("#{key}=", nil)
118
+ elsif type =~ /\AArray<(.*)>/i
119
+ # check to ensure the input is an array given that the attribute
120
+ # is documented as an array but the input is not
121
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
122
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
123
+ end
124
+ elsif !attributes[self.class.attribute_map[key]].nil?
125
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
126
+ end
127
+ end
128
+
129
+ self
130
+ end
131
+
132
+ # Deserializes the data based on type
133
+ # @param string type Data type
134
+ # @param string value Value to be deserialized
135
+ # @return [Object] Deserialized data
136
+ def _deserialize(type, value)
137
+ case type.to_sym
138
+ when :Time
139
+ Time.parse(value)
140
+ when :Date
141
+ Date.parse(value)
142
+ when :String
143
+ value.to_s
144
+ when :Integer
145
+ value.to_i
146
+ when :Float
147
+ value.to_f
148
+ when :Boolean
149
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
150
+ true
151
+ else
152
+ false
153
+ end
154
+ when :Object
155
+ # generic object (usually a Hash), return directly
156
+ value
157
+ when /\AArray<(?<inner_type>.+)>\z/
158
+ inner_type = Regexp.last_match[:inner_type]
159
+ value.map { |v| _deserialize(inner_type, v) }
160
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
161
+ k_type = Regexp.last_match[:k_type]
162
+ v_type = Regexp.last_match[:v_type]
163
+ {}.tap do |hash|
164
+ value.each do |k, v|
165
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
166
+ end
167
+ end
168
+ else # model
169
+ # models (e.g. Pet) or oneOf
170
+ klass = Svix.const_get(type)
171
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
172
+ end
173
+ end
174
+
175
+ # Returns the string representation of the object
176
+ # @return [String] String presentation of the object
177
+ def to_s
178
+ to_hash.to_s
179
+ end
180
+
181
+ # to_body is an alias to to_hash (backward compatibility)
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_body
184
+ to_hash
185
+ end
186
+
187
+ # Returns the object in the form of hash
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_hash
190
+ hash = {}
191
+ self.class.attribute_map.each_pair do |attr, param|
192
+ value = self.send(attr)
193
+ if value.nil?
194
+ is_nullable = self.class.openapi_nullable.include?(attr)
195
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
196
+ end
197
+
198
+ hash[param] = _to_hash(value)
199
+ end
200
+ hash
201
+ end
202
+
203
+ # Outputs non-array value in the form of hash
204
+ # For object, use to_hash. Otherwise, just return the value
205
+ # @param [Object] value Any valid value
206
+ # @return [Hash] Returns the value in the form of hash
207
+ def _to_hash(value)
208
+ if value.is_a?(Array)
209
+ value.compact.map { |v| _to_hash(v) }
210
+ elsif value.is_a?(Hash)
211
+ {}.tap do |hash|
212
+ value.each { |k, v| hash[k] = _to_hash(v) }
213
+ end
214
+ elsif value.respond_to? :to_hash
215
+ value.to_hash
216
+ else
217
+ value
218
+ end
219
+ end
220
+
221
+ end
222
+
223
+ end
@@ -0,0 +1,281 @@
1
+ =begin
2
+ #Svix API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 1.1.1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.2.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Svix
17
+ class GenerateOut
18
+ attr_accessor :choices
19
+
20
+ attr_accessor :created
21
+
22
+ attr_accessor :id
23
+
24
+ attr_accessor :model
25
+
26
+ attr_accessor :object
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'choices' => :'choices',
32
+ :'created' => :'created',
33
+ :'id' => :'id',
34
+ :'model' => :'model',
35
+ :'object' => :'object'
36
+ }
37
+ end
38
+
39
+ # Returns all the JSON keys this model knows about
40
+ def self.acceptable_attributes
41
+ attribute_map.values
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.openapi_types
46
+ {
47
+ :'choices' => :'Array<CompletionChoice>',
48
+ :'created' => :'Integer',
49
+ :'id' => :'String',
50
+ :'model' => :'String',
51
+ :'object' => :'String'
52
+ }
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ ])
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Svix::GenerateOut` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ attributes = attributes.each_with_object({}) { |(k, v), h|
70
+ if (!self.class.attribute_map.key?(k.to_sym))
71
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Svix::GenerateOut`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
+ end
73
+ h[k.to_sym] = v
74
+ }
75
+
76
+ if attributes.key?(:'choices')
77
+ if (value = attributes[:'choices']).is_a?(Array)
78
+ self.choices = value
79
+ end
80
+ end
81
+
82
+ if attributes.key?(:'created')
83
+ self.created = attributes[:'created']
84
+ end
85
+
86
+ if attributes.key?(:'id')
87
+ self.id = attributes[:'id']
88
+ end
89
+
90
+ if attributes.key?(:'model')
91
+ self.model = attributes[:'model']
92
+ end
93
+
94
+ if attributes.key?(:'object')
95
+ self.object = attributes[:'object']
96
+ end
97
+ end
98
+
99
+ # Show invalid properties with the reasons. Usually used together with valid?
100
+ # @return Array for valid properties with the reasons
101
+ def list_invalid_properties
102
+ invalid_properties = Array.new
103
+ if @choices.nil?
104
+ invalid_properties.push('invalid value for "choices", choices cannot be nil.')
105
+ end
106
+
107
+ if @created.nil?
108
+ invalid_properties.push('invalid value for "created", created cannot be nil.')
109
+ end
110
+
111
+ if @id.nil?
112
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
113
+ end
114
+
115
+ if @model.nil?
116
+ invalid_properties.push('invalid value for "model", model cannot be nil.')
117
+ end
118
+
119
+ if @object.nil?
120
+ invalid_properties.push('invalid value for "object", object cannot be nil.')
121
+ end
122
+
123
+ invalid_properties
124
+ end
125
+
126
+ # Check to see if the all the properties in the model are valid
127
+ # @return true if the model is valid
128
+ def valid?
129
+ return false if @choices.nil?
130
+ return false if @created.nil?
131
+ return false if @id.nil?
132
+ return false if @model.nil?
133
+ return false if @object.nil?
134
+ true
135
+ end
136
+
137
+ # Checks equality by comparing each attribute.
138
+ # @param [Object] Object to be compared
139
+ def ==(o)
140
+ return true if self.equal?(o)
141
+ self.class == o.class &&
142
+ choices == o.choices &&
143
+ created == o.created &&
144
+ id == o.id &&
145
+ model == o.model &&
146
+ object == o.object
147
+ end
148
+
149
+ # @see the `==` method
150
+ # @param [Object] Object to be compared
151
+ def eql?(o)
152
+ self == o
153
+ end
154
+
155
+ # Calculates hash code according to all attributes.
156
+ # @return [Integer] Hash code
157
+ def hash
158
+ [choices, created, id, model, object].hash
159
+ end
160
+
161
+ # Builds the object from hash
162
+ # @param [Hash] attributes Model attributes in the form of hash
163
+ # @return [Object] Returns the model itself
164
+ def self.build_from_hash(attributes)
165
+ new.build_from_hash(attributes)
166
+ end
167
+
168
+ # Builds the object from hash
169
+ # @param [Hash] attributes Model attributes in the form of hash
170
+ # @return [Object] Returns the model itself
171
+ def build_from_hash(attributes)
172
+ return nil unless attributes.is_a?(Hash)
173
+ self.class.openapi_types.each_pair do |key, type|
174
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
175
+ self.send("#{key}=", nil)
176
+ elsif type =~ /\AArray<(.*)>/i
177
+ # check to ensure the input is an array given that the attribute
178
+ # is documented as an array but the input is not
179
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
180
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
181
+ end
182
+ elsif !attributes[self.class.attribute_map[key]].nil?
183
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
184
+ end
185
+ end
186
+
187
+ self
188
+ end
189
+
190
+ # Deserializes the data based on type
191
+ # @param string type Data type
192
+ # @param string value Value to be deserialized
193
+ # @return [Object] Deserialized data
194
+ def _deserialize(type, value)
195
+ case type.to_sym
196
+ when :Time
197
+ Time.parse(value)
198
+ when :Date
199
+ Date.parse(value)
200
+ when :String
201
+ value.to_s
202
+ when :Integer
203
+ value.to_i
204
+ when :Float
205
+ value.to_f
206
+ when :Boolean
207
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
208
+ true
209
+ else
210
+ false
211
+ end
212
+ when :Object
213
+ # generic object (usually a Hash), return directly
214
+ value
215
+ when /\AArray<(?<inner_type>.+)>\z/
216
+ inner_type = Regexp.last_match[:inner_type]
217
+ value.map { |v| _deserialize(inner_type, v) }
218
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
219
+ k_type = Regexp.last_match[:k_type]
220
+ v_type = Regexp.last_match[:v_type]
221
+ {}.tap do |hash|
222
+ value.each do |k, v|
223
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
224
+ end
225
+ end
226
+ else # model
227
+ # models (e.g. Pet) or oneOf
228
+ klass = Svix.const_get(type)
229
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
230
+ end
231
+ end
232
+
233
+ # Returns the string representation of the object
234
+ # @return [String] String presentation of the object
235
+ def to_s
236
+ to_hash.to_s
237
+ end
238
+
239
+ # to_body is an alias to to_hash (backward compatibility)
240
+ # @return [Hash] Returns the object in the form of hash
241
+ def to_body
242
+ to_hash
243
+ end
244
+
245
+ # Returns the object in the form of hash
246
+ # @return [Hash] Returns the object in the form of hash
247
+ def to_hash
248
+ hash = {}
249
+ self.class.attribute_map.each_pair do |attr, param|
250
+ value = self.send(attr)
251
+ if value.nil?
252
+ is_nullable = self.class.openapi_nullable.include?(attr)
253
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
254
+ end
255
+
256
+ hash[param] = _to_hash(value)
257
+ end
258
+ hash
259
+ end
260
+
261
+ # Outputs non-array value in the form of hash
262
+ # For object, use to_hash. Otherwise, just return the value
263
+ # @param [Object] value Any valid value
264
+ # @return [Hash] Returns the value in the form of hash
265
+ def _to_hash(value)
266
+ if value.is_a?(Array)
267
+ value.compact.map { |v| _to_hash(v) }
268
+ elsif value.is_a?(Hash)
269
+ {}.tap do |hash|
270
+ value.each { |k, v| hash[k] = _to_hash(v) }
271
+ end
272
+ elsif value.respond_to? :to_hash
273
+ value.to_hash
274
+ else
275
+ value
276
+ end
277
+ end
278
+
279
+ end
280
+
281
+ end