mux_ruby 1.4.0 → 1.8.1

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