mux_ruby 3.14.0 → 3.16.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 (67) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +4 -4
  4. data/docs/AbridgedVideoView.md +3 -1
  5. data/docs/AssetsApi.md +1 -1
  6. data/docs/CreateAssetRequest.md +1 -1
  7. data/docs/CreatePlaybackRestrictionRequest.md +3 -1
  8. data/docs/DeliveryReport.md +2 -0
  9. data/docs/GenerateTrackSubtitlesResponse.md +1 -1
  10. data/docs/PlaybackRestriction.md +3 -1
  11. data/docs/PlaybackRestrictionsApi.md +73 -0
  12. data/docs/UpdateAssetMP4SupportRequest.md +1 -1
  13. data/docs/UpdateLiveStreamNewAssetSettings.md +18 -0
  14. data/docs/UpdateLiveStreamRequest.md +3 -1
  15. data/docs/UpdateUserAgentRestrictionRequest.md +20 -0
  16. data/docs/UserAgentRestrictionRequest.md +20 -0
  17. data/docs/UserAgentRestrictionSettings.md +20 -0
  18. data/docs/VideoView.md +13 -1
  19. data/gen/generator-config.json +1 -1
  20. data/lib/mux_ruby/api/assets_api.rb +2 -2
  21. data/lib/mux_ruby/api/metrics_api.rb +6 -6
  22. data/lib/mux_ruby/api/playback_restrictions_api.rb +71 -0
  23. data/lib/mux_ruby/models/abridged_video_view.rb +14 -5
  24. data/lib/mux_ruby/models/asset.rb +2 -2
  25. data/lib/mux_ruby/models/asset_static_renditions_files.rb +2 -2
  26. data/lib/mux_ruby/models/create_asset_request.rb +3 -3
  27. data/lib/mux_ruby/models/create_playback_restriction_request.rb +13 -4
  28. data/lib/mux_ruby/models/delivery_report.rb +23 -1
  29. data/lib/mux_ruby/models/generate_track_subtitles_response.rb +4 -2
  30. data/lib/mux_ruby/models/playback_restriction.rb +13 -4
  31. data/lib/mux_ruby/models/update_asset_mp4_support_request.rb +3 -3
  32. data/lib/mux_ruby/models/update_live_stream_new_asset_settings.rb +254 -0
  33. data/lib/mux_ruby/models/update_live_stream_request.rb +13 -4
  34. data/lib/mux_ruby/models/update_user_agent_restriction_request.rb +233 -0
  35. data/lib/mux_ruby/models/user_agent_restriction_request.rb +234 -0
  36. data/lib/mux_ruby/models/user_agent_restriction_settings.rb +234 -0
  37. data/lib/mux_ruby/models/video_view.rb +66 -4
  38. data/lib/mux_ruby/version.rb +1 -1
  39. data/lib/mux_ruby.rb +4 -0
  40. data/spec/models/update_live_stream_new_asset_settings_spec.rb +38 -0
  41. data/spec/models/update_user_agent_restriction_request_spec.rb +40 -0
  42. data/spec/models/user_agent_restriction_request_spec.rb +40 -0
  43. data/spec/models/user_agent_restriction_settings_spec.rb +40 -0
  44. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/byebug-11.1.3/byebug/byebug.so +0 -0
  45. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/byebug-11.1.3/gem_make.out +6 -6
  46. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/ffi-1.16.3/ffi_c.so +0 -0
  47. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/ffi-1.16.3/gem_make.out +6 -6
  48. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/ffi-1.16.3/mkmf.log +16 -16
  49. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/jaro_winkler-1.5.4/gem_make.out +14 -14
  50. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/jaro_winkler-1.5.4/jaro_winkler/jaro_winkler_ext.so +0 -0
  51. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-4.0.4/gem_make.out +6 -6
  52. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-4.0.4/mkmf.log +4 -4
  53. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-4.0.4/psych.so +0 -0
  54. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.0.2/gem_make.out +6 -6
  55. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.0.2/mkmf.log +2 -2
  56. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.0.2/stringio.so +0 -0
  57. data/vendor/bundle/ruby/3.2.0/gems/byebug-11.1.3/ext/byebug/Makefile +3 -3
  58. data/vendor/bundle/ruby/3.2.0/gems/byebug-11.1.3/lib/byebug/byebug.so +0 -0
  59. data/vendor/bundle/ruby/3.2.0/gems/ffi-1.16.3/ext/ffi_c/Makefile +3 -3
  60. data/vendor/bundle/ruby/3.2.0/gems/ffi-1.16.3/lib/ffi_c.so +0 -0
  61. data/vendor/bundle/ruby/3.2.0/gems/jaro_winkler-1.5.4/ext/jaro_winkler/Makefile +3 -3
  62. data/vendor/bundle/ruby/3.2.0/gems/jaro_winkler-1.5.4/lib/jaro_winkler/jaro_winkler_ext.so +0 -0
  63. data/vendor/bundle/ruby/3.2.0/gems/psych-4.0.4/ext/psych/Makefile +3 -3
  64. data/vendor/bundle/ruby/3.2.0/gems/psych-4.0.4/lib/psych.so +0 -0
  65. data/vendor/bundle/ruby/3.2.0/gems/stringio-3.0.2/ext/stringio/Makefile +3 -3
  66. data/vendor/bundle/ruby/3.2.0/gems/stringio-3.0.2/lib/stringio.so +0 -0
  67. metadata +172 -156
