mux_ruby 1.5.0 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (162) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/README.md +4 -1
  4. data/docs/Asset.md +15 -12
  5. data/docs/AssetErrors.md +2 -2
  6. data/docs/AssetNonStandardInputReasons.md +16 -0
  7. data/docs/AssetRecordingTimes.md +9 -0
  8. data/docs/AssetStaticRenditions.md +1 -1
  9. data/docs/AssetsApi.md +4 -0
  10. data/docs/CreateAssetRequest.md +6 -6
  11. data/docs/CreateLiveStreamRequest.md +1 -0
  12. data/docs/CreateTrackRequest.md +4 -4
  13. data/docs/DimensionValue.md +9 -0
  14. data/docs/DimensionsApi.md +118 -0
  15. data/docs/DisableLiveStreamResponse.md +8 -0
  16. data/docs/EnableLiveStreamResponse.md +8 -0
  17. data/docs/FiltersApi.md +2 -2
  18. data/docs/GetAssetOrLiveStreamIdResponse.md +8 -0
  19. data/docs/GetAssetOrLiveStreamIdResponseData.md +10 -0
  20. data/docs/GetAssetOrLiveStreamIdResponseDataObject.md +9 -0
  21. data/docs/GetRealTimeBreakdownResponse.md +10 -0
  22. data/docs/GetRealTimeHistogramTimeseriesResponse.md +11 -0
  23. data/docs/GetRealTimeHistogramTimeseriesResponseMeta.md +8 -0
  24. data/docs/GetRealTimeTimeseriesResponse.md +10 -0
  25. data/docs/Incident.md +28 -0
  26. data/docs/IncidentBreakdown.md +10 -0
  27. data/docs/IncidentNotification.md +10 -0
  28. data/docs/IncidentNotificationRule.md +12 -0
  29. data/docs/IncidentResponse.md +9 -0
  30. data/docs/IncidentsApi.md +186 -0
  31. data/docs/InputSettings.md +9 -7
  32. data/docs/InputSettingsOverlaySettings.md +7 -7
  33. data/docs/ListDimensionValuesResponse.md +10 -0
  34. data/docs/ListDimensionsResponse.md +10 -0
  35. data/docs/ListIncidentsResponse.md +10 -0
  36. data/docs/ListRealTimeDimensionsResponse.md +10 -0
  37. data/docs/ListRealTimeDimensionsResponseData.md +9 -0
  38. data/docs/ListRealTimeMetricsResponse.md +10 -0
  39. data/docs/ListRelatedIncidentsResponse.md +10 -0
  40. data/docs/LiveStream.md +1 -1
  41. data/docs/LiveStreamsApi.md +104 -0
  42. data/docs/NotificationRule.md +10 -0
  43. data/docs/PlaybackID.md +1 -1
  44. data/docs/PlaybackIDApi.md +60 -0
  45. data/docs/RealTimeApi.md +280 -0
  46. data/docs/RealTimeBreakdownValue.md +12 -0
  47. data/docs/RealTimeHistogramTimeseriesBucket.md +9 -0
  48. data/docs/RealTimeHistogramTimeseriesBucketValues.md +9 -0
  49. data/docs/RealTimeHistogramTimeseriesDatapoint.md +14 -0
  50. data/docs/RealTimeTimeseriesDatapoint.md +10 -0
  51. data/docs/Track.md +13 -13
  52. data/docs/VideoView.md +16 -14
  53. data/examples/data/exercise-dimensions.rb +29 -0
  54. data/examples/data/exercise-incidents.rb +29 -0
  55. data/examples/data/exercise-realtime.rb +60 -0
  56. data/examples/video/exercise-assets.rb +21 -0
  57. data/examples/video/exercise-live-streams.rb +30 -0
  58. data/lib/mux_ruby.rb +34 -0
  59. data/lib/mux_ruby/api/assets_api.rb +4 -0
  60. data/lib/mux_ruby/api/dimensions_api.rb +128 -0
  61. data/lib/mux_ruby/api/filters_api.rb +4 -4
  62. data/lib/mux_ruby/api/incidents_api.rb +217 -0
  63. data/lib/mux_ruby/api/live_streams_api.rb +106 -0
  64. data/lib/mux_ruby/api/playback_id_api.rb +69 -0
  65. data/lib/mux_ruby/api/real_time_api.rb +311 -0
  66. data/lib/mux_ruby/api_client.rb +13 -13
  67. data/lib/mux_ruby/configuration.rb +1 -4
  68. data/lib/mux_ruby/models/asset.rb +70 -3
  69. data/lib/mux_ruby/models/asset_errors.rb +2 -0
  70. data/lib/mux_ruby/models/asset_master.rb +35 -0
  71. data/lib/mux_ruby/models/asset_non_standard_input_reasons.rb +335 -0
  72. data/lib/mux_ruby/models/asset_recording_times.rb +195 -0
  73. data/lib/mux_ruby/models/asset_static_renditions.rb +2 -2
  74. data/lib/mux_ruby/models/asset_static_renditions_files.rb +6 -6
  75. data/lib/mux_ruby/models/create_asset_request.rb +8 -2
  76. data/lib/mux_ruby/models/create_live_stream_request.rb +15 -4
  77. data/lib/mux_ruby/models/create_track_request.rb +6 -2
  78. data/lib/mux_ruby/models/dimension_value.rb +193 -0
  79. data/lib/mux_ruby/models/disable_live_stream_response.rb +184 -0
  80. data/lib/mux_ruby/models/enable_live_stream_response.rb +184 -0
  81. data/lib/mux_ruby/models/get_asset_or_live_stream_id_response.rb +184 -0
  82. data/lib/mux_ruby/models/get_asset_or_live_stream_id_response_data.rb +203 -0
  83. data/lib/mux_ruby/models/get_asset_or_live_stream_id_response_data_object.rb +230 -0
  84. data/lib/mux_ruby/models/get_real_time_breakdown_response.rb +206 -0
  85. data/lib/mux_ruby/models/get_real_time_histogram_timeseries_response.rb +215 -0
  86. data/lib/mux_ruby/models/get_real_time_histogram_timeseries_response_meta.rb +186 -0
  87. data/lib/mux_ruby/models/get_real_time_timeseries_response.rb +206 -0
  88. data/lib/mux_ruby/models/incident.rb +370 -0
  89. data/lib/mux_ruby/models/incident_breakdown.rb +202 -0
  90. data/lib/mux_ruby/models/incident_notification.rb +202 -0
  91. data/lib/mux_ruby/models/incident_notification_rule.rb +222 -0
  92. data/lib/mux_ruby/models/incident_response.rb +195 -0
  93. data/lib/mux_ruby/models/input_settings.rb +31 -4
  94. data/lib/mux_ruby/models/input_settings_overlay_settings.rb +10 -2
  95. data/lib/mux_ruby/models/list_dimension_values_response.rb +206 -0
  96. data/lib/mux_ruby/models/list_dimensions_response.rb +204 -0
  97. data/lib/mux_ruby/models/list_incidents_response.rb +206 -0
  98. data/lib/mux_ruby/models/list_real_time_dimensions_response.rb +206 -0
  99. data/lib/mux_ruby/models/list_real_time_dimensions_response_data.rb +193 -0
  100. data/lib/mux_ruby/models/list_real_time_metrics_response.rb +206 -0
  101. data/lib/mux_ruby/models/list_related_incidents_response.rb +206 -0
  102. data/lib/mux_ruby/models/live_stream.rb +1 -1
  103. data/lib/mux_ruby/models/notification_rule.rb +202 -0
  104. data/lib/mux_ruby/models/playback_id.rb +1 -0
  105. data/lib/mux_ruby/models/real_time_breakdown_value.rb +220 -0
  106. data/lib/mux_ruby/models/real_time_histogram_timeseries_bucket.rb +193 -0
  107. data/lib/mux_ruby/models/real_time_histogram_timeseries_bucket_values.rb +193 -0
  108. data/lib/mux_ruby/models/real_time_histogram_timeseries_datapoint.rb +240 -0
  109. data/lib/mux_ruby/models/real_time_timeseries_datapoint.rb +202 -0
  110. data/lib/mux_ruby/models/simulcast_target.rb +1 -1
  111. data/lib/mux_ruby/models/track.rb +27 -2
  112. data/lib/mux_ruby/models/update_asset_master_access_request.rb +1 -1
  113. data/lib/mux_ruby/models/update_asset_mp4_support_request.rb +1 -1
  114. data/lib/mux_ruby/models/upload.rb +1 -1
  115. data/lib/mux_ruby/models/video_view.rb +36 -18
  116. data/lib/mux_ruby/version.rb +1 -1
  117. data/mux_ruby.gemspec +2 -0
  118. data/spec/api/assets_api_spec.rb +2 -0
  119. data/spec/api/dimensions_api_spec.rb +55 -0
  120. data/spec/api/filters_api_spec.rb +2 -2
  121. data/spec/api/incidents_api_spec.rb +73 -0
  122. data/spec/api/live_streams_api_spec.rb +24 -0
  123. data/spec/api/playback_id_api_spec.rb +40 -0
  124. data/spec/api/real_time_api_spec.rb +93 -0
  125. data/spec/models/asset_master_spec.rb +4 -0
  126. data/spec/models/asset_non_standard_input_reasons_spec.rb +98 -0
  127. data/spec/models/asset_recording_times_spec.rb +40 -0
  128. data/spec/models/asset_spec.rb +26 -0
  129. data/spec/models/asset_static_renditions_files_spec.rb +2 -2
  130. data/spec/models/create_live_stream_request_spec.rb +6 -0
  131. data/spec/models/dimension_value_spec.rb +40 -0
  132. data/spec/models/disable_live_stream_response_spec.rb +34 -0
  133. data/spec/models/enable_live_stream_response_spec.rb +34 -0
  134. data/spec/models/get_asset_or_live_stream_id_response_data_object_spec.rb +44 -0
  135. data/spec/models/get_asset_or_live_stream_id_response_data_spec.rb +46 -0
  136. data/spec/models/get_asset_or_live_stream_id_response_spec.rb +34 -0
  137. data/spec/models/get_real_time_breakdown_response_spec.rb +46 -0
  138. data/spec/models/get_real_time_histogram_timeseries_response_meta_spec.rb +34 -0
  139. data/spec/models/get_real_time_histogram_timeseries_response_spec.rb +52 -0
  140. data/spec/models/get_real_time_timeseries_response_spec.rb +46 -0
  141. data/spec/models/incident_breakdown_spec.rb +46 -0
  142. data/spec/models/incident_notification_rule_spec.rb +58 -0
  143. data/spec/models/incident_notification_spec.rb +46 -0
  144. data/spec/models/incident_response_spec.rb +40 -0
  145. data/spec/models/incident_spec.rb +154 -0
  146. data/spec/models/input_settings_spec.rb +12 -0
  147. data/spec/models/list_dimension_values_response_spec.rb +46 -0
  148. data/spec/models/list_dimensions_response_spec.rb +46 -0
  149. data/spec/models/list_incidents_response_spec.rb +46 -0
  150. data/spec/models/list_real_time_dimensions_response_data_spec.rb +40 -0
  151. data/spec/models/list_real_time_dimensions_response_spec.rb +46 -0
  152. data/spec/models/list_real_time_metrics_response_spec.rb +46 -0
  153. data/spec/models/list_related_incidents_response_spec.rb +46 -0
  154. data/spec/models/notification_rule_spec.rb +46 -0
  155. data/spec/models/real_time_breakdown_value_spec.rb +58 -0
  156. data/spec/models/real_time_histogram_timeseries_bucket_spec.rb +40 -0
  157. data/spec/models/real_time_histogram_timeseries_bucket_values_spec.rb +40 -0
  158. data/spec/models/real_time_histogram_timeseries_datapoint_spec.rb +70 -0
  159. data/spec/models/real_time_timeseries_datapoint_spec.rb +46 -0
  160. data/spec/models/track_spec.rb +4 -0
  161. data/spec/models/video_view_spec.rb +12 -0
  162. metadata +200 -60
@@ -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
@@ -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 GetAssetOrLiveStreamIdResponse
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' => :'GetAssetOrLiveStreamIdResponseData'
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