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
@@ -6,22 +6,35 @@
6
6
  require 'date'
7
7
 
8
8
  module MuxRuby
9
- # Input object with additional configuration
9
+ # An array of objects that each describe an input file to be used to create the asset. As a shortcut, `input` can also be a string URL for a file when only one input file is used. See `input[].url` for requirements.
10
10
  class InputSettings
11
+ # The web address of the file that Mux should download and use. * For subtitles text tracks, the url is the location of subtitle/captions file. Mux supports [SubRip Text (SRT)](https://en.wikipedia.org/wiki/SubRip) and [Web Video Text Tracks](https://www.w3.org/TR/webvtt1/) format for ingesting Subtitles and Closed Captions. * For Watermarking or Overlay, the url is the location of the watermark image. * When creating clips from existing Mux assets, the url is defined with `mux://assets/{asset_id}` template where `asset_id` is the Asset Identifier for creating the clip from.
11
12
  attr_accessor :url
12
13
 
13
14
  attr_accessor :overlay_settings
14
15
 
16
+ # The time offset in seconds from the beginning of the video indicating the clip's starting marker. The default value is 0 when not included.
17
+ attr_accessor :start_time
18
+
19
+ # The time offset in seconds from the beginning of the video, indicating the clip's ending marker. The default value is the duration of the video when not included.
20
+ attr_accessor :end_time
21
+
22
+ # This parameter is required for the `text` track type.
15
23
  attr_accessor :type
16
24
 
25
+ # Type of text track. This parameter only supports subtitles value. For more information on Subtitles / Closed Captions, [see this blog post](https://mux.com/blog/subtitles-captions-webvtt-hls-and-those-magic-flags/). This parameter is required for `text` track type.
17
26
  attr_accessor :text_type
18
27
 
28
+ # The language code value must be a valid [BCP 47](https://tools.ietf.org/html/bcp47) specification compliant value. For example, en for English or en-US for the US version of English. This parameter is required for text type and subtitles text type track.
19
29
  attr_accessor :language_code
20
30
 
31
+ # The name of the track containing a human-readable description. This value must be unique across all text type and subtitles `text` type tracks. The hls manifest will associate a subtitle text track with this value. For example, the value should be \"English\" for subtitles text track with language_code as en. This optional parameter should be used only for `text` type and subtitles `text` type track. If this parameter is not included, Mux will auto-populate based on the `input[].language_code` value.
21
32
  attr_accessor :name
22
33
 
34
+ # Indicates the track provides Subtitles for the Deaf or Hard-of-hearing (SDH). This optional parameter should be used for `text` type and subtitles `text` type tracks.
23
35
  attr_accessor :closed_captions
24
36
 
37
+ # This optional parameter should be used for `text` type and subtitles `text` type tracks.
25
38
  attr_accessor :passthrough
26
39
 
27
40
  class EnumAttributeValidator