@@ -33,6 +33,8 @@ module MuxRuby
33
33
  # The time in seconds a live stream may be continuously active before being disconnected. Defaults to 12 hours.
34
34
  attr_accessor :max_continuous_duration
35
35
 
36
+ attr_accessor :new_asset_settings
37
+
36
38
  class EnumAttributeValidator
37
39
  attr_reader :datatype
38
40
  attr_reader :allowable_values
@@ -63,7 +65,8 @@ module MuxRuby
63
65
  :'reconnect_window' => :'reconnect_window',
64
66
  :'use_slate_for_standard_latency' => :'use_slate_for_standard_latency',
65
67
  :'reconnect_slate_url' => :'reconnect_slate_url',
66
- :'max_continuous_duration' => :'max_continuous_duration'
68
+ :'max_continuous_duration' => :'max_continuous_duration',
69
+ :'new_asset_settings' => :'new_asset_settings'
67
70
  }
68
71
  end
69
72
 
@@ -80,7 +83,8 @@ module MuxRuby
80
83
  :'reconnect_window' => :'Float',
81
84
  :'use_slate_for_standard_latency' => :'Boolean',
82
85
  :'reconnect_slate_url' => :'String',
83
- :'max_continuous_duration' => :'Integer'
86
+ :'max_continuous_duration' => :'Integer',
87
+ :'new_asset_settings' => :'UpdateLiveStreamNewAssetSettings'
84
88
  }
85
89
  end
86
90
 
@@ -134,6 +138,10 @@ module MuxRuby
134
138
  else
135
139
  self.max_continuous_duration = 43200
136
140
  end
141
+
142
+ if attributes.key?(:'new_asset_settings')
143
+ self.new_asset_settings = attributes[:'new_asset_settings']
144
+ end
137
145
  end
138
146
 
139
147
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -219,7 +227,8 @@ module MuxRuby
219
227
  reconnect_window == o.reconnect_window &&
220
228
  use_slate_for_standard_latency == o.use_slate_for_standard_latency &&
221
229
  reconnect_slate_url == o.reconnect_slate_url &&
222
- max_continuous_duration == o.max_continuous_duration
230
+ max_continuous_duration == o.max_continuous_duration &&
231
+ new_asset_settings == o.new_asset_settings
223
232
  end
224
233
 
225
234
  # @see the `==` method
@@ -231,7 +240,7 @@ module MuxRuby
231
240
  # Calculates hash code according to all attributes.
232
241
  # @return [Integer] Hash code
233
242
  def hash
234
- [passthrough, latency_mode, reconnect_window, use_slate_for_standard_latency, reconnect_slate_url, max_continuous_duration].hash
243
+ [passthrough, latency_mode, reconnect_window, use_slate_for_standard_latency, reconnect_slate_url, max_continuous_duration, new_asset_settings].hash
235
244
  end
236
245
 
237
246
  # Builds the object from hash
