mux_ruby 3.20.0 → 4.0.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 (85) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +4 -4
  4. data/docs/AssetStaticRenditions.md +2 -2
  5. data/docs/AssetsApi.md +146 -1
  6. data/docs/CreateAssetRequest.md +4 -2
  7. data/docs/CreateStaticRenditionRequest.md +20 -0
  8. data/docs/CreateStaticRenditionResponse.md +18 -0
  9. data/docs/InputSettings.md +1 -1
  10. data/docs/LiveStreamsApi.md +143 -0
  11. data/docs/StaticRendition.md +40 -0
  12. data/docs/UpdateLiveStreamNewAssetSettings.md +4 -2
  13. data/docs/UpdateLiveStreamNewAssetSettingsStaticRenditionsRequest.md +18 -0
  14. data/docs/VideoView.md +33 -1
  15. data/gen/generator-config.json +1 -1
  16. data/lib/mux_ruby/api/assets_api.rb +140 -2
  17. data/lib/mux_ruby/api/live_streams_api.rb +132 -0
  18. data/lib/mux_ruby/api/metrics_api.rb +2 -2
  19. data/lib/mux_ruby/models/asset_static_renditions.rb +2 -2
  20. data/lib/mux_ruby/models/create_asset_request.rb +17 -5
  21. data/lib/mux_ruby/models/{create_broadcast_request.rb → create_static_rendition_request.rb} +49 -53
  22. data/lib/mux_ruby/models/{start_space_broadcast_response.rb → create_static_rendition_response.rb} +4 -4
  23. data/lib/mux_ruby/models/input_settings.rb +1 -1
  24. data/lib/mux_ruby/models/{asset_static_renditions_files.rb → static_rendition.rb} +118 -9
  25. data/lib/mux_ruby/models/update_live_stream_new_asset_settings.rb +28 -6
  26. data/lib/mux_ruby/models/{list_spaces_response.rb → update_live_stream_new_asset_settings_static_renditions_request.rb} +11 -16
  27. data/lib/mux_ruby/models/video_view.rb +161 -4
  28. data/lib/mux_ruby/version.rb +1 -1
  29. data/lib/mux_ruby.rb +4 -16
  30. data/spec/models/create_static_rendition_request_spec.rb +44 -0
  31. data/spec/models/create_static_rendition_response_spec.rb +34 -0
  32. data/spec/models/static_rendition_spec.rb +124 -0
  33. data/spec/models/update_live_stream_new_asset_settings_static_renditions_request_spec.rb +34 -0
  34. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/byebug-11.1.3/byebug/byebug.so +0 -0
  35. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/byebug-11.1.3/gem_make.out +8 -8
  36. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/ffi-1.16.3/ffi_c.so +0 -0
  37. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/ffi-1.16.3/gem_make.out +6 -6
  38. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/ffi-1.16.3/mkmf.log +19 -19
  39. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/jaro_winkler-1.5.6/gem_make.out +7 -7
  40. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/jaro_winkler-1.5.6/jaro_winkler/jaro_winkler_ext.so +0 -0
  41. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-4.0.4/gem_make.out +6 -6
  42. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-4.0.4/mkmf.log +5 -5
  43. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-4.0.4/psych.so +0 -0
  44. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.0.2/gem_make.out +6 -6
  45. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.0.2/mkmf.log +2 -2
  46. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.0.2/stringio.so +0 -0
  47. data/vendor/bundle/ruby/3.2.0/gems/byebug-11.1.3/ext/byebug/Makefile +3 -3
  48. data/vendor/bundle/ruby/3.2.0/gems/byebug-11.1.3/lib/byebug/byebug.so +0 -0
  49. data/vendor/bundle/ruby/3.2.0/gems/ffi-1.16.3/ext/ffi_c/Makefile +3 -3
  50. data/vendor/bundle/ruby/3.2.0/gems/ffi-1.16.3/lib/ffi_c.so +0 -0
  51. data/vendor/bundle/ruby/3.2.0/gems/jaro_winkler-1.5.6/ext/jaro_winkler/Makefile +3 -3
  52. data/vendor/bundle/ruby/3.2.0/gems/jaro_winkler-1.5.6/lib/jaro_winkler/jaro_winkler_ext.so +0 -0
  53. data/vendor/bundle/ruby/3.2.0/gems/psych-4.0.4/ext/psych/Makefile +3 -3
  54. data/vendor/bundle/ruby/3.2.0/gems/psych-4.0.4/lib/psych.so +0 -0
  55. data/vendor/bundle/ruby/3.2.0/gems/stringio-3.0.2/ext/stringio/Makefile +3 -3
  56. data/vendor/bundle/ruby/3.2.0/gems/stringio-3.0.2/lib/stringio.so +0 -0
  57. metadata +172 -191
  58. data/docs/AssetStaticRenditionsFiles.md +0 -28
  59. data/docs/Broadcast.md +0 -30
  60. data/docs/BroadcastLayout.md +0 -15
  61. data/docs/BroadcastResolution.md +0 -15
  62. data/docs/BroadcastResponse.md +0 -18
  63. data/docs/BroadcastStatus.md +0 -15
  64. data/docs/CreateBroadcastRequest.md +0 -26
  65. data/docs/CreateSpaceRequest.md +0 -22
  66. data/docs/ListSpacesResponse.md +0 -18
  67. data/docs/Space.md +0 -30
  68. data/docs/SpaceResponse.md +0 -18
  69. data/docs/SpaceStatus.md +0 -15
  70. data/docs/SpaceType.md +0 -15
  71. data/docs/SpacesApi.md +0 -658
  72. data/docs/StartSpaceBroadcastResponse.md +0 -18
  73. data/docs/StopSpaceBroadcastResponse.md +0 -18
  74. data/lib/mux_ruby/api/spaces_api.rb +0 -619
  75. data/lib/mux_ruby/models/broadcast.rb +0 -305
  76. data/lib/mux_ruby/models/broadcast_layout.rb +0 -38
  77. data/lib/mux_ruby/models/broadcast_resolution.rb +0 -41
  78. data/lib/mux_ruby/models/broadcast_response.rb +0 -223
  79. data/lib/mux_ruby/models/broadcast_status.rb +0 -37
  80. data/lib/mux_ruby/models/create_space_request.rb +0 -242
  81. data/lib/mux_ruby/models/space.rb +0 -301
  82. data/lib/mux_ruby/models/space_response.rb +0 -223
  83. data/lib/mux_ruby/models/space_status.rb +0 -37
  84. data/lib/mux_ruby/models/space_type.rb +0 -36
  85. data/lib/mux_ruby/models/stop_space_broadcast_response.rb +0 -218