@@ -51,6 +64,8 @@ module MuxRuby
51
64
  {
52
65
  :'url' => :'url',
53
66
  :'overlay_settings' => :'overlay_settings',
67
+ :'start_time' => :'start_time',
68
+ :'end_time' => :'end_time',
54
69
  :'type' => :'type',
55
70
  :'text_type' => :'text_type',
56
71
  :'language_code' => :'language_code',
@@ -65,6 +80,8 @@ module MuxRuby
65
80
  {
66
81
  :'url' => :'String',
67
82
  :'overlay_settings' => :'InputSettingsOverlaySettings',
83
+ :'start_time' => :'Float',
84
+ :'end_time' => :'Float',
68
85
  :'type' => :'String',
69
86
  :'text_type' => :'String',
70
87
  :'language_code' => :'String',
@@ -90,6 +107,14 @@ module MuxRuby
90
107
  self.overlay_settings = attributes[:'overlay_settings']
91
108
  end
92
109
 
110
+ if attributes.has_key?(:'start_time')
111
+ self.start_time = attributes[:'start_time']
112
+ end
113
+
114
+ if attributes.has_key?(:'end_time')
115
+ self.end_time = attributes[:'end_time']
116
+ end
117
+
93
118
  if attributes.has_key?(:'type')
94
119
  self.type = attributes[:'type']
95
120
  end
@@ -137,7 +162,7 @@ module MuxRuby
137
162
  def type=(type)
138
163
  validator = EnumAttributeValidator.new('String', ['video', 'audio', 'text'])
139
164
  unless validator.valid?(type)
140
- fail ArgumentError, 'invalid value for "type", must be one of #{validator.allowable_values}.'
165
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
141
166
  end
142
167
  @type = type
143
168
  end
@@ -147,7 +172,7 @@ module MuxRuby
147
172
  def text_type=(text_type)
148
173
  validator = EnumAttributeValidator.new('String', ['subtitles'])
149
174
  unless validator.valid?(text_type)
150
- fail ArgumentError, 'invalid value for "text_type", must be one of #{validator.allowable_values}.'
175
+ fail ArgumentError, "invalid value for \"text_type\", must be one of #{validator.allowable_values}."
151
176
  end
152
177
  @text_type = text_type
153
178
  end
@@ -159,6 +184,8 @@ module MuxRuby
159
184
  self.class == o.class &&
160
185
  url == o.url &&
161
186
  overlay_settings == o.overlay_settings &&
187
+ start_time == o.start_time &&
188
+ end_time == o.end_time &&
162
189
  type == o.type &&
163
190
  text_type == o.text_type &&
164
191
  language_code == o.language_code &&
@@ -176,7 +203,7 @@ module MuxRuby
176
203
  # Calculates hash code according to all attributes.
177
204
  # @return [Fixnum] Hash code
178
205
  def hash
179
- [url, overlay_settings, type, text_type, language_code, name, closed_captions, passthrough].hash
206
+ [url, overlay_settings, start_time, end_time, type, text_type, language_code, name, closed_captions, passthrough].hash
180
207
  end
181
208
 
182
209
  # Builds the object from hash
@@ -6,19 +6,27 @@
6
6
  require 'date'
7
7
 
8
8
  module MuxRuby
9
+ # An object that describes how the image file referenced in url should be placed over the video (i.e. watermarking).
9
10
  class InputSettingsOverlaySettings
11
+ # Where the vertical positioning of the overlay/watermark should begin from. Defaults to `\"top\"`
10
12
  attr_accessor :vertical_align
11
13
 
14
+ # The distance from the vertical_align starting point and the image's closest edge. Can be expressed as a percent (\"10%\") or as a pixel value (\"100px\"). Negative values will move the overlay offscreen. In the case of 'middle', a positive value will shift the overlay towards the bottom and and a negative value will shift it towards the top.
12
15
  attr_accessor :vertical_margin
13
16
 
17
+ # Where the horizontal positioning of the overlay/watermark should begin from.
14
18
  attr_accessor :horizontal_align
15
19
 
20
+ # The distance from the horizontal_align starting point and the image's closest edge. Can be expressed as a percent (\"10%\") or as a pixel value (\"100px\"). Negative values will move the overlay offscreen. In the case of 'center', a positive value will shift the image towards the right and and a negative value will shift it towards the left.
16
21
  attr_accessor :horizontal_margin
17
22
 
23
+ # How wide the overlay should appear. Can be expressed as a percent (\"10%\") or as a pixel value (\"100px\"). If both width and height are left blank the width will be the true pixels of the image, applied as if the video has been scaled to fit a 1920x1080 frame. If height is supplied with no width, the width will scale proportionally to the height.
18
24
  attr_accessor :width
19
25
 
26
+ # How tall the overlay should appear. Can be expressed as a percent (\"10%\") or as a pixel value (\"100px\"). If both width and height are left blank the height will be the true pixels of the image, applied as if the video has been scaled to fit a 1920x1080 frame. If width is supplied with no height, the height will scale proportionally to the width.
20
27
  attr_accessor :height
21
28
 
29
+ # How opaque the overlay should appear, expressed as a percent. (Default 100%)
22
30
  attr_accessor :opacity
23
31
 
24
32
  class EnumAttributeValidator
@@ -128,7 +136,7 @@ module MuxRuby
128
136
  def vertical_align=(vertical_align)
129
137
  validator = EnumAttributeValidator.new('String', ['top', 'middle', 'bottom'])
130
138
  unless validator.valid?(vertical_align)
131
- fail ArgumentError, 'invalid value for "vertical_align", must be one of #{validator.allowable_values}.'
139
+ fail ArgumentError, "invalid value for \"vertical_align\", must be one of #{validator.allowable_values}."
132
140
  end
133
141
  @vertical_align = vertical_align
134
142
  end
@@ -138,7 +146,7 @@ module MuxRuby
138
146
  def horizontal_align=(horizontal_align)
139
147
  validator = EnumAttributeValidator.new('String', ['left', 'center', 'right'])
140
148
  unless validator.valid?(horizontal_align)
141
- fail ArgumentError, 'invalid value for "horizontal_align", must be one of #{validator.allowable_values}.'
149
+ fail ArgumentError, "invalid value for \"horizontal_align\", must be one of #{validator.allowable_values}."
142
150
  end
143
151
  @horizontal_align = horizontal_align
144
152
  end
@@ -0,0 +1,206 @@
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 ListDimensionValuesResponse
10
+ attr_accessor :data
11
+
12
+ attr_accessor :total_row_count
13
+
14
+ attr_accessor :timeframe
15
+
16
+ # Attribute mapping from ruby-style variable name to JSON key.
17
+ def self.attribute_map
18
+ {
19
+ :'data' => :'data',
20
+ :'total_row_count' => :'total_row_count',
21
+ :'timeframe' => :'timeframe'
22
+ }
23
+ end
24
+
25
+ # Attribute type mapping.
26
+ def self.openapi_types
27
+ {
28
+ :'data' => :'Array<DimensionValue>',
29
+ :'total_row_count' => :'Integer',
30
+ :'timeframe' => :'Array<Integer>'
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?(:'data')
43
+ if (value = attributes[:'data']).is_a?(Array)
44
+ self.data = value
45
+ end
46
+ end
47
+
48
+ if attributes.has_key?(:'total_row_count')
49
+ self.total_row_count = attributes[:'total_row_count']
50
+ end
51
+
52
+ if attributes.has_key?(:'timeframe')
53
+ if (value = attributes[:'timeframe']).is_a?(Array)
54
+ self.timeframe = value
55
+ end
56
+ end
57
+ end
58
+
59
+ # Show invalid properties with the reasons. Usually used together with valid?
60
+ # @return Array for valid properties with the reasons
61
+ def list_invalid_properties
62
+ invalid_properties = Array.new
63
+ invalid_properties
64
+ end
65
+
66
+ # Check to see if the all the properties in the model are valid
67
+ # @return true if the model is valid
68
+ def valid?
69
+ true
70
+ end
71
+
72
+ # Checks equality by comparing each attribute.
73
+ # @param [Object] Object to be compared
74
+ def ==(o)
75
+ return true if self.equal?(o)
76
+ self.class == o.class &&
77
+ data == o.data &&
78
+ total_row_count == o.total_row_count &&
79
+ timeframe == o.timeframe
80
+ end
81
+
82
+ # @see the `==` method
83
+ # @param [Object] Object to be compared
84
+ def eql?(o)
85
+ self == o
86
+ end
87
+
88
+ # Calculates hash code according to all attributes.
89
+ # @return [Fixnum] Hash code
90
+ def hash
91
+ [data, total_row_count, timeframe].hash
92
+ end
93
+
94
+ # Builds the object from hash
95
+ # @param [Hash] attributes Model attributes in the form of hash
96
+ # @return [Object] Returns the model itself
97
+ def self.build_from_hash(attributes)
98
+ new.build_from_hash(attributes)
99
+ end
100
+
101
+ # Builds the object from hash
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ # @return [Object] Returns the model itself
104
+ def build_from_hash(attributes)
105
+ return nil unless attributes.is_a?(Hash)
106
+ self.class.openapi_types.each_pair do |key, type|
107
+ if type =~ /\AArray<(.*)>/i
108
+ # check to ensure the input is an array given that the attribute
109
+ # is documented as an array but the input is not
110
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
111
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
112
+ end
113
+ elsif !attributes[self.class.attribute_map[key]].nil?
114
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
115
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
116
+ end
117
+
118
+ self
119
+ end
120
+
121
+ # Deserializes the data based on type
122
+ # @param string type Data type
123
+ # @param string value Value to be deserialized
124
+ # @return [Object] Deserialized data
125
+ def _deserialize(type, value)
126
+ case type.to_sym
127
+ when :DateTime
128
+ DateTime.parse(value)
129
+ when :Date
130
+ Date.parse(value)
131
+ when :String
132
+ value.to_s
133
+ when :Integer
134
+ value.to_i
135
+ when :Float
136
+ value.to_f
137
+ when :BOOLEAN
138
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
139
+ true
140
+ else
141
+ false
142
+ end
143
+ when :Object
144
+ # generic object (usually a Hash), return directly
145
+ value
146
+ when /\AArray<(?<inner_type>.+)>\z/
147
+ inner_type = Regexp.last_match[:inner_type]
148
+ value.map { |v| _deserialize(inner_type, v) }
149
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
150
+ k_type = Regexp.last_match[:k_type]
151
+ v_type = Regexp.last_match[:v_type]
152
+ {}.tap do |hash|
153
+ value.each do |k, v|
154
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
155
+ end
156
+ end
157
+ else # model
158
+ MuxRuby.const_get(type).build_from_hash(value)
159
+ end
160
+ end
161
+
162
+ # Returns the string representation of the object
163
+ # @return [String] String presentation of the object
164
+ def to_s
165
+ to_hash.to_s
166
+ end
167
+
168
+ # to_body is an alias to to_hash (backward compatibility)
169
+ # @return [Hash] Returns the object in the form of hash
170
+ def to_body
171
+ to_hash
172
+ end
173
+
174
+ # Returns the object in the form of hash
175
+ # @return [Hash] Returns the object in the form of hash
176
+ def to_hash
177
+ hash = {}
178
+ self.class.attribute_map.each_pair do |attr, param|
179
+ value = self.send(attr)
180
+ next if value.nil?
181
+ hash[param] = _to_hash(value)
182
+ end
183
+ hash
184
+ end
185
+
186
+ # Outputs non-array value in the form of hash
187
+ # For object, use to_hash. Otherwise, just return the value
188
+ # @param [Object] value Any valid value
189
+ # @return [Hash] Returns the value in the form of hash
190
+ def _to_hash(value)
191
+ if value.is_a?(Array)
192
+ value.compact.map { |v| _to_hash(v) }
193
+ elsif value.is_a?(Hash)
194
+ {}.tap do |hash|
195
+ value.each { |k, v| hash[k] = _to_hash(v) }
196
+ end
197
+ elsif value.respond_to? :to_hash
198
+ value.to_hash
199
+ else
200
+ value
201
+ end
202
+ end
203
+
204
+ end
205
+
206
+ end
@@ -0,0 +1,204 @@
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 ListDimensionsResponse
10
+ attr_accessor :data
11
+
12
+ attr_accessor :total_row_count
13
+
14
+ attr_accessor :timeframe
15
+
16
+ # Attribute mapping from ruby-style variable name to JSON key.
17
+ def self.attribute_map
18
+ {
19
+ :'data' => :'data',
20
+ :'total_row_count' => :'total_row_count',
21
+ :'timeframe' => :'timeframe'
22
+ }
23
+ end
24
+
25
+ # Attribute type mapping.
26
+ def self.openapi_types
27
+ {
28
+ :'data' => :'ListFiltersResponseData',
29
+ :'total_row_count' => :'Integer',
30
+ :'timeframe' => :'Array<Integer>'
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?(:'data')
43
+ self.data = attributes[:'data']
44
+ end
45
+
46
+ if attributes.has_key?(:'total_row_count')
47
+ self.total_row_count = attributes[:'total_row_count']
48
+ end
49
+
50
+ if attributes.has_key?(:'timeframe')
51
+ if (value = attributes[:'timeframe']).is_a?(Array)
52
+ self.timeframe = value
53
+ end
54
+ end
55
+ end
56
+
57
+ # Show invalid properties with the reasons. Usually used together with valid?
58
+ # @return Array for valid properties with the reasons
59
+ def list_invalid_properties
60
+ invalid_properties = Array.new
61
+ invalid_properties
62
+ end
63
+
64
+ # Check to see if the all the properties in the model are valid
65
+ # @return true if the model is valid
66
+ def valid?
67
+ true
68
+ end
69
+
70
+ # Checks equality by comparing each attribute.
71
+ # @param [Object] Object to be compared
72
+ def ==(o)
73
+ return true if self.equal?(o)
74
+ self.class == o.class &&
75
+ data == o.data &&
76
+ total_row_count == o.total_row_count &&
77
+ timeframe == o.timeframe
78
+ end
79
+
80
+ # @see the `==` method
81
+ # @param [Object] Object to be compared
82
+ def eql?(o)
83
+ self == o
84
+ end
85
+
86
+ # Calculates hash code according to all attributes.
87
+ # @return [Fixnum] Hash code
88
+ def hash
89
+ [data, total_row_count, timeframe].hash
90
+ end
91
+
92
+ # Builds the object from hash
93
+ # @param [Hash] attributes Model attributes in the form of hash
94
+ # @return [Object] Returns the model itself
95
+ def self.build_from_hash(attributes)
96
+ new.build_from_hash(attributes)
97
+ end
98
+
99
+ # Builds the object from hash
100
+ # @param [Hash] attributes Model attributes in the form of hash
101
+ # @return [Object] Returns the model itself
102
+ def build_from_hash(attributes)
103
+ return nil unless attributes.is_a?(Hash)
104
+ self.class.openapi_types.each_pair do |key, type|
105
+ if type =~ /\AArray<(.*)>/i
106
+ # check to ensure the input is an array given that the attribute
107
+ # is documented as an array but the input is not
108
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
109
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
110
+ end
111
+ elsif !attributes[self.class.attribute_map[key]].nil?
112
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
113
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
114
+ end
115
+
116
+ self
117
+ end
118
+
119
+ # Deserializes the data based on type
120
+ # @param string type Data type
121
+ # @param string value Value to be deserialized
122
+ # @return [Object] Deserialized data
123
+ def _deserialize(type, value)
124
+ case type.to_sym
125
+ when :DateTime
126
+ DateTime.parse(value)
127
+ when :Date
128
+ Date.parse(value)
129
+ when :String
130
+ value.to_s
131
+ when :Integer
132
+ value.to_i
133
+ when :Float
134
+ value.to_f
135
+ when :BOOLEAN
136
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
137
+ true
138
+ else
139
+ false
140
+ end
141
+ when :Object
142
+ # generic object (usually a Hash), return directly
143
+ value
144
+ when /\AArray<(?<inner_type>.+)>\z/
145
+ inner_type = Regexp.last_match[:inner_type]
146
+ value.map { |v| _deserialize(inner_type, v) }
147
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
148
+ k_type = Regexp.last_match[:k_type]
149
+ v_type = Regexp.last_match[:v_type]
150
+ {}.tap do |hash|
151
+ value.each do |k, v|
152
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
153
+ end
154
+ end
155
+ else # model
156
+ MuxRuby.const_get(type).build_from_hash(value)
157
+ end
158
+ end
159
+
160
+ # Returns the string representation of the object
161
+ # @return [String] String presentation of the object
162
+ def to_s
163
+ to_hash.to_s
164
+ end
165
+
166
+ # to_body is an alias to to_hash (backward compatibility)
167
+ # @return [Hash] Returns the object in the form of hash
168
+ def to_body
169
+ to_hash
170
+ end
171
+
172
+ # Returns the object in the form of hash
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_hash
175
+ hash = {}
176
+ self.class.attribute_map.each_pair do |attr, param|
177
+ value = self.send(attr)
178
+ next if value.nil?
179
+ hash[param] = _to_hash(value)
180
+ end
181
+ hash
182
+ end
183
+
184
+ # Outputs non-array value in the form of hash
185
+ # For object, use to_hash. Otherwise, just return the value
186
+ # @param [Object] value Any valid value
187
+ # @return [Hash] Returns the value in the form of hash
188
+ def _to_hash(value)
189
+ if value.is_a?(Array)
190
+ value.compact.map { |v| _to_hash(v) }
191
+ elsif value.is_a?(Hash)
192
+ {}.tap do |hash|
193
+ value.each { |k, v| hash[k] = _to_hash(v) }
194
+ end
195
+ elsif value.respond_to? :to_hash
196
+ value.to_hash
197
+ else
198
+ value
199
+ end
200
+ end
201
+
202
+ end
203
+
204
+ end