@@ -0,0 +1,233 @@
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 UpdateUserAgentRestrictionRequest
18
+ # Whether or not to allow views without a `User-Agent` HTTP request header.
19
+ attr_accessor :allow_no_user_agent
20
+
21
+ # Whether or not to allow high risk user agents. The high risk user agents are defined by Mux.
22
+ attr_accessor :allow_high_risk_user_agent
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'allow_no_user_agent' => :'allow_no_user_agent',
28
+ :'allow_high_risk_user_agent' => :'allow_high_risk_user_agent'
29
+ }
30
+ end
31
+
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ attribute_map.values
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'allow_no_user_agent' => :'Boolean',
41
+ :'allow_high_risk_user_agent' => :'Boolean'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MuxRuby::UpdateUserAgentRestrictionRequest` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!self.class.attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MuxRuby::UpdateUserAgentRestrictionRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'allow_no_user_agent')
67
+ self.allow_no_user_agent = attributes[:'allow_no_user_agent']
68
+ else
69
+ self.allow_no_user_agent = true
70
+ end
71
+
72
+ if attributes.key?(:'allow_high_risk_user_agent')
73
+ self.allow_high_risk_user_agent = attributes[:'allow_high_risk_user_agent']
74
+ else
75
+ self.allow_high_risk_user_agent = true
76
+ end
77
+ end
78
+
79
+ # Show invalid properties with the reasons. Usually used together with valid?
80
+ # @return Array for valid properties with the reasons
81
+ def list_invalid_properties
82
+ invalid_properties = Array.new
83
+ invalid_properties
84
+ end
85
+
86
+ # Check to see if the all the properties in the model are valid
87
+ # @return true if the model is valid
88
+ def valid?
89
+ true
90
+ end
91
+
92
+ # Checks equality by comparing each attribute.
93
+ # @param [Object] Object to be compared
94
+ def ==(o)
95
+ return true if self.equal?(o)
96
+ self.class == o.class &&
97
+ allow_no_user_agent == o.allow_no_user_agent &&
98
+ allow_high_risk_user_agent == o.allow_high_risk_user_agent
99
+ end
100
+
101
+ # @see the `==` method
102
+ # @param [Object] Object to be compared
103
+ def eql?(o)
104
+ self == o
105
+ end
106
+
107
+ # Calculates hash code according to all attributes.
108
+ # @return [Integer] Hash code
109
+ def hash
110
+ [allow_no_user_agent, allow_high_risk_user_agent].hash
111
+ end
112
+
113
+ # Builds the object from hash
114
+ # @param [Hash] attributes Model attributes in the form of hash
115
+ # @return [Object] Returns the model itself
116
+ def self.build_from_hash(attributes)
117
+ new.build_from_hash(attributes)
118
+ end
119
+
120
+ # Builds the object from hash
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ # @return [Object] Returns the model itself
123
+ def build_from_hash(attributes)
124
+ return nil unless attributes.is_a?(Hash)
125
+ self.class.openapi_types.each_pair do |key, type|
126
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
127
+ self.send("#{key}=", nil)
128
+ elsif type =~ /\AArray<(.*)>/i
129
+ # check to ensure the input is an array given that the attribute
130
+ # is documented as an array but the input is not
131
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
132
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
133
+ end
134
+ elsif !attributes[self.class.attribute_map[key]].nil?
135
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
136
+ end
137
+ end
138
+
139
+ self
140
+ end
141
+
142
+ # Deserializes the data based on type
143
+ # @param string type Data type
144
+ # @param string value Value to be deserialized
145
+ # @return [Object] Deserialized data
146
+ def _deserialize(type, value)
147
+ case type.to_sym
148
+ when :Time
149
+ Time.parse(value)
150
+ when :Date
151
+ Date.parse(value)
152
+ when :String
153
+ value.to_s
154
+ when :Integer
155
+ value.to_i
156
+ when :Float
157
+ value.to_f
158
+ when :Boolean
159
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
160
+ true
161
+ else
162
+ false
163
+ end
164
+ when :Object
165
+ # generic object (usually a Hash), return directly
166
+ value
167
+ when /\AArray<(?<inner_type>.+)>\z/
168
+ inner_type = Regexp.last_match[:inner_type]
169
+ value.map { |v| _deserialize(inner_type, v) }
170
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
171
+ k_type = Regexp.last_match[:k_type]
172
+ v_type = Regexp.last_match[:v_type]
173
+ {}.tap do |hash|
174
+ value.each do |k, v|
175
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
176
+ end
177
+ end
178
+ else # model
179
+ # models (e.g. Pet) or oneOf
180
+ klass = MuxRuby.const_get(type)
181
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
182
+ end
183
+ end
184
+
185
+ # Returns the string representation of the object
186
+ # @return [String] String presentation of the object
187
+ def to_s
188
+ to_hash.to_s
189
+ end
190
+
191
+ # to_body is an alias to to_hash (backward compatibility)
192
+ # @return [Hash] Returns the object in the form of hash
193
+ def to_body
194
+ to_hash
195
+ end
196
+
197
+ # Returns the object in the form of hash
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_hash
200
+ hash = {}
201
+ self.class.attribute_map.each_pair do |attr, param|
202
+ value = self.send(attr)
203
+ if value.nil?
204
+ is_nullable = self.class.openapi_nullable.include?(attr)
205
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
206
+ end
207
+
208
+ hash[param] = _to_hash(value)
209
+ end
210
+ hash
211
+ end
212
+
213
+ # Outputs non-array value in the form of hash
214
+ # For object, use to_hash. Otherwise, just return the value
215
+ # @param [Object] value Any valid value
216
+ # @return [Hash] Returns the value in the form of hash
217
+ def _to_hash(value)
218
+ if value.is_a?(Array)
219
+ value.compact.map { |v| _to_hash(v) }
220
+ elsif value.is_a?(Hash)
221
+ {}.tap do |hash|
222
+ value.each { |k, v| hash[k] = _to_hash(v) }
223
+ end
224
+ elsif value.respond_to? :to_hash
225
+ value.to_hash
226
+ else
227
+ value
228
+ end
229
+ end
230
+
231
+ end
232
+
233
+ end
@@ -0,0 +1,234 @@
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
+ # Rules that control what user agents are allowed to play your videos. Please see [Using User-Agent HTTP header for validation](https://docs.mux.com/guides/secure-video-playback#using-user-agent-http-header-for-validation) for more details on this feature.
18
+ class UserAgentRestrictionRequest
19
+ # Whether or not to allow views without a `User-Agent` HTTP request header.
20
+ attr_accessor :allow_no_user_agent
21
+
22
+ # Whether or not to allow high risk user agents. The high risk user agents are defined by Mux.
23
+ attr_accessor :allow_high_risk_user_agent
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'allow_no_user_agent' => :'allow_no_user_agent',
29
+ :'allow_high_risk_user_agent' => :'allow_high_risk_user_agent'
30
+ }
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'allow_no_user_agent' => :'Boolean',
42
+ :'allow_high_risk_user_agent' => :'Boolean'
43
+ }
44
+ end
45
+
46
+ # List of attributes with nullable: true
47
+ def self.openapi_nullable
48
+ Set.new([
49
+ ])
50
+ end
51
+
52
+ # Initializes the object
53
+ # @param [Hash] attributes Model attributes in the form of hash
54
+ def initialize(attributes = {})
55
+ if (!attributes.is_a?(Hash))
56
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MuxRuby::UserAgentRestrictionRequest` initialize method"
57
+ end
58
+
59
+ # check to see if the attribute exists and convert string to symbol for hash key
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ if (!self.class.attribute_map.key?(k.to_sym))
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MuxRuby::UserAgentRestrictionRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
63
+ end
64
+ h[k.to_sym] = v
65
+ }
66
+
67
+ if attributes.key?(:'allow_no_user_agent')
68
+ self.allow_no_user_agent = attributes[:'allow_no_user_agent']
69
+ else
70
+ self.allow_no_user_agent = true
71
+ end
72
+
73
+ if attributes.key?(:'allow_high_risk_user_agent')
74
+ self.allow_high_risk_user_agent = attributes[:'allow_high_risk_user_agent']
75
+ else
76
+ self.allow_high_risk_user_agent = true
77
+ end
78
+ end
79
+
80
+ # Show invalid properties with the reasons. Usually used together with valid?
81
+ # @return Array for valid properties with the reasons
82
+ def list_invalid_properties
83
+ invalid_properties = Array.new
84
+ invalid_properties
85
+ end
86
+
87
+ # Check to see if the all the properties in the model are valid
88
+ # @return true if the model is valid
89
+ def valid?
90
+ true
91
+ end
92
+
93
+ # Checks equality by comparing each attribute.
94
+ # @param [Object] Object to be compared
95
+ def ==(o)
96
+ return true if self.equal?(o)
97
+ self.class == o.class &&
98
+ allow_no_user_agent == o.allow_no_user_agent &&
99
+ allow_high_risk_user_agent == o.allow_high_risk_user_agent
100
+ end
101
+
102
+ # @see the `==` method
103
+ # @param [Object] Object to be compared
104
+ def eql?(o)
105
+ self == o
106
+ end
107
+
108
+ # Calculates hash code according to all attributes.
109
+ # @return [Integer] Hash code
110
+ def hash
111
+ [allow_no_user_agent, allow_high_risk_user_agent].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
+ new.build_from_hash(attributes)
119
+ end
120
+
121
+ # Builds the object from hash
122
+ # @param [Hash] attributes Model attributes in the form of hash
123
+ # @return [Object] Returns the model itself
124
+ def build_from_hash(attributes)
125
+ return nil unless attributes.is_a?(Hash)
126
+ self.class.openapi_types.each_pair do |key, type|
127
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
128
+ self.send("#{key}=", nil)
129
+ elsif type =~ /\AArray<(.*)>/i
130
+ # check to ensure the input is an array given that the attribute
131
+ # is documented as an array but the input is not
132
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
133
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
134
+ end
135
+ elsif !attributes[self.class.attribute_map[key]].nil?
136
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
137
+ end
138
+ end
139
+
140
+ self
141
+ end
142
+
143
+ # Deserializes the data based on type
144
+ # @param string type Data type
145
+ # @param string value Value to be deserialized
146
+ # @return [Object] Deserialized data
147
+ def _deserialize(type, value)
148
+ case type.to_sym
149
+ when :Time
150
+ Time.parse(value)
151
+ when :Date
152
+ Date.parse(value)
153
+ when :String
154
+ value.to_s
155
+ when :Integer
156
+ value.to_i
157
+ when :Float
158
+ value.to_f
159
+ when :Boolean
160
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
161
+ true
162
+ else
163
+ false
164
+ end
165
+ when :Object
166
+ # generic object (usually a Hash), return directly
167
+ value
168
+ when /\AArray<(?<inner_type>.+)>\z/
169
+ inner_type = Regexp.last_match[:inner_type]
170
+ value.map { |v| _deserialize(inner_type, v) }
171
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
172
+ k_type = Regexp.last_match[:k_type]
173
+ v_type = Regexp.last_match[:v_type]
174
+ {}.tap do |hash|
175
+ value.each do |k, v|
176
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
177
+ end
178
+ end
179
+ else # model
180
+ # models (e.g. Pet) or oneOf
181
+ klass = MuxRuby.const_get(type)
182
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
183
+ end
184
+ end
185
+
186
+ # Returns the string representation of the object
187
+ # @return [String] String presentation of the object
188
+ def to_s
189
+ to_hash.to_s
190
+ end
191
+
192
+ # to_body is an alias to to_hash (backward compatibility)
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_body
195
+ to_hash
196
+ end
197
+
198
+ # Returns the object in the form of hash
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_hash
201
+ hash = {}
202
+ self.class.attribute_map.each_pair do |attr, param|
203
+ value = self.send(attr)
204
+ if value.nil?
205
+ is_nullable = self.class.openapi_nullable.include?(attr)
206
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
207
+ end
208
+
209
+ hash[param] = _to_hash(value)
210
+ end
211
+ hash
212
+ end
213
+
214
+ # Outputs non-array value in the form of hash
215
+ # For object, use to_hash. Otherwise, just return the value
216
+ # @param [Object] value Any valid value
217
+ # @return [Hash] Returns the value in the form of hash
218
+ def _to_hash(value)
219
+ if value.is_a?(Array)
220
+ value.compact.map { |v| _to_hash(v) }
221
+ elsif value.is_a?(Hash)
222
+ {}.tap do |hash|
223
+ value.each { |k, v| hash[k] = _to_hash(v) }
224
+ end
225
+ elsif value.respond_to? :to_hash
226
+ value.to_hash
227
+ else
228
+ value
229
+ end
230
+ end
231
+
232
+ end
233
+
234
+ end