mux_ruby 1.0.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +3 -0
- data/docs/Asset.md +1 -0
- data/docs/AssetsApi.md +103 -0
- data/docs/CreateAssetRequest.md +2 -0
- data/docs/CreateLiveStreamRequest.md +3 -0
- data/docs/CreateSimulcastTargetRequest.md +10 -0
- data/docs/CreateTrackRequest.md +14 -0
- data/docs/CreateTrackResponse.md +8 -0
- data/docs/DeliveryReport.md +14 -0
- data/docs/DeliveryUsageApi.md +68 -0
- data/docs/GetMetricTimeseriesDataResponse.md +1 -1
- data/docs/GetOverallValuesResponse.md +1 -1
- data/docs/InputSettings.md +6 -1
- data/docs/InputTrack.md +0 -2
- data/docs/Insight.md +2 -2
- data/docs/ListAllMetricValuesResponse.md +1 -1
- data/docs/ListBreakdownValuesResponse.md +1 -1
- data/docs/ListDeliveryUsageResponse.md +11 -0
- data/docs/ListErrorsResponse.md +1 -1
- data/docs/ListExportsResponse.md +1 -1
- data/docs/ListFilterValuesResponse.md +1 -1
- data/docs/ListFiltersResponse.md +1 -1
- data/docs/ListInsightsResponse.md +1 -1
- data/docs/ListVideoViewsResponse.md +1 -1
- data/docs/LiveStream.md +2 -0
- data/docs/LiveStreamsApi.md +161 -0
- data/docs/SigningKeyResponse.md +1 -1
- data/docs/SimulcastTarget.md +12 -0
- data/docs/SimulcastTargetResponse.md +8 -0
- data/docs/Track.md +5 -2
- data/docs/VideoViewResponse.md +1 -1
- data/examples/data/exercise-errors.rb +1 -1
- data/examples/data/exercise-metrics.rb +0 -7
- data/examples/video/exercise-assets.rb +17 -1
- data/examples/video/exercise-delivery-usage.rb +23 -0
- data/examples/video/exercise-live-streams.rb +28 -1
- data/lib/mux_ruby/api/assets_api.rb +113 -0
- data/lib/mux_ruby/api/delivery_usage_api.rb +75 -0
- data/lib/mux_ruby/api/live_streams_api.rb +176 -0
- data/lib/mux_ruby/api_client.rb +1 -1
- data/lib/mux_ruby/models/asset.rb +12 -1
- data/lib/mux_ruby/models/create_asset_request.rb +37 -4
- data/lib/mux_ruby/models/create_live_stream_request.rb +57 -4
- data/lib/mux_ruby/models/create_simulcast_target_request.rb +210 -0
- data/lib/mux_ruby/models/create_track_request.rb +304 -0
- data/lib/mux_ruby/models/create_track_response.rb +184 -0
- data/lib/mux_ruby/models/delivery_report.rb +238 -0
- data/lib/mux_ruby/models/get_metric_timeseries_data_response.rb +1 -1
- data/lib/mux_ruby/models/get_overall_values_response.rb +1 -1
- data/lib/mux_ruby/models/input_settings.rb +104 -13
- data/lib/mux_ruby/models/input_track.rb +4 -22
- data/lib/mux_ruby/models/insight.rb +2 -2
- data/lib/mux_ruby/models/list_all_metric_values_response.rb +1 -1
- data/lib/mux_ruby/models/list_breakdown_values_response.rb +1 -1
- data/lib/mux_ruby/models/list_delivery_usage_response.rb +216 -0
- data/lib/mux_ruby/models/list_errors_response.rb +1 -1
- data/lib/mux_ruby/models/list_exports_response.rb +1 -1
- data/lib/mux_ruby/models/list_filter_values_response.rb +1 -1
- data/lib/mux_ruby/models/list_filters_response.rb +1 -1
- data/lib/mux_ruby/models/list_insights_response.rb +1 -1
- data/lib/mux_ruby/models/list_video_views_response.rb +1 -1
- data/lib/mux_ruby/models/live_stream.rb +24 -4
- data/lib/mux_ruby/models/simulcast_target.rb +259 -0
- data/lib/mux_ruby/models/simulcast_target_response.rb +184 -0
- data/lib/mux_ruby/models/track.rb +86 -13
- data/lib/mux_ruby/models/video_view_response.rb +1 -1
- data/lib/mux_ruby/version.rb +1 -1
- data/lib/mux_ruby.rb +8 -0
- data/spec/api/assets_api_spec.rb +24 -0
- data/spec/api/delivery_usage_api_spec.rb +43 -0
- data/spec/api/live_streams_api_spec.rb +39 -0
- data/spec/models/asset_spec.rb +6 -0
- data/spec/models/create_asset_request_spec.rb +16 -0
- data/spec/models/create_live_stream_request_spec.rb +18 -0
- data/spec/models/create_simulcast_target_request_spec.rb +46 -0
- data/spec/models/create_track_request_spec.rb +78 -0
- data/spec/models/create_track_response_spec.rb +34 -0
- data/spec/models/delivery_report_spec.rb +70 -0
- data/spec/models/input_settings_spec.rb +40 -2
- data/spec/models/input_track_spec.rb +0 -12
- data/spec/models/list_delivery_usage_response_spec.rb +52 -0
- data/spec/models/live_stream_spec.rb +12 -0
- data/spec/models/simulcast_target_response_spec.rb +34 -0
- data/spec/models/simulcast_target_spec.rb +62 -0
- data/spec/models/track_spec.rb +28 -2
- metadata +36 -3
@@ -0,0 +1,216 @@
|
|
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 ListDeliveryUsageResponse
|
10
|
+
attr_accessor :data
|
11
|
+
|
12
|
+
attr_accessor :total_row_count
|
13
|
+
|
14
|
+
attr_accessor :timeframe
|
15
|
+
|
16
|
+
# Number of assets returned in this response. Default value is 100.
|
17
|
+
attr_accessor :limit
|
18
|
+
|
19
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
20
|
+
def self.attribute_map
|
21
|
+
{
|
22
|
+
:'data' => :'data',
|
23
|
+
:'total_row_count' => :'total_row_count',
|
24
|
+
:'timeframe' => :'timeframe',
|
25
|
+
:'limit' => :'limit'
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
# Attribute type mapping.
|
30
|
+
def self.openapi_types
|
31
|
+
{
|
32
|
+
:'data' => :'Array<DeliveryReport>',
|
33
|
+
:'total_row_count' => :'Integer',
|
34
|
+
:'timeframe' => :'Array<Integer>',
|
35
|
+
:'limit' => :'Integer'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# Initializes the object
|
40
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
41
|
+
def initialize(attributes = {})
|
42
|
+
return unless attributes.is_a?(Hash)
|
43
|
+
|
44
|
+
# convert string to symbol for hash key
|
45
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
46
|
+
|
47
|
+
if attributes.has_key?(:'data')
|
48
|
+
if (value = attributes[:'data']).is_a?(Array)
|
49
|
+
self.data = value
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
if attributes.has_key?(:'total_row_count')
|
54
|
+
self.total_row_count = attributes[:'total_row_count']
|
55
|
+
end
|
56
|
+
|
57
|
+
if attributes.has_key?(:'timeframe')
|
58
|
+
if (value = attributes[:'timeframe']).is_a?(Array)
|
59
|
+
self.timeframe = value
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
if attributes.has_key?(:'limit')
|
64
|
+
self.limit = attributes[:'limit']
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
69
|
+
# @return Array for valid properties with the reasons
|
70
|
+
def list_invalid_properties
|
71
|
+
invalid_properties = Array.new
|
72
|
+
invalid_properties
|
73
|
+
end
|
74
|
+
|
75
|
+
# Check to see if the all the properties in the model are valid
|
76
|
+
# @return true if the model is valid
|
77
|
+
def valid?
|
78
|
+
true
|
79
|
+
end
|
80
|
+
|
81
|
+
# Checks equality by comparing each attribute.
|
82
|
+
# @param [Object] Object to be compared
|
83
|
+
def ==(o)
|
84
|
+
return true if self.equal?(o)
|
85
|
+
self.class == o.class &&
|
86
|
+
data == o.data &&
|
87
|
+
total_row_count == o.total_row_count &&
|
88
|
+
timeframe == o.timeframe &&
|
89
|
+
limit == o.limit
|
90
|
+
end
|
91
|
+
|
92
|
+
# @see the `==` method
|
93
|
+
# @param [Object] Object to be compared
|
94
|
+
def eql?(o)
|
95
|
+
self == o
|
96
|
+
end
|
97
|
+
|
98
|
+
# Calculates hash code according to all attributes.
|
99
|
+
# @return [Fixnum] Hash code
|
100
|
+
def hash
|
101
|
+
[data, total_row_count, timeframe, limit].hash
|
102
|
+
end
|
103
|
+
|
104
|
+
# Builds the object from hash
|
105
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
106
|
+
# @return [Object] Returns the model itself
|
107
|
+
def self.build_from_hash(attributes)
|
108
|
+
new.build_from_hash(attributes)
|
109
|
+
end
|
110
|
+
|
111
|
+
# Builds the object from hash
|
112
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
113
|
+
# @return [Object] Returns the model itself
|
114
|
+
def build_from_hash(attributes)
|
115
|
+
return nil unless attributes.is_a?(Hash)
|
116
|
+
self.class.openapi_types.each_pair do |key, type|
|
117
|
+
if type =~ /\AArray<(.*)>/i
|
118
|
+
# check to ensure the input is an array given that the attribute
|
119
|
+
# is documented as an array but the input is not
|
120
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
121
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
122
|
+
end
|
123
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
124
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
125
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
126
|
+
end
|
127
|
+
|
128
|
+
self
|
129
|
+
end
|
130
|
+
|
131
|
+
# Deserializes the data based on type
|
132
|
+
# @param string type Data type
|
133
|
+
# @param string value Value to be deserialized
|
134
|
+
# @return [Object] Deserialized data
|
135
|
+
def _deserialize(type, value)
|
136
|
+
case type.to_sym
|
137
|
+
when :DateTime
|
138
|
+
DateTime.parse(value)
|
139
|
+
when :Date
|
140
|
+
Date.parse(value)
|
141
|
+
when :String
|
142
|
+
value.to_s
|
143
|
+
when :Integer
|
144
|
+
value.to_i
|
145
|
+
when :Float
|
146
|
+
value.to_f
|
147
|
+
when :BOOLEAN
|
148
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
149
|
+
true
|
150
|
+
else
|
151
|
+
false
|
152
|
+
end
|
153
|
+
when :Object
|
154
|
+
# generic object (usually a Hash), return directly
|
155
|
+
value
|
156
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
157
|
+
inner_type = Regexp.last_match[:inner_type]
|
158
|
+
value.map { |v| _deserialize(inner_type, v) }
|
159
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
160
|
+
k_type = Regexp.last_match[:k_type]
|
161
|
+
v_type = Regexp.last_match[:v_type]
|
162
|
+
{}.tap do |hash|
|
163
|
+
value.each do |k, v|
|
164
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
165
|
+
end
|
166
|
+
end
|
167
|
+
else # model
|
168
|
+
MuxRuby.const_get(type).build_from_hash(value)
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
# Returns the string representation of the object
|
173
|
+
# @return [String] String presentation of the object
|
174
|
+
def to_s
|
175
|
+
to_hash.to_s
|
176
|
+
end
|
177
|
+
|
178
|
+
# to_body is an alias to to_hash (backward compatibility)
|
179
|
+
# @return [Hash] Returns the object in the form of hash
|
180
|
+
def to_body
|
181
|
+
to_hash
|
182
|
+
end
|
183
|
+
|
184
|
+
# Returns the object in the form of hash
|
185
|
+
# @return [Hash] Returns the object in the form of hash
|
186
|
+
def to_hash
|
187
|
+
hash = {}
|
188
|
+
self.class.attribute_map.each_pair do |attr, param|
|
189
|
+
value = self.send(attr)
|
190
|
+
next if value.nil?
|
191
|
+
hash[param] = _to_hash(value)
|
192
|
+
end
|
193
|
+
hash
|
194
|
+
end
|
195
|
+
|
196
|
+
# Outputs non-array value in the form of hash
|
197
|
+
# For object, use to_hash. Otherwise, just return the value
|
198
|
+
# @param [Object] value Any valid value
|
199
|
+
# @return [Hash] Returns the value in the form of hash
|
200
|
+
def _to_hash(value)
|
201
|
+
if value.is_a?(Array)
|
202
|
+
value.compact.map { |v| _to_hash(v) }
|
203
|
+
elsif value.is_a?(Hash)
|
204
|
+
{}.tap do |hash|
|
205
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
206
|
+
end
|
207
|
+
elsif value.respond_to? :to_hash
|
208
|
+
value.to_hash
|
209
|
+
else
|
210
|
+
value
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
end
|
215
|
+
|
216
|
+
end
|
@@ -27,6 +27,10 @@ module MuxRuby
|
|
27
27
|
|
28
28
|
attr_accessor :reconnect_window
|
29
29
|
|
30
|
+
attr_accessor :reduced_latency
|
31
|
+
|
32
|
+
attr_accessor :simulcast_targets
|
33
|
+
|
30
34
|
# Attribute mapping from ruby-style variable name to JSON key.
|
31
35
|
def self.attribute_map
|
32
36
|
{
|
@@ -39,7 +43,9 @@ module MuxRuby
|
|
39
43
|
:'playback_ids' => :'playback_ids',
|
40
44
|
:'new_asset_settings' => :'new_asset_settings',
|
41
45
|
:'passthrough' => :'passthrough',
|
42
|
-
:'reconnect_window' => :'reconnect_window'
|
46
|
+
:'reconnect_window' => :'reconnect_window',
|
47
|
+
:'reduced_latency' => :'reduced_latency',
|
48
|
+
:'simulcast_targets' => :'simulcast_targets'
|
43
49
|
}
|
44
50
|
end
|
45
51
|
|
@@ -55,7 +61,9 @@ module MuxRuby
|
|
55
61
|
:'playback_ids' => :'Array<PlaybackID>',
|
56
62
|
:'new_asset_settings' => :'Asset',
|
57
63
|
:'passthrough' => :'String',
|
58
|
-
:'reconnect_window' => :'Float'
|
64
|
+
:'reconnect_window' => :'Float',
|
65
|
+
:'reduced_latency' => :'BOOLEAN',
|
66
|
+
:'simulcast_targets' => :'Array<SimulcastTarget>'
|
59
67
|
}
|
60
68
|
end
|
61
69
|
|
@@ -110,6 +118,16 @@ module MuxRuby
|
|
110
118
|
if attributes.has_key?(:'reconnect_window')
|
111
119
|
self.reconnect_window = attributes[:'reconnect_window']
|
112
120
|
end
|
121
|
+
|
122
|
+
if attributes.has_key?(:'reduced_latency')
|
123
|
+
self.reduced_latency = attributes[:'reduced_latency']
|
124
|
+
end
|
125
|
+
|
126
|
+
if attributes.has_key?(:'simulcast_targets')
|
127
|
+
if (value = attributes[:'simulcast_targets']).is_a?(Array)
|
128
|
+
self.simulcast_targets = value
|
129
|
+
end
|
130
|
+
end
|
113
131
|
end
|
114
132
|
|
115
133
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -139,7 +157,9 @@ module MuxRuby
|
|
139
157
|
playback_ids == o.playback_ids &&
|
140
158
|
new_asset_settings == o.new_asset_settings &&
|
141
159
|
passthrough == o.passthrough &&
|
142
|
-
reconnect_window == o.reconnect_window
|
160
|
+
reconnect_window == o.reconnect_window &&
|
161
|
+
reduced_latency == o.reduced_latency &&
|
162
|
+
simulcast_targets == o.simulcast_targets
|
143
163
|
end
|
144
164
|
|
145
165
|
# @see the `==` method
|
@@ -151,7 +171,7 @@ module MuxRuby
|
|
151
171
|
# Calculates hash code according to all attributes.
|
152
172
|
# @return [Fixnum] Hash code
|
153
173
|
def hash
|
154
|
-
[id, created_at, stream_key, active_asset_id, recent_asset_ids, status, playback_ids, new_asset_settings, passthrough, reconnect_window].hash
|
174
|
+
[id, created_at, stream_key, active_asset_id, recent_asset_ids, status, playback_ids, new_asset_settings, passthrough, reconnect_window, reduced_latency, simulcast_targets].hash
|
155
175
|
end
|
156
176
|
|
157
177
|
# Builds the object from hash
|
@@ -0,0 +1,259 @@
|
|
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 SimulcastTarget
|
10
|
+
# ID of the Simulcast Target
|
11
|
+
attr_accessor :id
|
12
|
+
|
13
|
+
# Arbitrary Metadata set when creating a simulcast target.
|
14
|
+
attr_accessor :passthrough
|
15
|
+
|
16
|
+
# The current status of the simulcast target. See Statuses below for detailed description. * `idle`: Default status. When the parent live stream is in disconnected status, simulcast targets will be idle state. * `starting`: The simulcast target transitions into this state when the parent live stream transition into connected state. * `broadcasting`: The simulcast target has successfully connected to the third party live streaming service and is pushing video to that service. * `errored`: The simulcast target encountered an error either while attempting to connect to the third party live streaming service, or mid-broadcasting. Compared to other errored statuses in the Mux Video API, a simulcast may transition back into the broadcasting state if a connection with the service can be re-established.
|
17
|
+
attr_accessor :status
|
18
|
+
|
19
|
+
# Stream Key represents an stream identifier for the third party live streaming service to simulcast the parent live stream too.
|
20
|
+
attr_accessor :stream_key
|
21
|
+
|
22
|
+
# RTMP hostname including the application name for the third party live streaming service.
|
23
|
+
attr_accessor :url
|
24
|
+
|
25
|
+
class EnumAttributeValidator
|
26
|
+
attr_reader :datatype
|
27
|
+
attr_reader :allowable_values
|
28
|
+
|
29
|
+
def initialize(datatype, allowable_values)
|
30
|
+
@allowable_values = allowable_values.map do |value|
|
31
|
+
case datatype.to_s
|
32
|
+
when /Integer/i
|
33
|
+
value.to_i
|
34
|
+
when /Float/i
|
35
|
+
value.to_f
|
36
|
+
else
|
37
|
+
value
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def valid?(value)
|
43
|
+
!value || allowable_values.include?(value)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
48
|
+
def self.attribute_map
|
49
|
+
{
|
50
|
+
:'id' => :'id',
|
51
|
+
:'passthrough' => :'passthrough',
|
52
|
+
:'status' => :'status',
|
53
|
+
:'stream_key' => :'stream_key',
|
54
|
+
:'url' => :'url'
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
58
|
+
# Attribute type mapping.
|
59
|
+
def self.openapi_types
|
60
|
+
{
|
61
|
+
:'id' => :'String',
|
62
|
+
:'passthrough' => :'String',
|
63
|
+
:'status' => :'String',
|
64
|
+
:'stream_key' => :'String',
|
65
|
+
:'url' => :'String'
|
66
|
+
}
|
67
|
+
end
|
68
|
+
|
69
|
+
# Initializes the object
|
70
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
71
|
+
def initialize(attributes = {})
|
72
|
+
return unless attributes.is_a?(Hash)
|
73
|
+
|
74
|
+
# convert string to symbol for hash key
|
75
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
76
|
+
|
77
|
+
if attributes.has_key?(:'id')
|
78
|
+
self.id = attributes[:'id']
|
79
|
+
end
|
80
|
+
|
81
|
+
if attributes.has_key?(:'passthrough')
|
82
|
+
self.passthrough = attributes[:'passthrough']
|
83
|
+
end
|
84
|
+
|
85
|
+
if attributes.has_key?(:'status')
|
86
|
+
self.status = attributes[:'status']
|
87
|
+
end
|
88
|
+
|
89
|
+
if attributes.has_key?(:'stream_key')
|
90
|
+
self.stream_key = attributes[:'stream_key']
|
91
|
+
end
|
92
|
+
|
93
|
+
if attributes.has_key?(:'url')
|
94
|
+
self.url = attributes[:'url']
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
99
|
+
# @return Array for valid properties with the reasons
|
100
|
+
def list_invalid_properties
|
101
|
+
invalid_properties = Array.new
|
102
|
+
invalid_properties
|
103
|
+
end
|
104
|
+
|
105
|
+
# Check to see if the all the properties in the model are valid
|
106
|
+
# @return true if the model is valid
|
107
|
+
def valid?
|
108
|
+
status_validator = EnumAttributeValidator.new('String', ['idle', 'starting', 'broadcasting', 'errored'])
|
109
|
+
return false unless status_validator.valid?(@status)
|
110
|
+
true
|
111
|
+
end
|
112
|
+
|
113
|
+
# Custom attribute writer method checking allowed values (enum).
|
114
|
+
# @param [Object] status Object to be assigned
|
115
|
+
def status=(status)
|
116
|
+
validator = EnumAttributeValidator.new('String', ['idle', 'starting', 'broadcasting', 'errored'])
|
117
|
+
unless validator.valid?(status)
|
118
|
+
fail ArgumentError, 'invalid value for "status", must be one of #{validator.allowable_values}.'
|
119
|
+
end
|
120
|
+
@status = status
|
121
|
+
end
|
122
|
+
|
123
|
+
# Checks equality by comparing each attribute.
|
124
|
+
# @param [Object] Object to be compared
|
125
|
+
def ==(o)
|
126
|
+
return true if self.equal?(o)
|
127
|
+
self.class == o.class &&
|
128
|
+
id == o.id &&
|
129
|
+
passthrough == o.passthrough &&
|
130
|
+
status == o.status &&
|
131
|
+
stream_key == o.stream_key &&
|
132
|
+
url == o.url
|
133
|
+
end
|
134
|
+
|
135
|
+
# @see the `==` method
|
136
|
+
# @param [Object] Object to be compared
|
137
|
+
def eql?(o)
|
138
|
+
self == o
|
139
|
+
end
|
140
|
+
|
141
|
+
# Calculates hash code according to all attributes.
|
142
|
+
# @return [Fixnum] Hash code
|
143
|
+
def hash
|
144
|
+
[id, passthrough, status, stream_key, url].hash
|
145
|
+
end
|
146
|
+
|
147
|
+
# Builds the object from hash
|
148
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
149
|
+
# @return [Object] Returns the model itself
|
150
|
+
def self.build_from_hash(attributes)
|
151
|
+
new.build_from_hash(attributes)
|
152
|
+
end
|
153
|
+
|
154
|
+
# Builds the object from hash
|
155
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
156
|
+
# @return [Object] Returns the model itself
|
157
|
+
def build_from_hash(attributes)
|
158
|
+
return nil unless attributes.is_a?(Hash)
|
159
|
+
self.class.openapi_types.each_pair do |key, type|
|
160
|
+
if type =~ /\AArray<(.*)>/i
|
161
|
+
# check to ensure the input is an array given that the attribute
|
162
|
+
# is documented as an array but the input is not
|
163
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
164
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
165
|
+
end
|
166
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
167
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
168
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
169
|
+
end
|
170
|
+
|
171
|
+
self
|
172
|
+
end
|
173
|
+
|
174
|
+
# Deserializes the data based on type
|
175
|
+
# @param string type Data type
|
176
|
+
# @param string value Value to be deserialized
|
177
|
+
# @return [Object] Deserialized data
|
178
|
+
def _deserialize(type, value)
|
179
|
+
case type.to_sym
|
180
|
+
when :DateTime
|
181
|
+
DateTime.parse(value)
|
182
|
+
when :Date
|
183
|
+
Date.parse(value)
|
184
|
+
when :String
|
185
|
+
value.to_s
|
186
|
+
when :Integer
|
187
|
+
value.to_i
|
188
|
+
when :Float
|
189
|
+
value.to_f
|
190
|
+
when :BOOLEAN
|
191
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
192
|
+
true
|
193
|
+
else
|
194
|
+
false
|
195
|
+
end
|
196
|
+
when :Object
|
197
|
+
# generic object (usually a Hash), return directly
|
198
|
+
value
|
199
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
200
|
+
inner_type = Regexp.last_match[:inner_type]
|
201
|
+
value.map { |v| _deserialize(inner_type, v) }
|
202
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
203
|
+
k_type = Regexp.last_match[:k_type]
|
204
|
+
v_type = Regexp.last_match[:v_type]
|
205
|
+
{}.tap do |hash|
|
206
|
+
value.each do |k, v|
|
207
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
208
|
+
end
|
209
|
+
end
|
210
|
+
else # model
|
211
|
+
MuxRuby.const_get(type).build_from_hash(value)
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
# Returns the string representation of the object
|
216
|
+
# @return [String] String presentation of the object
|
217
|
+
def to_s
|
218
|
+
to_hash.to_s
|
219
|
+
end
|
220
|
+
|
221
|
+
# to_body is an alias to to_hash (backward compatibility)
|
222
|
+
# @return [Hash] Returns the object in the form of hash
|
223
|
+
def to_body
|
224
|
+
to_hash
|
225
|
+
end
|
226
|
+
|
227
|
+
# Returns the object in the form of hash
|
228
|
+
# @return [Hash] Returns the object in the form of hash
|
229
|
+
def to_hash
|
230
|
+
hash = {}
|
231
|
+
self.class.attribute_map.each_pair do |attr, param|
|
232
|
+
value = self.send(attr)
|
233
|
+
next if value.nil?
|
234
|
+
hash[param] = _to_hash(value)
|
235
|
+
end
|
236
|
+
hash
|
237
|
+
end
|
238
|
+
|
239
|
+
# Outputs non-array value in the form of hash
|
240
|
+
# For object, use to_hash. Otherwise, just return the value
|
241
|
+
# @param [Object] value Any valid value
|
242
|
+
# @return [Hash] Returns the value in the form of hash
|
243
|
+
def _to_hash(value)
|
244
|
+
if value.is_a?(Array)
|
245
|
+
value.compact.map { |v| _to_hash(v) }
|
246
|
+
elsif value.is_a?(Hash)
|
247
|
+
{}.tap do |hash|
|
248
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
249
|
+
end
|
250
|
+
elsif value.respond_to? :to_hash
|
251
|
+
value.to_hash
|
252
|
+
else
|
253
|
+
value
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
end
|
258
|
+
|
259
|
+
end
|