mux_ruby 1.3.1 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile +2 -1
- data/Gemfile.lock +37 -35
- data/README.md +6 -1
- data/docs/Asset.md +3 -1
- data/docs/AssetNonStandardInputReasons.md +16 -0
- data/docs/AssetRecordingTimes.md +9 -0
- data/docs/AssetsApi.md +54 -0
- data/docs/CreateAssetRequest.md +1 -1
- data/docs/CreateLiveStreamRequest.md +2 -0
- data/docs/CreateUploadRequest.md +1 -0
- data/docs/DisableLiveStreamResponse.md +8 -0
- data/docs/EnableLiveStreamResponse.md +8 -0
- data/docs/LiveStream.md +2 -1
- data/docs/LiveStreamsApi.md +104 -0
- data/docs/UpdateAssetMasterAccessRequest.md +8 -0
- data/docs/Upload.md +1 -0
- data/docs/VideoView.md +16 -14
- data/examples/data/exercise-errors.rb +1 -1
- data/examples/video/exercise-assets.rb +10 -0
- data/examples/video/exercise-live-streams.rb +22 -0
- data/lib/mux_ruby.rb +5 -0
- data/lib/mux_ruby/api/assets_api.rb +61 -0
- data/lib/mux_ruby/api/live_streams_api.rb +106 -0
- data/lib/mux_ruby/api_client.rb +1 -1
- data/lib/mux_ruby/configuration.rb +1 -4
- data/lib/mux_ruby/models/asset.rb +34 -13
- data/lib/mux_ruby/models/asset_non_standard_input_reasons.rb +335 -0
- data/lib/mux_ruby/models/asset_recording_times.rb +195 -0
- data/lib/mux_ruby/models/asset_static_renditions_files.rb +4 -4
- data/lib/mux_ruby/models/create_asset_request.rb +13 -13
- data/lib/mux_ruby/models/create_live_stream_request.rb +24 -4
- data/lib/mux_ruby/models/create_upload_request.rb +13 -4
- data/lib/mux_ruby/models/disable_live_stream_response.rb +184 -0
- data/lib/mux_ruby/models/enable_live_stream_response.rb +184 -0
- data/lib/mux_ruby/models/input_settings_overlay_settings.rb +46 -0
- data/lib/mux_ruby/models/live_stream.rb +14 -5
- data/lib/mux_ruby/models/update_asset_master_access_request.rb +219 -0
- data/lib/mux_ruby/models/upload.rb +13 -4
- data/lib/mux_ruby/models/video_view.rb +36 -18
- data/lib/mux_ruby/version.rb +1 -1
- data/spec/api/assets_api_spec.rb +13 -0
- data/spec/api/live_streams_api_spec.rb +24 -0
- data/spec/models/asset_non_standard_input_reasons_spec.rb +98 -0
- data/spec/models/asset_recording_times_spec.rb +40 -0
- data/spec/models/asset_spec.rb +18 -6
- data/spec/models/asset_static_renditions_files_spec.rb +2 -2
- data/spec/models/create_asset_request_spec.rb +6 -6
- data/spec/models/create_live_stream_request_spec.rb +12 -0
- data/spec/models/create_upload_request_spec.rb +6 -0
- data/spec/models/disable_live_stream_response_spec.rb +34 -0
- data/spec/models/enable_live_stream_response_spec.rb +34 -0
- data/spec/models/input_settings_overlay_settings_spec.rb +8 -0
- data/spec/models/live_stream_spec.rb +6 -0
- data/spec/models/update_asset_master_access_request_spec.rb +38 -0
- data/spec/models/upload_spec.rb +6 -0
- data/spec/models/video_view_spec.rb +12 -0
- data/test.sh +28 -0
- metadata +80 -60
@@ -112,9 +112,9 @@ module MuxRuby
|
|
112
112
|
# Check to see if the all the properties in the model are valid
|
113
113
|
# @return true if the model is valid
|
114
114
|
def valid?
|
115
|
-
name_validator = EnumAttributeValidator.new('String', ['low.mp4', 'medium.mp4', 'high.mp4'])
|
115
|
+
name_validator = EnumAttributeValidator.new('String', ['low.mp4', 'medium.mp4', 'high.mp4', 'audio.m4a'])
|
116
116
|
return false unless name_validator.valid?(@name)
|
117
|
-
ext_validator = EnumAttributeValidator.new('String', ['mp4'])
|
117
|
+
ext_validator = EnumAttributeValidator.new('String', ['mp4', 'm4a'])
|
118
118
|
return false unless ext_validator.valid?(@ext)
|
119
119
|
true
|
120
120
|
end
|
@@ -122,7 +122,7 @@ module MuxRuby
|
|
122
122
|
# Custom attribute writer method checking allowed values (enum).
|
123
123
|
# @param [Object] name Object to be assigned
|
124
124
|
def name=(name)
|
125
|
-
validator = EnumAttributeValidator.new('String', ['low.mp4', 'medium.mp4', 'high.mp4'])
|
125
|
+
validator = EnumAttributeValidator.new('String', ['low.mp4', 'medium.mp4', 'high.mp4', 'audio.m4a'])
|
126
126
|
unless validator.valid?(name)
|
127
127
|
fail ArgumentError, 'invalid value for "name", must be one of #{validator.allowable_values}.'
|
128
128
|
end
|
@@ -132,7 +132,7 @@ module MuxRuby
|
|
132
132
|
# Custom attribute writer method checking allowed values (enum).
|
133
133
|
# @param [Object] ext Object to be assigned
|
134
134
|
def ext=(ext)
|
135
|
-
validator = EnumAttributeValidator.new('String', ['mp4'])
|
135
|
+
validator = EnumAttributeValidator.new('String', ['mp4', 'm4a'])
|
136
136
|
unless validator.valid?(ext)
|
137
137
|
fail ArgumentError, 'invalid value for "ext", must be one of #{validator.allowable_values}.'
|
138
138
|
end
|
@@ -11,8 +11,6 @@ module MuxRuby
|
|
11
11
|
|
12
12
|
attr_accessor :playback_policy
|
13
13
|
|
14
|
-
attr_accessor :demo
|
15
|
-
|
16
14
|
attr_accessor :per_title_encode
|
17
15
|
|
18
16
|
attr_accessor :passthrough
|
@@ -24,6 +22,8 @@ module MuxRuby
|
|
24
22
|
|
25
23
|
attr_accessor :master_access
|
26
24
|
|
25
|
+
attr_accessor :test
|
26
|
+
|
27
27
|
class EnumAttributeValidator
|
28
28
|
attr_reader :datatype
|
29
29
|
attr_reader :allowable_values
|
@@ -51,12 +51,12 @@ module MuxRuby
|
|
51
51
|
{
|
52
52
|
:'input' => :'input',
|
53
53
|
:'playback_policy' => :'playback_policy',
|
54
|
-
:'demo' => :'demo',
|
55
54
|
:'per_title_encode' => :'per_title_encode',
|
56
55
|
:'passthrough' => :'passthrough',
|
57
56
|
:'mp4_support' => :'mp4_support',
|
58
57
|
:'normalize_audio' => :'normalize_audio',
|
59
|
-
:'master_access' => :'master_access'
|
58
|
+
:'master_access' => :'master_access',
|
59
|
+
:'test' => :'test'
|
60
60
|
}
|
61
61
|
end
|
62
62
|
|
@@ -65,12 +65,12 @@ module MuxRuby
|
|
65
65
|
{
|
66
66
|
:'input' => :'Array<InputSettings>',
|
67
67
|
:'playback_policy' => :'Array<PlaybackPolicy>',
|
68
|
-
:'demo' => :'BOOLEAN',
|
69
68
|
:'per_title_encode' => :'BOOLEAN',
|
70
69
|
:'passthrough' => :'String',
|
71
70
|
:'mp4_support' => :'String',
|
72
71
|
:'normalize_audio' => :'BOOLEAN',
|
73
|
-
:'master_access' => :'String'
|
72
|
+
:'master_access' => :'String',
|
73
|
+
:'test' => :'BOOLEAN'
|
74
74
|
}
|
75
75
|
end
|
76
76
|
|
@@ -94,10 +94,6 @@ module MuxRuby
|
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
97
|
-
if attributes.has_key?(:'demo')
|
98
|
-
self.demo = attributes[:'demo']
|
99
|
-
end
|
100
|
-
|
101
97
|
if attributes.has_key?(:'per_title_encode')
|
102
98
|
self.per_title_encode = attributes[:'per_title_encode']
|
103
99
|
end
|
@@ -119,6 +115,10 @@ module MuxRuby
|
|
119
115
|
if attributes.has_key?(:'master_access')
|
120
116
|
self.master_access = attributes[:'master_access']
|
121
117
|
end
|
118
|
+
|
119
|
+
if attributes.has_key?(:'test')
|
120
|
+
self.test = attributes[:'test']
|
121
|
+
end
|
122
122
|
end
|
123
123
|
|
124
124
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -165,12 +165,12 @@ module MuxRuby
|
|
165
165
|
self.class == o.class &&
|
166
166
|
input == o.input &&
|
167
167
|
playback_policy == o.playback_policy &&
|
168
|
-
demo == o.demo &&
|
169
168
|
per_title_encode == o.per_title_encode &&
|
170
169
|
passthrough == o.passthrough &&
|
171
170
|
mp4_support == o.mp4_support &&
|
172
171
|
normalize_audio == o.normalize_audio &&
|
173
|
-
master_access == o.master_access
|
172
|
+
master_access == o.master_access &&
|
173
|
+
test == o.test
|
174
174
|
end
|
175
175
|
|
176
176
|
# @see the `==` method
|
@@ -182,7 +182,7 @@ module MuxRuby
|
|
182
182
|
# Calculates hash code according to all attributes.
|
183
183
|
# @return [Fixnum] Hash code
|
184
184
|
def hash
|
185
|
-
[input, playback_policy,
|
185
|
+
[input, playback_policy, per_title_encode, passthrough, mp4_support, normalize_audio, master_access, test].hash
|
186
186
|
end
|
187
187
|
|
188
188
|
# Builds the object from hash
|
@@ -19,6 +19,10 @@ module MuxRuby
|
|
19
19
|
# Latency is the time from when the streamer does something in real life to when you see it happen in the player. Set this if you want lower latency for your live stream. Note: Reconnect windows are incompatible with Reduced Latency and will always be set to zero (0) seconds. Read more here: https://mux.com/blog/reduced-latency-for-mux-live-streaming-now-available/
|
20
20
|
attr_accessor :reduced_latency
|
21
21
|
|
22
|
+
attr_accessor :test
|
23
|
+
|
24
|
+
attr_accessor :simulcast_targets
|
25
|
+
|
22
26
|
# Attribute mapping from ruby-style variable name to JSON key.
|
23
27
|
def self.attribute_map
|
24
28
|
{
|
@@ -26,7 +30,9 @@ module MuxRuby
|
|
26
30
|
:'new_asset_settings' => :'new_asset_settings',
|
27
31
|
:'reconnect_window' => :'reconnect_window',
|
28
32
|
:'passthrough' => :'passthrough',
|
29
|
-
:'reduced_latency' => :'reduced_latency'
|
33
|
+
:'reduced_latency' => :'reduced_latency',
|
34
|
+
:'test' => :'test',
|
35
|
+
:'simulcast_targets' => :'simulcast_targets'
|
30
36
|
}
|
31
37
|
end
|
32
38
|
|
@@ -37,7 +43,9 @@ module MuxRuby
|
|
37
43
|
:'new_asset_settings' => :'CreateAssetRequest',
|
38
44
|
:'reconnect_window' => :'Float',
|
39
45
|
:'passthrough' => :'String',
|
40
|
-
:'reduced_latency' => :'BOOLEAN'
|
46
|
+
:'reduced_latency' => :'BOOLEAN',
|
47
|
+
:'test' => :'BOOLEAN',
|
48
|
+
:'simulcast_targets' => :'Array<CreateSimulcastTargetRequest>'
|
41
49
|
}
|
42
50
|
end
|
43
51
|
|
@@ -70,6 +78,16 @@ module MuxRuby
|
|
70
78
|
if attributes.has_key?(:'reduced_latency')
|
71
79
|
self.reduced_latency = attributes[:'reduced_latency']
|
72
80
|
end
|
81
|
+
|
82
|
+
if attributes.has_key?(:'test')
|
83
|
+
self.test = attributes[:'test']
|
84
|
+
end
|
85
|
+
|
86
|
+
if attributes.has_key?(:'simulcast_targets')
|
87
|
+
if (value = attributes[:'simulcast_targets']).is_a?(Array)
|
88
|
+
self.simulcast_targets = value
|
89
|
+
end
|
90
|
+
end
|
73
91
|
end
|
74
92
|
|
75
93
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -118,7 +136,9 @@ module MuxRuby
|
|
118
136
|
new_asset_settings == o.new_asset_settings &&
|
119
137
|
reconnect_window == o.reconnect_window &&
|
120
138
|
passthrough == o.passthrough &&
|
121
|
-
reduced_latency == o.reduced_latency
|
139
|
+
reduced_latency == o.reduced_latency &&
|
140
|
+
test == o.test &&
|
141
|
+
simulcast_targets == o.simulcast_targets
|
122
142
|
end
|
123
143
|
|
124
144
|
# @see the `==` method
|
@@ -130,7 +150,7 @@ module MuxRuby
|
|
130
150
|
# Calculates hash code according to all attributes.
|
131
151
|
# @return [Fixnum] Hash code
|
132
152
|
def hash
|
133
|
-
[playback_policy, new_asset_settings, reconnect_window, passthrough, reduced_latency].hash
|
153
|
+
[playback_policy, new_asset_settings, reconnect_window, passthrough, reduced_latency, test, simulcast_targets].hash
|
134
154
|
end
|
135
155
|
|
136
156
|
# Builds the object from hash
|
@@ -15,12 +15,15 @@ module MuxRuby
|
|
15
15
|
|
16
16
|
attr_accessor :new_asset_settings
|
17
17
|
|
18
|
+
attr_accessor :test
|
19
|
+
|
18
20
|
# Attribute mapping from ruby-style variable name to JSON key.
|
19
21
|
def self.attribute_map
|
20
22
|
{
|
21
23
|
:'timeout' => :'timeout',
|
22
24
|
:'cors_origin' => :'cors_origin',
|
23
|
-
:'new_asset_settings' => :'new_asset_settings'
|
25
|
+
:'new_asset_settings' => :'new_asset_settings',
|
26
|
+
:'test' => :'test'
|
24
27
|
}
|
25
28
|
end
|
26
29
|
|
@@ -29,7 +32,8 @@ module MuxRuby
|
|
29
32
|
{
|
30
33
|
:'timeout' => :'Integer',
|
31
34
|
:'cors_origin' => :'String',
|
32
|
-
:'new_asset_settings' => :'CreateAssetRequest'
|
35
|
+
:'new_asset_settings' => :'CreateAssetRequest',
|
36
|
+
:'test' => :'BOOLEAN'
|
33
37
|
}
|
34
38
|
end
|
35
39
|
|
@@ -54,6 +58,10 @@ module MuxRuby
|
|
54
58
|
if attributes.has_key?(:'new_asset_settings')
|
55
59
|
self.new_asset_settings = attributes[:'new_asset_settings']
|
56
60
|
end
|
61
|
+
|
62
|
+
if attributes.has_key?(:'test')
|
63
|
+
self.test = attributes[:'test']
|
64
|
+
end
|
57
65
|
end
|
58
66
|
|
59
67
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -105,7 +113,8 @@ module MuxRuby
|
|
105
113
|
self.class == o.class &&
|
106
114
|
timeout == o.timeout &&
|
107
115
|
cors_origin == o.cors_origin &&
|
108
|
-
new_asset_settings == o.new_asset_settings
|
116
|
+
new_asset_settings == o.new_asset_settings &&
|
117
|
+
test == o.test
|
109
118
|
end
|
110
119
|
|
111
120
|
# @see the `==` method
|
@@ -117,7 +126,7 @@ module MuxRuby
|
|
117
126
|
# Calculates hash code according to all attributes.
|
118
127
|
# @return [Fixnum] Hash code
|
119
128
|
def hash
|
120
|
-
[timeout, cors_origin, new_asset_settings].hash
|
129
|
+
[timeout, cors_origin, new_asset_settings, test].hash
|
121
130
|
end
|
122
131
|
|
123
132
|
# Builds the object from hash
|
@@ -0,0 +1,184 @@
|
|
1
|
+
=begin
|
2
|
+
# Mux Ruby - Copyright 2019 Mux Inc.
|
3
|
+
# NOTE: This file is auto generated. Do not edit this file manually.
|
4
|
+
=end
|
5
|
+
|
6
|
+
require 'date'
|
7
|
+
|
8
|
+
module MuxRuby
|
9
|
+
class DisableLiveStreamResponse
|
10
|
+
attr_accessor :data
|
11
|
+
|
12
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
13
|
+
def self.attribute_map
|
14
|
+
{
|
15
|
+
:'data' => :'data'
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
# Attribute type mapping.
|
20
|
+
def self.openapi_types
|
21
|
+
{
|
22
|
+
:'data' => :'Object'
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
# Initializes the object
|
27
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
28
|
+
def initialize(attributes = {})
|
29
|
+
return unless attributes.is_a?(Hash)
|
30
|
+
|
31
|
+
# convert string to symbol for hash key
|
32
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
33
|
+
|
34
|
+
if attributes.has_key?(:'data')
|
35
|
+
self.data = attributes[:'data']
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
40
|
+
# @return Array for valid properties with the reasons
|
41
|
+
def list_invalid_properties
|
42
|
+
invalid_properties = Array.new
|
43
|
+
invalid_properties
|
44
|
+
end
|
45
|
+
|
46
|
+
# Check to see if the all the properties in the model are valid
|
47
|
+
# @return true if the model is valid
|
48
|
+
def valid?
|
49
|
+
true
|
50
|
+
end
|
51
|
+
|
52
|
+
# Checks equality by comparing each attribute.
|
53
|
+
# @param [Object] Object to be compared
|
54
|
+
def ==(o)
|
55
|
+
return true if self.equal?(o)
|
56
|
+
self.class == o.class &&
|
57
|
+
data == o.data
|
58
|
+
end
|
59
|
+
|
60
|
+
# @see the `==` method
|
61
|
+
# @param [Object] Object to be compared
|
62
|
+
def eql?(o)
|
63
|
+
self == o
|
64
|
+
end
|
65
|
+
|
66
|
+
# Calculates hash code according to all attributes.
|
67
|
+
# @return [Fixnum] Hash code
|
68
|
+
def hash
|
69
|
+
[data].hash
|
70
|
+
end
|
71
|
+
|
72
|
+
# Builds the object from hash
|
73
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
74
|
+
# @return [Object] Returns the model itself
|
75
|
+
def self.build_from_hash(attributes)
|
76
|
+
new.build_from_hash(attributes)
|
77
|
+
end
|
78
|
+
|
79
|
+
# Builds the object from hash
|
80
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
81
|
+
# @return [Object] Returns the model itself
|
82
|
+
def build_from_hash(attributes)
|
83
|
+
return nil unless attributes.is_a?(Hash)
|
84
|
+
self.class.openapi_types.each_pair do |key, type|
|
85
|
+
if type =~ /\AArray<(.*)>/i
|
86
|
+
# check to ensure the input is an array given that the attribute
|
87
|
+
# is documented as an array but the input is not
|
88
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
89
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
90
|
+
end
|
91
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
92
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
93
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
94
|
+
end
|
95
|
+
|
96
|
+
self
|
97
|
+
end
|
98
|
+
|
99
|
+
# Deserializes the data based on type
|
100
|
+
# @param string type Data type
|
101
|
+
# @param string value Value to be deserialized
|
102
|
+
# @return [Object] Deserialized data
|
103
|
+
def _deserialize(type, value)
|
104
|
+
case type.to_sym
|
105
|
+
when :DateTime
|
106
|
+
DateTime.parse(value)
|
107
|
+
when :Date
|
108
|
+
Date.parse(value)
|
109
|
+
when :String
|
110
|
+
value.to_s
|
111
|
+
when :Integer
|
112
|
+
value.to_i
|
113
|
+
when :Float
|
114
|
+
value.to_f
|
115
|
+
when :BOOLEAN
|
116
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
117
|
+
true
|
118
|
+
else
|
119
|
+
false
|
120
|
+
end
|
121
|
+
when :Object
|
122
|
+
# generic object (usually a Hash), return directly
|
123
|
+
value
|
124
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
125
|
+
inner_type = Regexp.last_match[:inner_type]
|
126
|
+
value.map { |v| _deserialize(inner_type, v) }
|
127
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
128
|
+
k_type = Regexp.last_match[:k_type]
|
129
|
+
v_type = Regexp.last_match[:v_type]
|
130
|
+
{}.tap do |hash|
|
131
|
+
value.each do |k, v|
|
132
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
else # model
|
136
|
+
MuxRuby.const_get(type).build_from_hash(value)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
# Returns the string representation of the object
|
141
|
+
# @return [String] String presentation of the object
|
142
|
+
def to_s
|
143
|
+
to_hash.to_s
|
144
|
+
end
|
145
|
+
|
146
|
+
# to_body is an alias to to_hash (backward compatibility)
|
147
|
+
# @return [Hash] Returns the object in the form of hash
|
148
|
+
def to_body
|
149
|
+
to_hash
|
150
|
+
end
|
151
|
+
|
152
|
+
# Returns the object in the form of hash
|
153
|
+
# @return [Hash] Returns the object in the form of hash
|
154
|
+
def to_hash
|
155
|
+
hash = {}
|
156
|
+
self.class.attribute_map.each_pair do |attr, param|
|
157
|
+
value = self.send(attr)
|
158
|
+
next if value.nil?
|
159
|
+
hash[param] = _to_hash(value)
|
160
|
+
end
|
161
|
+
hash
|
162
|
+
end
|
163
|
+
|
164
|
+
# Outputs non-array value in the form of hash
|
165
|
+
# For object, use to_hash. Otherwise, just return the value
|
166
|
+
# @param [Object] value Any valid value
|
167
|
+
# @return [Hash] Returns the value in the form of hash
|
168
|
+
def _to_hash(value)
|
169
|
+
if value.is_a?(Array)
|
170
|
+
value.compact.map { |v| _to_hash(v) }
|
171
|
+
elsif value.is_a?(Hash)
|
172
|
+
{}.tap do |hash|
|
173
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
174
|
+
end
|
175
|
+
elsif value.respond_to? :to_hash
|
176
|
+
value.to_hash
|
177
|
+
else
|
178
|
+
value
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
end
|
183
|
+
|
184
|
+
end
|
@@ -0,0 +1,184 @@
|
|
1
|
+
=begin
|
2
|
+
# Mux Ruby - Copyright 2019 Mux Inc.
|
3
|
+
# NOTE: This file is auto generated. Do not edit this file manually.
|
4
|
+
=end
|
5
|
+
|
6
|
+
require 'date'
|
7
|
+
|
8
|
+
module MuxRuby
|
9
|
+
class EnableLiveStreamResponse
|
10
|
+
attr_accessor :data
|
11
|
+
|
12
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
13
|
+
def self.attribute_map
|
14
|
+
{
|
15
|
+
:'data' => :'data'
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
# Attribute type mapping.
|
20
|
+
def self.openapi_types
|
21
|
+
{
|
22
|
+
:'data' => :'Object'
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
# Initializes the object
|
27
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
28
|
+
def initialize(attributes = {})
|
29
|
+
return unless attributes.is_a?(Hash)
|
30
|
+
|
31
|
+
# convert string to symbol for hash key
|
32
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
33
|
+
|
34
|
+
if attributes.has_key?(:'data')
|
35
|
+
self.data = attributes[:'data']
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
40
|
+
# @return Array for valid properties with the reasons
|
41
|
+
def list_invalid_properties
|
42
|
+
invalid_properties = Array.new
|
43
|
+
invalid_properties
|
44
|
+
end
|
45
|
+
|
46
|
+
# Check to see if the all the properties in the model are valid
|
47
|
+
# @return true if the model is valid
|
48
|
+
def valid?
|
49
|
+
true
|
50
|
+
end
|
51
|
+
|
52
|
+
# Checks equality by comparing each attribute.
|
53
|
+
# @param [Object] Object to be compared
|
54
|
+
def ==(o)
|
55
|
+
return true if self.equal?(o)
|
56
|
+
self.class == o.class &&
|
57
|
+
data == o.data
|
58
|
+
end
|
59
|
+
|
60
|
+
# @see the `==` method
|
61
|
+
# @param [Object] Object to be compared
|
62
|
+
def eql?(o)
|
63
|
+
self == o
|
64
|
+
end
|
65
|
+
|
66
|
+
# Calculates hash code according to all attributes.
|
67
|
+
# @return [Fixnum] Hash code
|
68
|
+
def hash
|
69
|
+
[data].hash
|
70
|
+
end
|
71
|
+
|
72
|
+
# Builds the object from hash
|
73
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
74
|
+
# @return [Object] Returns the model itself
|
75
|
+
def self.build_from_hash(attributes)
|
76
|
+
new.build_from_hash(attributes)
|
77
|
+
end
|
78
|
+
|
79
|
+
# Builds the object from hash
|
80
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
81
|
+
# @return [Object] Returns the model itself
|
82
|
+
def build_from_hash(attributes)
|
83
|
+
return nil unless attributes.is_a?(Hash)
|
84
|
+
self.class.openapi_types.each_pair do |key, type|
|
85
|
+
if type =~ /\AArray<(.*)>/i
|
86
|
+
# check to ensure the input is an array given that the attribute
|
87
|
+
# is documented as an array but the input is not
|
88
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
89
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
90
|
+
end
|
91
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
92
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
93
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
94
|
+
end
|
95
|
+
|
96
|
+
self
|
97
|
+
end
|
98
|
+
|
99
|
+
# Deserializes the data based on type
|
100
|
+
# @param string type Data type
|
101
|
+
# @param string value Value to be deserialized
|
102
|
+
# @return [Object] Deserialized data
|
103
|
+
def _deserialize(type, value)
|
104
|
+
case type.to_sym
|
105
|
+
when :DateTime
|
106
|
+
DateTime.parse(value)
|
107
|
+
when :Date
|
108
|
+
Date.parse(value)
|
109
|
+
when :String
|
110
|
+
value.to_s
|
111
|
+
when :Integer
|
112
|
+
value.to_i
|
113
|
+
when :Float
|
114
|
+
value.to_f
|
115
|
+
when :BOOLEAN
|
116
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
117
|
+
true
|
118
|
+
else
|
119
|
+
false
|
120
|
+
end
|
121
|
+
when :Object
|
122
|
+
# generic object (usually a Hash), return directly
|
123
|
+
value
|
124
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
125
|
+
inner_type = Regexp.last_match[:inner_type]
|
126
|
+
value.map { |v| _deserialize(inner_type, v) }
|
127
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
128
|
+
k_type = Regexp.last_match[:k_type]
|
129
|
+
v_type = Regexp.last_match[:v_type]
|
130
|
+
{}.tap do |hash|
|
131
|
+
value.each do |k, v|
|
132
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
else # model
|
136
|
+
MuxRuby.const_get(type).build_from_hash(value)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
# Returns the string representation of the object
|
141
|
+
# @return [String] String presentation of the object
|
142
|
+
def to_s
|
143
|
+
to_hash.to_s
|
144
|
+
end
|
145
|
+
|
146
|
+
# to_body is an alias to to_hash (backward compatibility)
|
147
|
+
# @return [Hash] Returns the object in the form of hash
|
148
|
+
def to_body
|
149
|
+
to_hash
|
150
|
+
end
|
151
|
+
|
152
|
+
# Returns the object in the form of hash
|
153
|
+
# @return [Hash] Returns the object in the form of hash
|
154
|
+
def to_hash
|
155
|
+
hash = {}
|
156
|
+
self.class.attribute_map.each_pair do |attr, param|
|
157
|
+
value = self.send(attr)
|
158
|
+
next if value.nil?
|
159
|
+
hash[param] = _to_hash(value)
|
160
|
+
end
|
161
|
+
hash
|
162
|
+
end
|
163
|
+
|
164
|
+
# Outputs non-array value in the form of hash
|
165
|
+
# For object, use to_hash. Otherwise, just return the value
|
166
|
+
# @param [Object] value Any valid value
|
167
|
+
# @return [Hash] Returns the value in the form of hash
|
168
|
+
def _to_hash(value)
|
169
|
+
if value.is_a?(Array)
|
170
|
+
value.compact.map { |v| _to_hash(v) }
|
171
|
+
elsif value.is_a?(Hash)
|
172
|
+
{}.tap do |hash|
|
173
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
174
|
+
end
|
175
|
+
elsif value.respond_to? :to_hash
|
176
|
+
value.to_hash
|
177
|
+
else
|
178
|
+
value
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
end
|
183
|
+
|
184
|
+
end
|