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.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +4 -1
- data/docs/Asset.md +15 -12
- data/docs/AssetErrors.md +2 -2
- data/docs/AssetNonStandardInputReasons.md +16 -0
- data/docs/AssetRecordingTimes.md +9 -0
- data/docs/AssetStaticRenditions.md +1 -1
- data/docs/AssetsApi.md +4 -0
- data/docs/CreateAssetRequest.md +6 -6
- data/docs/CreateLiveStreamRequest.md +1 -0
- data/docs/CreateTrackRequest.md +4 -4
- data/docs/DimensionValue.md +9 -0
- data/docs/DimensionsApi.md +118 -0
- data/docs/DisableLiveStreamResponse.md +8 -0
- data/docs/EnableLiveStreamResponse.md +8 -0
- data/docs/FiltersApi.md +2 -2
- data/docs/GetAssetOrLiveStreamIdResponse.md +8 -0
- data/docs/GetAssetOrLiveStreamIdResponseData.md +10 -0
- data/docs/GetAssetOrLiveStreamIdResponseDataObject.md +9 -0
- data/docs/GetRealTimeBreakdownResponse.md +10 -0
- data/docs/GetRealTimeHistogramTimeseriesResponse.md +11 -0
- data/docs/GetRealTimeHistogramTimeseriesResponseMeta.md +8 -0
- data/docs/GetRealTimeTimeseriesResponse.md +10 -0
- data/docs/Incident.md +28 -0
- data/docs/IncidentBreakdown.md +10 -0
- data/docs/IncidentNotification.md +10 -0
- data/docs/IncidentNotificationRule.md +12 -0
- data/docs/IncidentResponse.md +9 -0
- data/docs/IncidentsApi.md +186 -0
- data/docs/InputSettings.md +9 -7
- data/docs/InputSettingsOverlaySettings.md +7 -7
- data/docs/ListDimensionValuesResponse.md +10 -0
- data/docs/ListDimensionsResponse.md +10 -0
- data/docs/ListIncidentsResponse.md +10 -0
- data/docs/ListRealTimeDimensionsResponse.md +10 -0
- data/docs/ListRealTimeDimensionsResponseData.md +9 -0
- data/docs/ListRealTimeMetricsResponse.md +10 -0
- data/docs/ListRelatedIncidentsResponse.md +10 -0
- data/docs/LiveStream.md +1 -1
- data/docs/LiveStreamsApi.md +104 -0
- data/docs/NotificationRule.md +10 -0
- data/docs/PlaybackID.md +1 -1
- data/docs/PlaybackIDApi.md +60 -0
- data/docs/RealTimeApi.md +280 -0
- data/docs/RealTimeBreakdownValue.md +12 -0
- data/docs/RealTimeHistogramTimeseriesBucket.md +9 -0
- data/docs/RealTimeHistogramTimeseriesBucketValues.md +9 -0
- data/docs/RealTimeHistogramTimeseriesDatapoint.md +14 -0
- data/docs/RealTimeTimeseriesDatapoint.md +10 -0
- data/docs/Track.md +13 -13
- data/docs/VideoView.md +16 -14
- data/examples/data/exercise-dimensions.rb +29 -0
- data/examples/data/exercise-incidents.rb +29 -0
- data/examples/data/exercise-realtime.rb +60 -0
- data/examples/video/exercise-assets.rb +21 -0
- data/examples/video/exercise-live-streams.rb +30 -0
- data/lib/mux_ruby.rb +34 -0
- data/lib/mux_ruby/api/assets_api.rb +4 -0
- data/lib/mux_ruby/api/dimensions_api.rb +128 -0
- data/lib/mux_ruby/api/filters_api.rb +4 -4
- data/lib/mux_ruby/api/incidents_api.rb +217 -0
- data/lib/mux_ruby/api/live_streams_api.rb +106 -0
- data/lib/mux_ruby/api/playback_id_api.rb +69 -0
- data/lib/mux_ruby/api/real_time_api.rb +311 -0
- data/lib/mux_ruby/api_client.rb +13 -13
- data/lib/mux_ruby/configuration.rb +1 -4
- data/lib/mux_ruby/models/asset.rb +70 -3
- data/lib/mux_ruby/models/asset_errors.rb +2 -0
- data/lib/mux_ruby/models/asset_master.rb +35 -0
- 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.rb +2 -2
- data/lib/mux_ruby/models/asset_static_renditions_files.rb +6 -6
- data/lib/mux_ruby/models/create_asset_request.rb +8 -2
- data/lib/mux_ruby/models/create_live_stream_request.rb +15 -4
- data/lib/mux_ruby/models/create_track_request.rb +6 -2
- data/lib/mux_ruby/models/dimension_value.rb +193 -0
- 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/get_asset_or_live_stream_id_response.rb +184 -0
- data/lib/mux_ruby/models/get_asset_or_live_stream_id_response_data.rb +203 -0
- data/lib/mux_ruby/models/get_asset_or_live_stream_id_response_data_object.rb +230 -0
- data/lib/mux_ruby/models/get_real_time_breakdown_response.rb +206 -0
- data/lib/mux_ruby/models/get_real_time_histogram_timeseries_response.rb +215 -0
- data/lib/mux_ruby/models/get_real_time_histogram_timeseries_response_meta.rb +186 -0
- data/lib/mux_ruby/models/get_real_time_timeseries_response.rb +206 -0
- data/lib/mux_ruby/models/incident.rb +370 -0
- data/lib/mux_ruby/models/incident_breakdown.rb +202 -0
- data/lib/mux_ruby/models/incident_notification.rb +202 -0
- data/lib/mux_ruby/models/incident_notification_rule.rb +222 -0
- data/lib/mux_ruby/models/incident_response.rb +195 -0
- data/lib/mux_ruby/models/input_settings.rb +31 -4
- data/lib/mux_ruby/models/input_settings_overlay_settings.rb +10 -2
- data/lib/mux_ruby/models/list_dimension_values_response.rb +206 -0
- data/lib/mux_ruby/models/list_dimensions_response.rb +204 -0
- data/lib/mux_ruby/models/list_incidents_response.rb +206 -0
- data/lib/mux_ruby/models/list_real_time_dimensions_response.rb +206 -0
- data/lib/mux_ruby/models/list_real_time_dimensions_response_data.rb +193 -0
- data/lib/mux_ruby/models/list_real_time_metrics_response.rb +206 -0
- data/lib/mux_ruby/models/list_related_incidents_response.rb +206 -0
- data/lib/mux_ruby/models/live_stream.rb +1 -1
- data/lib/mux_ruby/models/notification_rule.rb +202 -0
- data/lib/mux_ruby/models/playback_id.rb +1 -0
- data/lib/mux_ruby/models/real_time_breakdown_value.rb +220 -0
- data/lib/mux_ruby/models/real_time_histogram_timeseries_bucket.rb +193 -0
- data/lib/mux_ruby/models/real_time_histogram_timeseries_bucket_values.rb +193 -0
- data/lib/mux_ruby/models/real_time_histogram_timeseries_datapoint.rb +240 -0
- data/lib/mux_ruby/models/real_time_timeseries_datapoint.rb +202 -0
- data/lib/mux_ruby/models/simulcast_target.rb +1 -1
- data/lib/mux_ruby/models/track.rb +27 -2
- data/lib/mux_ruby/models/update_asset_master_access_request.rb +1 -1
- data/lib/mux_ruby/models/update_asset_mp4_support_request.rb +1 -1
- data/lib/mux_ruby/models/upload.rb +1 -1
- data/lib/mux_ruby/models/video_view.rb +36 -18
- data/lib/mux_ruby/version.rb +1 -1
- data/mux_ruby.gemspec +2 -0
- data/spec/api/assets_api_spec.rb +2 -0
- data/spec/api/dimensions_api_spec.rb +55 -0
- data/spec/api/filters_api_spec.rb +2 -2
- data/spec/api/incidents_api_spec.rb +73 -0
- data/spec/api/live_streams_api_spec.rb +24 -0
- data/spec/api/playback_id_api_spec.rb +40 -0
- data/spec/api/real_time_api_spec.rb +93 -0
- data/spec/models/asset_master_spec.rb +4 -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 +26 -0
- data/spec/models/asset_static_renditions_files_spec.rb +2 -2
- data/spec/models/create_live_stream_request_spec.rb +6 -0
- data/spec/models/dimension_value_spec.rb +40 -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/get_asset_or_live_stream_id_response_data_object_spec.rb +44 -0
- data/spec/models/get_asset_or_live_stream_id_response_data_spec.rb +46 -0
- data/spec/models/get_asset_or_live_stream_id_response_spec.rb +34 -0
- data/spec/models/get_real_time_breakdown_response_spec.rb +46 -0
- data/spec/models/get_real_time_histogram_timeseries_response_meta_spec.rb +34 -0
- data/spec/models/get_real_time_histogram_timeseries_response_spec.rb +52 -0
- data/spec/models/get_real_time_timeseries_response_spec.rb +46 -0
- data/spec/models/incident_breakdown_spec.rb +46 -0
- data/spec/models/incident_notification_rule_spec.rb +58 -0
- data/spec/models/incident_notification_spec.rb +46 -0
- data/spec/models/incident_response_spec.rb +40 -0
- data/spec/models/incident_spec.rb +154 -0
- data/spec/models/input_settings_spec.rb +12 -0
- data/spec/models/list_dimension_values_response_spec.rb +46 -0
- data/spec/models/list_dimensions_response_spec.rb +46 -0
- data/spec/models/list_incidents_response_spec.rb +46 -0
- data/spec/models/list_real_time_dimensions_response_data_spec.rb +40 -0
- data/spec/models/list_real_time_dimensions_response_spec.rb +46 -0
- data/spec/models/list_real_time_metrics_response_spec.rb +46 -0
- data/spec/models/list_related_incidents_response_spec.rb +46 -0
- data/spec/models/notification_rule_spec.rb +46 -0
- data/spec/models/real_time_breakdown_value_spec.rb +58 -0
- data/spec/models/real_time_histogram_timeseries_bucket_spec.rb +40 -0
- data/spec/models/real_time_histogram_timeseries_bucket_values_spec.rb +40 -0
- data/spec/models/real_time_histogram_timeseries_datapoint_spec.rb +70 -0
- data/spec/models/real_time_timeseries_datapoint_spec.rb +46 -0
- data/spec/models/track_spec.rb +4 -0
- data/spec/models/video_view_spec.rb +12 -0
- metadata +200 -60
@@ -0,0 +1,202 @@
|
|
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 IncidentNotification
|
10
|
+
attr_accessor :queued_at
|
11
|
+
|
12
|
+
attr_accessor :id
|
13
|
+
|
14
|
+
attr_accessor :attempted_at
|
15
|
+
|
16
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
17
|
+
def self.attribute_map
|
18
|
+
{
|
19
|
+
:'queued_at' => :'queued_at',
|
20
|
+
:'id' => :'id',
|
21
|
+
:'attempted_at' => :'attempted_at'
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
# Attribute type mapping.
|
26
|
+
def self.openapi_types
|
27
|
+
{
|
28
|
+
:'queued_at' => :'String',
|
29
|
+
:'id' => :'Integer',
|
30
|
+
:'attempted_at' => :'String'
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
# Initializes the object
|
35
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
36
|
+
def initialize(attributes = {})
|
37
|
+
return unless attributes.is_a?(Hash)
|
38
|
+
|
39
|
+
# convert string to symbol for hash key
|
40
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
41
|
+
|
42
|
+
if attributes.has_key?(:'queued_at')
|
43
|
+
self.queued_at = attributes[:'queued_at']
|
44
|
+
end
|
45
|
+
|
46
|
+
if attributes.has_key?(:'id')
|
47
|
+
self.id = attributes[:'id']
|
48
|
+
end
|
49
|
+
|
50
|
+
if attributes.has_key?(:'attempted_at')
|
51
|
+
self.attempted_at = attributes[:'attempted_at']
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
56
|
+
# @return Array for valid properties with the reasons
|
57
|
+
def list_invalid_properties
|
58
|
+
invalid_properties = Array.new
|
59
|
+
invalid_properties
|
60
|
+
end
|
61
|
+
|
62
|
+
# Check to see if the all the properties in the model are valid
|
63
|
+
# @return true if the model is valid
|
64
|
+
def valid?
|
65
|
+
true
|
66
|
+
end
|
67
|
+
|
68
|
+
# Checks equality by comparing each attribute.
|
69
|
+
# @param [Object] Object to be compared
|
70
|
+
def ==(o)
|
71
|
+
return true if self.equal?(o)
|
72
|
+
self.class == o.class &&
|
73
|
+
queued_at == o.queued_at &&
|
74
|
+
id == o.id &&
|
75
|
+
attempted_at == o.attempted_at
|
76
|
+
end
|
77
|
+
|
78
|
+
# @see the `==` method
|
79
|
+
# @param [Object] Object to be compared
|
80
|
+
def eql?(o)
|
81
|
+
self == o
|
82
|
+
end
|
83
|
+
|
84
|
+
# Calculates hash code according to all attributes.
|
85
|
+
# @return [Fixnum] Hash code
|
86
|
+
def hash
|
87
|
+
[queued_at, id, attempted_at].hash
|
88
|
+
end
|
89
|
+
|
90
|
+
# Builds the object from hash
|
91
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
92
|
+
# @return [Object] Returns the model itself
|
93
|
+
def self.build_from_hash(attributes)
|
94
|
+
new.build_from_hash(attributes)
|
95
|
+
end
|
96
|
+
|
97
|
+
# Builds the object from hash
|
98
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
99
|
+
# @return [Object] Returns the model itself
|
100
|
+
def build_from_hash(attributes)
|
101
|
+
return nil unless attributes.is_a?(Hash)
|
102
|
+
self.class.openapi_types.each_pair do |key, type|
|
103
|
+
if type =~ /\AArray<(.*)>/i
|
104
|
+
# check to ensure the input is an array given that the attribute
|
105
|
+
# is documented as an array but the input is not
|
106
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
107
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
108
|
+
end
|
109
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
110
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
111
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
112
|
+
end
|
113
|
+
|
114
|
+
self
|
115
|
+
end
|
116
|
+
|
117
|
+
# Deserializes the data based on type
|
118
|
+
# @param string type Data type
|
119
|
+
# @param string value Value to be deserialized
|
120
|
+
# @return [Object] Deserialized data
|
121
|
+
def _deserialize(type, value)
|
122
|
+
case type.to_sym
|
123
|
+
when :DateTime
|
124
|
+
DateTime.parse(value)
|
125
|
+
when :Date
|
126
|
+
Date.parse(value)
|
127
|
+
when :String
|
128
|
+
value.to_s
|
129
|
+
when :Integer
|
130
|
+
value.to_i
|
131
|
+
when :Float
|
132
|
+
value.to_f
|
133
|
+
when :BOOLEAN
|
134
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
135
|
+
true
|
136
|
+
else
|
137
|
+
false
|
138
|
+
end
|
139
|
+
when :Object
|
140
|
+
# generic object (usually a Hash), return directly
|
141
|
+
value
|
142
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
143
|
+
inner_type = Regexp.last_match[:inner_type]
|
144
|
+
value.map { |v| _deserialize(inner_type, v) }
|
145
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
146
|
+
k_type = Regexp.last_match[:k_type]
|
147
|
+
v_type = Regexp.last_match[:v_type]
|
148
|
+
{}.tap do |hash|
|
149
|
+
value.each do |k, v|
|
150
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
151
|
+
end
|
152
|
+
end
|
153
|
+
else # model
|
154
|
+
MuxRuby.const_get(type).build_from_hash(value)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
# Returns the string representation of the object
|
159
|
+
# @return [String] String presentation of the object
|
160
|
+
def to_s
|
161
|
+
to_hash.to_s
|
162
|
+
end
|
163
|
+
|
164
|
+
# to_body is an alias to to_hash (backward compatibility)
|
165
|
+
# @return [Hash] Returns the object in the form of hash
|
166
|
+
def to_body
|
167
|
+
to_hash
|
168
|
+
end
|
169
|
+
|
170
|
+
# Returns the object in the form of hash
|
171
|
+
# @return [Hash] Returns the object in the form of hash
|
172
|
+
def to_hash
|
173
|
+
hash = {}
|
174
|
+
self.class.attribute_map.each_pair do |attr, param|
|
175
|
+
value = self.send(attr)
|
176
|
+
next if value.nil?
|
177
|
+
hash[param] = _to_hash(value)
|
178
|
+
end
|
179
|
+
hash
|
180
|
+
end
|
181
|
+
|
182
|
+
# Outputs non-array value in the form of hash
|
183
|
+
# For object, use to_hash. Otherwise, just return the value
|
184
|
+
# @param [Object] value Any valid value
|
185
|
+
# @return [Hash] Returns the value in the form of hash
|
186
|
+
def _to_hash(value)
|
187
|
+
if value.is_a?(Array)
|
188
|
+
value.compact.map { |v| _to_hash(v) }
|
189
|
+
elsif value.is_a?(Hash)
|
190
|
+
{}.tap do |hash|
|
191
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
192
|
+
end
|
193
|
+
elsif value.respond_to? :to_hash
|
194
|
+
value.to_hash
|
195
|
+
else
|
196
|
+
value
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
end
|
201
|
+
|
202
|
+
end
|
@@ -0,0 +1,222 @@
|
|
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 IncidentNotificationRule
|
10
|
+
attr_accessor :status
|
11
|
+
|
12
|
+
attr_accessor :rules
|
13
|
+
|
14
|
+
attr_accessor :property_id
|
15
|
+
|
16
|
+
attr_accessor :id
|
17
|
+
|
18
|
+
attr_accessor :action
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
:'status' => :'status',
|
24
|
+
:'rules' => :'rules',
|
25
|
+
:'property_id' => :'property_id',
|
26
|
+
:'id' => :'id',
|
27
|
+
:'action' => :'action'
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
# Attribute type mapping.
|
32
|
+
def self.openapi_types
|
33
|
+
{
|
34
|
+
:'status' => :'String',
|
35
|
+
:'rules' => :'Array<NotificationRule>',
|
36
|
+
:'property_id' => :'String',
|
37
|
+
:'id' => :'String',
|
38
|
+
:'action' => :'String'
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
# Initializes the object
|
43
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
44
|
+
def initialize(attributes = {})
|
45
|
+
return unless attributes.is_a?(Hash)
|
46
|
+
|
47
|
+
# convert string to symbol for hash key
|
48
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
49
|
+
|
50
|
+
if attributes.has_key?(:'status')
|
51
|
+
self.status = attributes[:'status']
|
52
|
+
end
|
53
|
+
|
54
|
+
if attributes.has_key?(:'rules')
|
55
|
+
if (value = attributes[:'rules']).is_a?(Array)
|
56
|
+
self.rules = value
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
if attributes.has_key?(:'property_id')
|
61
|
+
self.property_id = attributes[:'property_id']
|
62
|
+
end
|
63
|
+
|
64
|
+
if attributes.has_key?(:'id')
|
65
|
+
self.id = attributes[:'id']
|
66
|
+
end
|
67
|
+
|
68
|
+
if attributes.has_key?(:'action')
|
69
|
+
self.action = attributes[:'action']
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
74
|
+
# @return Array for valid properties with the reasons
|
75
|
+
def list_invalid_properties
|
76
|
+
invalid_properties = Array.new
|
77
|
+
invalid_properties
|
78
|
+
end
|
79
|
+
|
80
|
+
# Check to see if the all the properties in the model are valid
|
81
|
+
# @return true if the model is valid
|
82
|
+
def valid?
|
83
|
+
true
|
84
|
+
end
|
85
|
+
|
86
|
+
# Checks equality by comparing each attribute.
|
87
|
+
# @param [Object] Object to be compared
|
88
|
+
def ==(o)
|
89
|
+
return true if self.equal?(o)
|
90
|
+
self.class == o.class &&
|
91
|
+
status == o.status &&
|
92
|
+
rules == o.rules &&
|
93
|
+
property_id == o.property_id &&
|
94
|
+
id == o.id &&
|
95
|
+
action == o.action
|
96
|
+
end
|
97
|
+
|
98
|
+
# @see the `==` method
|
99
|
+
# @param [Object] Object to be compared
|
100
|
+
def eql?(o)
|
101
|
+
self == o
|
102
|
+
end
|
103
|
+
|
104
|
+
# Calculates hash code according to all attributes.
|
105
|
+
# @return [Fixnum] Hash code
|
106
|
+
def hash
|
107
|
+
[status, rules, property_id, id, action].hash
|
108
|
+
end
|
109
|
+
|
110
|
+
# Builds the object from hash
|
111
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
112
|
+
# @return [Object] Returns the model itself
|
113
|
+
def self.build_from_hash(attributes)
|
114
|
+
new.build_from_hash(attributes)
|
115
|
+
end
|
116
|
+
|
117
|
+
# Builds the object from hash
|
118
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
119
|
+
# @return [Object] Returns the model itself
|
120
|
+
def build_from_hash(attributes)
|
121
|
+
return nil unless attributes.is_a?(Hash)
|
122
|
+
self.class.openapi_types.each_pair do |key, type|
|
123
|
+
if type =~ /\AArray<(.*)>/i
|
124
|
+
# check to ensure the input is an array given that the attribute
|
125
|
+
# is documented as an array but the input is not
|
126
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
127
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
128
|
+
end
|
129
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
130
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
131
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
132
|
+
end
|
133
|
+
|
134
|
+
self
|
135
|
+
end
|
136
|
+
|
137
|
+
# Deserializes the data based on type
|
138
|
+
# @param string type Data type
|
139
|
+
# @param string value Value to be deserialized
|
140
|
+
# @return [Object] Deserialized data
|
141
|
+
def _deserialize(type, value)
|
142
|
+
case type.to_sym
|
143
|
+
when :DateTime
|
144
|
+
DateTime.parse(value)
|
145
|
+
when :Date
|
146
|
+
Date.parse(value)
|
147
|
+
when :String
|
148
|
+
value.to_s
|
149
|
+
when :Integer
|
150
|
+
value.to_i
|
151
|
+
when :Float
|
152
|
+
value.to_f
|
153
|
+
when :BOOLEAN
|
154
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
155
|
+
true
|
156
|
+
else
|
157
|
+
false
|
158
|
+
end
|
159
|
+
when :Object
|
160
|
+
# generic object (usually a Hash), return directly
|
161
|
+
value
|
162
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
163
|
+
inner_type = Regexp.last_match[:inner_type]
|
164
|
+
value.map { |v| _deserialize(inner_type, v) }
|
165
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
166
|
+
k_type = Regexp.last_match[:k_type]
|
167
|
+
v_type = Regexp.last_match[:v_type]
|
168
|
+
{}.tap do |hash|
|
169
|
+
value.each do |k, v|
|
170
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
171
|
+
end
|
172
|
+
end
|
173
|
+
else # model
|
174
|
+
MuxRuby.const_get(type).build_from_hash(value)
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
# Returns the string representation of the object
|
179
|
+
# @return [String] String presentation of the object
|
180
|
+
def to_s
|
181
|
+
to_hash.to_s
|
182
|
+
end
|
183
|
+
|
184
|
+
# to_body is an alias to to_hash (backward compatibility)
|
185
|
+
# @return [Hash] Returns the object in the form of hash
|
186
|
+
def to_body
|
187
|
+
to_hash
|
188
|
+
end
|
189
|
+
|
190
|
+
# Returns the object in the form of hash
|
191
|
+
# @return [Hash] Returns the object in the form of hash
|
192
|
+
def to_hash
|
193
|
+
hash = {}
|
194
|
+
self.class.attribute_map.each_pair do |attr, param|
|
195
|
+
value = self.send(attr)
|
196
|
+
next if value.nil?
|
197
|
+
hash[param] = _to_hash(value)
|
198
|
+
end
|
199
|
+
hash
|
200
|
+
end
|
201
|
+
|
202
|
+
# Outputs non-array value in the form of hash
|
203
|
+
# For object, use to_hash. Otherwise, just return the value
|
204
|
+
# @param [Object] value Any valid value
|
205
|
+
# @return [Hash] Returns the value in the form of hash
|
206
|
+
def _to_hash(value)
|
207
|
+
if value.is_a?(Array)
|
208
|
+
value.compact.map { |v| _to_hash(v) }
|
209
|
+
elsif value.is_a?(Hash)
|
210
|
+
{}.tap do |hash|
|
211
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
212
|
+
end
|
213
|
+
elsif value.respond_to? :to_hash
|
214
|
+
value.to_hash
|
215
|
+
else
|
216
|
+
value
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
end
|
221
|
+
|
222
|
+
end
|
@@ -0,0 +1,195 @@
|
|
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 IncidentResponse
|
10
|
+
attr_accessor :data
|
11
|
+
|
12
|
+
attr_accessor :timeframe
|
13
|
+
|
14
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
15
|
+
def self.attribute_map
|
16
|
+
{
|
17
|
+
:'data' => :'data',
|
18
|
+
:'timeframe' => :'timeframe'
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
# Attribute type mapping.
|
23
|
+
def self.openapi_types
|
24
|
+
{
|
25
|
+
:'data' => :'Incident',
|
26
|
+
:'timeframe' => :'Array<Integer>'
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
# Initializes the object
|
31
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
32
|
+
def initialize(attributes = {})
|
33
|
+
return unless attributes.is_a?(Hash)
|
34
|
+
|
35
|
+
# convert string to symbol for hash key
|
36
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
37
|
+
|
38
|
+
if attributes.has_key?(:'data')
|
39
|
+
self.data = attributes[:'data']
|
40
|
+
end
|
41
|
+
|
42
|
+
if attributes.has_key?(:'timeframe')
|
43
|
+
if (value = attributes[:'timeframe']).is_a?(Array)
|
44
|
+
self.timeframe = value
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
50
|
+
# @return Array for valid properties with the reasons
|
51
|
+
def list_invalid_properties
|
52
|
+
invalid_properties = Array.new
|
53
|
+
invalid_properties
|
54
|
+
end
|
55
|
+
|
56
|
+
# Check to see if the all the properties in the model are valid
|
57
|
+
# @return true if the model is valid
|
58
|
+
def valid?
|
59
|
+
true
|
60
|
+
end
|
61
|
+
|
62
|
+
# Checks equality by comparing each attribute.
|
63
|
+
# @param [Object] Object to be compared
|
64
|
+
def ==(o)
|
65
|
+
return true if self.equal?(o)
|
66
|
+
self.class == o.class &&
|
67
|
+
data == o.data &&
|
68
|
+
timeframe == o.timeframe
|
69
|
+
end
|
70
|
+
|
71
|
+
# @see the `==` method
|
72
|
+
# @param [Object] Object to be compared
|
73
|
+
def eql?(o)
|
74
|
+
self == o
|
75
|
+
end
|
76
|
+
|
77
|
+
# Calculates hash code according to all attributes.
|
78
|
+
# @return [Fixnum] Hash code
|
79
|
+
def hash
|
80
|
+
[data, timeframe].hash
|
81
|
+
end
|
82
|
+
|
83
|
+
# Builds the object from hash
|
84
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
85
|
+
# @return [Object] Returns the model itself
|
86
|
+
def self.build_from_hash(attributes)
|
87
|
+
new.build_from_hash(attributes)
|
88
|
+
end
|
89
|
+
|
90
|
+
# Builds the object from hash
|
91
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
92
|
+
# @return [Object] Returns the model itself
|
93
|
+
def build_from_hash(attributes)
|
94
|
+
return nil unless attributes.is_a?(Hash)
|
95
|
+
self.class.openapi_types.each_pair do |key, type|
|
96
|
+
if type =~ /\AArray<(.*)>/i
|
97
|
+
# check to ensure the input is an array given that the attribute
|
98
|
+
# is documented as an array but the input is not
|
99
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
100
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
101
|
+
end
|
102
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
103
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
104
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
105
|
+
end
|
106
|
+
|
107
|
+
self
|
108
|
+
end
|
109
|
+
|
110
|
+
# Deserializes the data based on type
|
111
|
+
# @param string type Data type
|
112
|
+
# @param string value Value to be deserialized
|
113
|
+
# @return [Object] Deserialized data
|
114
|
+
def _deserialize(type, value)
|
115
|
+
case type.to_sym
|
116
|
+
when :DateTime
|
117
|
+
DateTime.parse(value)
|
118
|
+
when :Date
|
119
|
+
Date.parse(value)
|
120
|
+
when :String
|
121
|
+
value.to_s
|
122
|
+
when :Integer
|
123
|
+
value.to_i
|
124
|
+
when :Float
|
125
|
+
value.to_f
|
126
|
+
when :BOOLEAN
|
127
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
128
|
+
true
|
129
|
+
else
|
130
|
+
false
|
131
|
+
end
|
132
|
+
when :Object
|
133
|
+
# generic object (usually a Hash), return directly
|
134
|
+
value
|
135
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
136
|
+
inner_type = Regexp.last_match[:inner_type]
|
137
|
+
value.map { |v| _deserialize(inner_type, v) }
|
138
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
139
|
+
k_type = Regexp.last_match[:k_type]
|
140
|
+
v_type = Regexp.last_match[:v_type]
|
141
|
+
{}.tap do |hash|
|
142
|
+
value.each do |k, v|
|
143
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
else # model
|
147
|
+
MuxRuby.const_get(type).build_from_hash(value)
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
# Returns the string representation of the object
|
152
|
+
# @return [String] String presentation of the object
|
153
|
+
def to_s
|
154
|
+
to_hash.to_s
|
155
|
+
end
|
156
|
+
|
157
|
+
# to_body is an alias to to_hash (backward compatibility)
|
158
|
+
# @return [Hash] Returns the object in the form of hash
|
159
|
+
def to_body
|
160
|
+
to_hash
|
161
|
+
end
|
162
|
+
|
163
|
+
# Returns the object in the form of hash
|
164
|
+
# @return [Hash] Returns the object in the form of hash
|
165
|
+
def to_hash
|
166
|
+
hash = {}
|
167
|
+
self.class.attribute_map.each_pair do |attr, param|
|
168
|
+
value = self.send(attr)
|
169
|
+
next if value.nil?
|
170
|
+
hash[param] = _to_hash(value)
|
171
|
+
end
|
172
|
+
hash
|
173
|
+
end
|
174
|
+
|
175
|
+
# Outputs non-array value in the form of hash
|
176
|
+
# For object, use to_hash. Otherwise, just return the value
|
177
|
+
# @param [Object] value Any valid value
|
178
|
+
# @return [Hash] Returns the value in the form of hash
|
179
|
+
def _to_hash(value)
|
180
|
+
if value.is_a?(Array)
|
181
|
+
value.compact.map { |v| _to_hash(v) }
|
182
|
+
elsif value.is_a?(Hash)
|
183
|
+
{}.tap do |hash|
|
184
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
185
|
+
end
|
186
|
+
elsif value.respond_to? :to_hash
|
187
|
+
value.to_hash
|
188
|
+
else
|
189
|
+
value
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
end
|
194
|
+
|
195
|
+
end
|