@@ -1,242 +0,0 @@
1
- =begin
2
- #Mux API
3
-
4
- #Mux is how developers build online video. This API encompasses both Mux Video and Mux Data functionality to help you build your video-related projects better and faster than ever before.
5
-
6
- The version of the OpenAPI document: v1
7
- Contact: devex@mux.com
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.0.1
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module MuxRuby
17
- class CreateSpaceRequest
18
- attr_accessor :type
19
-
20
- # Arbitrary user-supplied metadata that will be included in the space details and related webhooks. Max: 255 characters.
21
- attr_accessor :passthrough
22
-
23
- # An array of broadcast destinations you want to stream the space to. **Note:** By default only a single broadcast destination can be specified. Contact Mux support if you need more.
24
- attr_accessor :broadcasts
25
-
26
- # Attribute mapping from ruby-style variable name to JSON key.
27
- def self.attribute_map
28
- {
29
- :'type' => :'type',
30
- :'passthrough' => :'passthrough',
31
- :'broadcasts' => :'broadcasts'
32
- }
33
- end
34
-
35
- # Returns all the JSON keys this model knows about
36
- def self.acceptable_attributes
37
- attribute_map.values
38
- end
39
-
40
- # Attribute type mapping.
41
- def self.openapi_types
42
- {
43
- :'type' => :'SpaceType',
44
- :'passthrough' => :'String',
45
- :'broadcasts' => :'Array<CreateBroadcastRequest>'
46
- }
47
- end
48
-
49
- # List of attributes with nullable: true
50
- def self.openapi_nullable
51
- Set.new([
52
- ])
53
- end
54
-
55
- # Initializes the object
56
- # @param [Hash] attributes Model attributes in the form of hash
57
- def initialize(attributes = {})
58
- if (!attributes.is_a?(Hash))
59
- fail ArgumentError, "The input argument (attributes) must be a hash in `MuxRuby::CreateSpaceRequest` initialize method"
60
- end
61
-
62
- # check to see if the attribute exists and convert string to symbol for hash key
63
- attributes = attributes.each_with_object({}) { |(k, v), h|
64
- if (!self.class.attribute_map.key?(k.to_sym))
65
- fail ArgumentError, "`#{k}` is not a valid attribute in `MuxRuby::CreateSpaceRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
- end
67
- h[k.to_sym] = v
68
- }
69
-
70
- if attributes.key?(:'type')
71
- self.type = attributes[:'type']
72
- else
73
- self.type = 'server'
74
- end
75
-
76
- if attributes.key?(:'passthrough')
77
- self.passthrough = attributes[:'passthrough']
78
- end
79
-
80
- if attributes.key?(:'broadcasts')
81
- if (value = attributes[:'broadcasts']).is_a?(Array)
82
- self.broadcasts = value
83
- end
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
- invalid_properties = Array.new
91
- invalid_properties
92
- end
93
-
94
- # Check to see if the all the properties in the model are valid
95
- # @return true if the model is valid
96
- def valid?
97
- true
98
- end
99
-
100
- # Checks equality by comparing each attribute.
101
- # @param [Object] Object to be compared
102
- def ==(o)
103
- return true if self.equal?(o)
104
- self.class == o.class &&
105
- type == o.type &&
106
- passthrough == o.passthrough &&
107
- broadcasts == o.broadcasts
108
- end
109
-
110
- # @see the `==` method
111
- # @param [Object] Object to be compared
112
- def eql?(o)
113
- self == o
114
- end
115
-
116
- # Calculates hash code according to all attributes.
117
- # @return [Integer] Hash code
118
- def hash
119
- [type, passthrough, broadcasts].hash
120
- end
121
-
122
- # Builds the object from hash
123
- # @param [Hash] attributes Model attributes in the form of hash
124
- # @return [Object] Returns the model itself
125
- def self.build_from_hash(attributes)
126
- new.build_from_hash(attributes)
127
- end
128
-
129
- # Builds the object from hash
130
- # @param [Hash] attributes Model attributes in the form of hash
131
- # @return [Object] Returns the model itself
132
- def build_from_hash(attributes)
133
- return nil unless attributes.is_a?(Hash)
134
- self.class.openapi_types.each_pair do |key, type|
135
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
136
- self.send("#{key}=", nil)
137
- elsif type =~ /\AArray<(.*)>/i
138
- # check to ensure the input is an array given that the attribute
139
- # is documented as an array but the input is not
140
- if attributes[self.class.attribute_map[key]].is_a?(Array)
141
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
142
- end
143
- elsif !attributes[self.class.attribute_map[key]].nil?
144
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
145
- end
146
- end
147
-
148
- self
149
- end
150
-
151
- # Deserializes the data based on type
152
- # @param string type Data type
153
- # @param string value Value to be deserialized
154
- # @return [Object] Deserialized data
155
- def _deserialize(type, value)
156
- case type.to_sym
157
- when :Time
158
- Time.parse(value)
159
- when :Date
160
- Date.parse(value)
161
- when :String
162
- value.to_s
163
- when :Integer
164
- value.to_i
165
- when :Float
166
- value.to_f
167
- when :Boolean
168
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
169
- true
170
- else
171
- false
172
- end
173
- when :Object
174
- # generic object (usually a Hash), return directly
175
- value
176
- when /\AArray<(?<inner_type>.+)>\z/
177
- inner_type = Regexp.last_match[:inner_type]
178
- value.map { |v| _deserialize(inner_type, v) }
179
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
180
- k_type = Regexp.last_match[:k_type]
181
- v_type = Regexp.last_match[:v_type]
182
- {}.tap do |hash|
183
- value.each do |k, v|
184
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
185
- end
186
- end
187
- else # model
188
- # models (e.g. Pet) or oneOf
189
- klass = MuxRuby.const_get(type)
190
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
191
- end
192
- end
193
-
194
- # Returns the string representation of the object
195
- # @return [String] String presentation of the object
196
- def to_s
197
- to_hash.to_s
198
- end
199
-
200
- # to_body is an alias to to_hash (backward compatibility)
201
- # @return [Hash] Returns the object in the form of hash
202
- def to_body
203
- to_hash
204
- end
205
-
206
- # Returns the object in the form of hash
207
- # @return [Hash] Returns the object in the form of hash
208
- def to_hash
209
- hash = {}
210
- self.class.attribute_map.each_pair do |attr, param|
211
- value = self.send(attr)
212
- if value.nil?
213
- is_nullable = self.class.openapi_nullable.include?(attr)
214
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
215
- end
216
-
217
- hash[param] = _to_hash(value)
218
- end
219
- hash
220
- end
221
-
222
- # Outputs non-array value in the form of hash
223
- # For object, use to_hash. Otherwise, just return the value
224
- # @param [Object] value Any valid value
225
- # @return [Hash] Returns the value in the form of hash
226
- def _to_hash(value)
227
- if value.is_a?(Array)
228
- value.compact.map { |v| _to_hash(v) }
229
- elsif value.is_a?(Hash)
230
- {}.tap do |hash|
231
- value.each { |k, v| hash[k] = _to_hash(v) }
232
- end
233
- elsif value.respond_to? :to_hash
234
- value.to_hash
235
- else
236
- value
237
- end
238
- end
239
-
240
- end
241
-
242
- end
@@ -1,301 +0,0 @@
1
- =begin
2
- #Mux API
3
-
4
- #Mux is how developers build online video. This API encompasses both Mux Video and Mux Data functionality to help you build your video-related projects better and faster than ever before.
5
-
6
- The version of the OpenAPI document: v1
7
- Contact: devex@mux.com
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.0.1
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module MuxRuby
17
- class Space
18
- # Unique identifier for the space. Max 255 characters.
19
- attr_accessor :id
20
-
21
- # Time the space was created, defined as a Unix timestamp (seconds since epoch).
22
- attr_accessor :created_at
23
-
24
- attr_accessor :type
25
-
26
- attr_accessor :status
27
-
28
- # Arbitrary user-supplied metadata that will be included in the space details and related webhooks. Max: 255 characters.
29
- attr_accessor :passthrough
30
-
31
- # An array of broadcast destinations.
32
- attr_accessor :broadcasts
33
-
34
- # Unique identifier for the current lifecycle of the space. Only set when the space is `active` and is set to a new value each time the space transitions from `idle` to `active`. This value is useful for logging and debugging issues. Max 255 characters.
35
- attr_accessor :active_session_id
36
-
37
- # Attribute mapping from ruby-style variable name to JSON key.
38
- def self.attribute_map
39
- {
40
- :'id' => :'id',
41
- :'created_at' => :'created_at',
42
- :'type' => :'type',
43
- :'status' => :'status',
44
- :'passthrough' => :'passthrough',
45
- :'broadcasts' => :'broadcasts',
46
- :'active_session_id' => :'active_session_id'
47
- }
48
- end
49
-
50
- # Returns all the JSON keys this model knows about
51
- def self.acceptable_attributes
52
- attribute_map.values
53
- end
54
-
55
- # Attribute type mapping.
56
- def self.openapi_types
57
- {
58
- :'id' => :'String',
59
- :'created_at' => :'String',
60
- :'type' => :'SpaceType',
61
- :'status' => :'SpaceStatus',
62
- :'passthrough' => :'String',
63
- :'broadcasts' => :'Array<Broadcast>',
64
- :'active_session_id' => :'String'
65
- }
66
- end
67
-
68
- # List of attributes with nullable: true
69
- def self.openapi_nullable
70
- Set.new([
71
- ])
72
- end
73
-
74
- # Initializes the object
75
- # @param [Hash] attributes Model attributes in the form of hash
76
- def initialize(attributes = {})
77
- if (!attributes.is_a?(Hash))
78
- fail ArgumentError, "The input argument (attributes) must be a hash in `MuxRuby::Space` initialize method"
79
- end
80
-
81
- # check to see if the attribute exists and convert string to symbol for hash key
82
- attributes = attributes.each_with_object({}) { |(k, v), h|
83
- if (!self.class.attribute_map.key?(k.to_sym))
84
- fail ArgumentError, "`#{k}` is not a valid attribute in `MuxRuby::Space`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
85
- end
86
- h[k.to_sym] = v
87
- }
88
-
89
- if attributes.key?(:'id')
90
- self.id = attributes[:'id']
91
- end
92
-
93
- if attributes.key?(:'created_at')
94
- self.created_at = attributes[:'created_at']
95
- end
96
-
97
- if attributes.key?(:'type')
98
- self.type = attributes[:'type']
99
- else
100
- self.type = 'server'
101
- end
102
-
103
- if attributes.key?(:'status')
104
- self.status = attributes[:'status']
105
- end
106
-
107
- if attributes.key?(:'passthrough')
108
- self.passthrough = attributes[:'passthrough']
109
- end
110
-
111
- if attributes.key?(:'broadcasts')
112
- if (value = attributes[:'broadcasts']).is_a?(Array)
113
- self.broadcasts = value
114
- end
115
- end
116
-
117
- if attributes.key?(:'active_session_id')
118
- self.active_session_id = attributes[:'active_session_id']
119
- end
120
- end
121
-
122
- # Show invalid properties with the reasons. Usually used together with valid?
123
- # @return Array for valid properties with the reasons
124
- def list_invalid_properties
125
- invalid_properties = Array.new
126
- if @id.nil?
127
- invalid_properties.push('invalid value for "id", id cannot be nil.')
128
- end
129
-
130
- if @created_at.nil?
131
- invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
132
- end
133
-
134
- if @type.nil?
135
- invalid_properties.push('invalid value for "type", type cannot be nil.')
136
- end
137
-
138
- if @status.nil?
139
- invalid_properties.push('invalid value for "status", status cannot be nil.')
140
- end
141
-
142
- invalid_properties
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
- return false if @id.nil?
149
- return false if @created_at.nil?
150
- return false if @type.nil?
151
- return false if @status.nil?
152
- true
153
- end
154
-
155
- # Checks equality by comparing each attribute.
156
- # @param [Object] Object to be compared
157
- def ==(o)
158
- return true if self.equal?(o)
159
- self.class == o.class &&
160
- id == o.id &&
161
- created_at == o.created_at &&
162
- type == o.type &&
163
- status == o.status &&
164
- passthrough == o.passthrough &&
165
- broadcasts == o.broadcasts &&
166
- active_session_id == o.active_session_id
167
- end
168
-
169
- # @see the `==` method
170
- # @param [Object] Object to be compared
171
- def eql?(o)
172
- self == o
173
- end
174
-
175
- # Calculates hash code according to all attributes.
176
- # @return [Integer] Hash code
177
- def hash
178
- [id, created_at, type, status, passthrough, broadcasts, active_session_id].hash
179
- end
180
-
181
- # Builds the object from hash
182
- # @param [Hash] attributes Model attributes in the form of hash
183
- # @return [Object] Returns the model itself
184
- def self.build_from_hash(attributes)
185
- new.build_from_hash(attributes)
186
- end
187
-
188
- # Builds the object from hash
189
- # @param [Hash] attributes Model attributes in the form of hash
190
- # @return [Object] Returns the model itself
191
- def build_from_hash(attributes)
192
- return nil unless attributes.is_a?(Hash)
193
- self.class.openapi_types.each_pair do |key, type|
194
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
195
- self.send("#{key}=", nil)
196
- elsif type =~ /\AArray<(.*)>/i
197
- # check to ensure the input is an array given that the attribute
198
- # is documented as an array but the input is not
199
- if attributes[self.class.attribute_map[key]].is_a?(Array)
200
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
201
- end
202
- elsif !attributes[self.class.attribute_map[key]].nil?
203
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
204
- end
205
- end
206
-
207
- self
208
- end
209
-
210
- # Deserializes the data based on type
211
- # @param string type Data type
212
- # @param string value Value to be deserialized
213
- # @return [Object] Deserialized data
214
- def _deserialize(type, value)
215
- case type.to_sym
216
- when :Time
217
- Time.parse(value)
218
- when :Date
219
- Date.parse(value)
220
- when :String
221
- value.to_s
222
- when :Integer
223
- value.to_i
224
- when :Float
225
- value.to_f
226
- when :Boolean
227
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
228
- true
229
- else
230
- false
231
- end
232
- when :Object
233
- # generic object (usually a Hash), return directly
234
- value
235
- when /\AArray<(?<inner_type>.+)>\z/
236
- inner_type = Regexp.last_match[:inner_type]
237
- value.map { |v| _deserialize(inner_type, v) }
238
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
239
- k_type = Regexp.last_match[:k_type]
240
- v_type = Regexp.last_match[:v_type]
241
- {}.tap do |hash|
242
- value.each do |k, v|
243
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
244
- end
245
- end
246
- else # model
247
- # models (e.g. Pet) or oneOf
248
- klass = MuxRuby.const_get(type)
249
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
250
- end
251
- end
252
-
253
- # Returns the string representation of the object
254
- # @return [String] String presentation of the object
255
- def to_s
256
- to_hash.to_s
257
- end
258
-
259
- # to_body is an alias to to_hash (backward compatibility)
260
- # @return [Hash] Returns the object in the form of hash
261
- def to_body
262
- to_hash
263
- end
264
-
265
- # Returns the object in the form of hash
266
- # @return [Hash] Returns the object in the form of hash
267
- def to_hash
268
- hash = {}
269
- self.class.attribute_map.each_pair do |attr, param|
270
- value = self.send(attr)
271
- if value.nil?
272
- is_nullable = self.class.openapi_nullable.include?(attr)
273
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
274
- end
275
-
276
- hash[param] = _to_hash(value)
277
- end
278
- hash
279
- end
280
-
281
- # Outputs non-array value in the form of hash
282
- # For object, use to_hash. Otherwise, just return the value
283
- # @param [Object] value Any valid value
284
- # @return [Hash] Returns the value in the form of hash
285
- def _to_hash(value)
286
- if value.is_a?(Array)
287
- value.compact.map { |v| _to_hash(v) }
288
- elsif value.is_a?(Hash)
289
- {}.tap do |hash|
290
- value.each { |k, v| hash[k] = _to_hash(v) }
291
- end
292
- elsif value.respond_to? :to_hash
293
- value.to_hash
294
- else
295
- value
296
- end
297
- end
298
-
299
- end
300
-
301
- end