mux_ruby 1.0.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile +2 -1
  3. data/Gemfile.lock +37 -35
  4. data/README.md +5 -0
  5. data/docs/Asset.md +2 -1
  6. data/docs/AssetsApi.md +157 -0
  7. data/docs/CreateAssetRequest.md +3 -1
  8. data/docs/CreateLiveStreamRequest.md +4 -0
  9. data/docs/CreateSimulcastTargetRequest.md +10 -0
  10. data/docs/CreateTrackRequest.md +14 -0
  11. data/docs/CreateTrackResponse.md +8 -0
  12. data/docs/CreateUploadRequest.md +1 -0
  13. data/docs/DeliveryReport.md +14 -0
  14. data/docs/DeliveryUsageApi.md +68 -0
  15. data/docs/GetMetricTimeseriesDataResponse.md +1 -1
  16. data/docs/GetOverallValuesResponse.md +1 -1
  17. data/docs/InputSettings.md +6 -1
  18. data/docs/InputTrack.md +0 -2
  19. data/docs/Insight.md +2 -2
  20. data/docs/ListAllMetricValuesResponse.md +1 -1
  21. data/docs/ListBreakdownValuesResponse.md +1 -1
  22. data/docs/ListDeliveryUsageResponse.md +11 -0
  23. data/docs/ListErrorsResponse.md +1 -1
  24. data/docs/ListExportsResponse.md +1 -1
  25. data/docs/ListFilterValuesResponse.md +1 -1
  26. data/docs/ListFiltersResponse.md +1 -1
  27. data/docs/ListInsightsResponse.md +1 -1
  28. data/docs/ListVideoViewsResponse.md +1 -1
  29. data/docs/LiveStream.md +3 -0
  30. data/docs/LiveStreamsApi.md +161 -0
  31. data/docs/SigningKeyResponse.md +1 -1
  32. data/docs/SimulcastTarget.md +12 -0
  33. data/docs/SimulcastTargetResponse.md +8 -0
  34. data/docs/Track.md +5 -2
  35. data/docs/UpdateAssetMasterAccessRequest.md +8 -0
  36. data/docs/Upload.md +1 -0
  37. data/docs/VideoViewResponse.md +1 -1
  38. data/examples/data/exercise-errors.rb +1 -1
  39. data/examples/data/exercise-metrics.rb +0 -7
  40. data/examples/video/exercise-assets.rb +27 -1
  41. data/examples/video/exercise-delivery-usage.rb +23 -0
  42. data/examples/video/exercise-live-streams.rb +28 -1
  43. data/lib/mux_ruby.rb +9 -0
  44. data/lib/mux_ruby/api/assets_api.rb +174 -0
  45. data/lib/mux_ruby/api/delivery_usage_api.rb +75 -0
  46. data/lib/mux_ruby/api/live_streams_api.rb +176 -0
  47. data/lib/mux_ruby/api_client.rb +7 -2
  48. data/lib/mux_ruby/api_error.rb +3 -0
  49. data/lib/mux_ruby/configuration.rb +1 -4
  50. data/lib/mux_ruby/models/asset.rb +24 -13
  51. data/lib/mux_ruby/models/create_asset_request.rb +46 -13
  52. data/lib/mux_ruby/models/create_live_stream_request.rb +66 -4
  53. data/lib/mux_ruby/models/create_simulcast_target_request.rb +210 -0
  54. data/lib/mux_ruby/models/create_track_request.rb +304 -0
  55. data/lib/mux_ruby/models/create_track_response.rb +184 -0
  56. data/lib/mux_ruby/models/create_upload_request.rb +13 -4
  57. data/lib/mux_ruby/models/delivery_report.rb +238 -0
  58. data/lib/mux_ruby/models/get_metric_timeseries_data_response.rb +1 -1
  59. data/lib/mux_ruby/models/get_overall_values_response.rb +1 -1
  60. data/lib/mux_ruby/models/input_settings.rb +104 -13
  61. data/lib/mux_ruby/models/input_settings_overlay_settings.rb +46 -0
  62. data/lib/mux_ruby/models/input_track.rb +4 -22
  63. data/lib/mux_ruby/models/insight.rb +2 -2
  64. data/lib/mux_ruby/models/list_all_metric_values_response.rb +1 -1
  65. data/lib/mux_ruby/models/list_breakdown_values_response.rb +1 -1
  66. data/lib/mux_ruby/models/list_delivery_usage_response.rb +216 -0
  67. data/lib/mux_ruby/models/list_errors_response.rb +1 -1
  68. data/lib/mux_ruby/models/list_exports_response.rb +1 -1
  69. data/lib/mux_ruby/models/list_filter_values_response.rb +1 -1
  70. data/lib/mux_ruby/models/list_filters_response.rb +1 -1
  71. data/lib/mux_ruby/models/list_insights_response.rb +1 -1
  72. data/lib/mux_ruby/models/list_video_views_response.rb +1 -1
  73. data/lib/mux_ruby/models/live_stream.rb +33 -4
  74. data/lib/mux_ruby/models/simulcast_target.rb +259 -0
  75. data/lib/mux_ruby/models/simulcast_target_response.rb +184 -0
  76. data/lib/mux_ruby/models/track.rb +86 -13
  77. data/lib/mux_ruby/models/update_asset_master_access_request.rb +219 -0
  78. data/lib/mux_ruby/models/upload.rb +13 -4
  79. data/lib/mux_ruby/models/video_view_response.rb +1 -1
  80. data/lib/mux_ruby/version.rb +1 -1
  81. data/spec/api/assets_api_spec.rb +37 -0
  82. data/spec/api/delivery_usage_api_spec.rb +43 -0
  83. data/spec/api/live_streams_api_spec.rb +39 -0
  84. data/spec/models/asset_spec.rb +12 -6
  85. data/spec/models/create_asset_request_spec.rb +22 -6
  86. data/spec/models/create_live_stream_request_spec.rb +24 -0
  87. data/spec/models/create_simulcast_target_request_spec.rb +46 -0
  88. data/spec/models/create_track_request_spec.rb +78 -0
  89. data/spec/models/create_track_response_spec.rb +34 -0
  90. data/spec/models/create_upload_request_spec.rb +6 -0
  91. data/spec/models/delivery_report_spec.rb +70 -0
  92. data/spec/models/input_settings_overlay_settings_spec.rb +8 -0
  93. data/spec/models/input_settings_spec.rb +40 -2
  94. data/spec/models/input_track_spec.rb +0 -12
  95. data/spec/models/list_delivery_usage_response_spec.rb +52 -0
  96. data/spec/models/live_stream_spec.rb +18 -0
  97. data/spec/models/simulcast_target_response_spec.rb +34 -0
  98. data/spec/models/simulcast_target_spec.rb +62 -0
  99. data/spec/models/track_spec.rb +28 -2
  100. data/spec/models/update_asset_master_access_request_spec.rb +38 -0
  101. data/spec/models/upload_spec.rb +6 -0
  102. data/test.sh +28 -0
  103. metadata +91 -54
@@ -15,12 +15,15 @@ module MuxRuby
15
15
 
16
16
  attr_accessor :new_asset_settings
17
17
 
18
+ attr_accessor :test
19
+
18
20
  # Attribute mapping from ruby-style variable name to JSON key.
19
21
  def self.attribute_map
20
22
  {
21
23
  :'timeout' => :'timeout',
22
24
  :'cors_origin' => :'cors_origin',
23
- :'new_asset_settings' => :'new_asset_settings'
25
+ :'new_asset_settings' => :'new_asset_settings',
26
+ :'test' => :'test'
24
27
  }
25
28
  end
26
29
 
@@ -29,7 +32,8 @@ module MuxRuby
29
32
  {
30
33
  :'timeout' => :'Integer',
31
34
  :'cors_origin' => :'String',
32
- :'new_asset_settings' => :'CreateAssetRequest'
35
+ :'new_asset_settings' => :'CreateAssetRequest',
36
+ :'test' => :'BOOLEAN'
33
37
  }
34
38
  end
35
39
 
@@ -54,6 +58,10 @@ module MuxRuby
54
58
  if attributes.has_key?(:'new_asset_settings')
55
59
  self.new_asset_settings = attributes[:'new_asset_settings']
56
60
  end
61
+
62
+ if attributes.has_key?(:'test')
63
+ self.test = attributes[:'test']
64
+ end
57
65
  end
58
66
 
59
67
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -105,7 +113,8 @@ module MuxRuby
105
113
  self.class == o.class &&
106
114
  timeout == o.timeout &&
107
115
  cors_origin == o.cors_origin &&
108
- new_asset_settings == o.new_asset_settings
116
+ new_asset_settings == o.new_asset_settings &&
117
+ test == o.test
109
118
  end
110
119
 
111
120
  # @see the `==` method
@@ -117,7 +126,7 @@ module MuxRuby
117
126
  # Calculates hash code according to all attributes.
118
127
  # @return [Fixnum] Hash code
119
128
  def hash
120
- [timeout, cors_origin, new_asset_settings].hash
129
+ [timeout, cors_origin, new_asset_settings, test].hash
121
130
  end
122
131
 
123
132
  # Builds the object from hash
@@ -0,0 +1,238 @@
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 DeliveryReport
10
+ attr_accessor :live_stream_id
11
+
12
+ attr_accessor :asset_id
13
+
14
+ attr_accessor :passthrough
15
+
16
+ attr_accessor :created_at
17
+
18
+ attr_accessor :asset_state
19
+
20
+ attr_accessor :asset_duration
21
+
22
+ attr_accessor :delivered_seconds
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'live_stream_id' => :'live_stream_id',
28
+ :'asset_id' => :'asset_id',
29
+ :'passthrough' => :'passthrough',
30
+ :'created_at' => :'created_at',
31
+ :'asset_state' => :'asset_state',
32
+ :'asset_duration' => :'asset_duration',
33
+ :'delivered_seconds' => :'delivered_seconds'
34
+ }
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'live_stream_id' => :'String',
41
+ :'asset_id' => :'String',
42
+ :'passthrough' => :'String',
43
+ :'created_at' => :'String',
44
+ :'asset_state' => :'String',
45
+ :'asset_duration' => :'Float',
46
+ :'delivered_seconds' => :'Float'
47
+ }
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ return unless attributes.is_a?(Hash)
54
+
55
+ # convert string to symbol for hash key
56
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
57
+
58
+ if attributes.has_key?(:'live_stream_id')
59
+ self.live_stream_id = attributes[:'live_stream_id']
60
+ end
61
+
62
+ if attributes.has_key?(:'asset_id')
63
+ self.asset_id = attributes[:'asset_id']
64
+ end
65
+
66
+ if attributes.has_key?(:'passthrough')
67
+ self.passthrough = attributes[:'passthrough']
68
+ end
69
+
70
+ if attributes.has_key?(:'created_at')
71
+ self.created_at = attributes[:'created_at']
72
+ end
73
+
74
+ if attributes.has_key?(:'asset_state')
75
+ self.asset_state = attributes[:'asset_state']
76
+ end
77
+
78
+ if attributes.has_key?(:'asset_duration')
79
+ self.asset_duration = attributes[:'asset_duration']
80
+ end
81
+
82
+ if attributes.has_key?(:'delivered_seconds')
83
+ self.delivered_seconds = attributes[:'delivered_seconds']
84
+ end
85
+ end
86
+
87
+ # Show invalid properties with the reasons. Usually used together with valid?
88
+ # @return Array for valid properties with the reasons
89
+ def list_invalid_properties
90
+ invalid_properties = Array.new
91
+ invalid_properties
92
+ end
93
+
94
+ # Check to see if the all the properties in the model are valid
95
+ # @return true if the model is valid
96
+ def valid?
97
+ true
98
+ end
99
+
100
+ # Checks equality by comparing each attribute.
101
+ # @param [Object] Object to be compared
102
+ def ==(o)
103
+ return true if self.equal?(o)
104
+ self.class == o.class &&
105
+ live_stream_id == o.live_stream_id &&
106
+ asset_id == o.asset_id &&
107
+ passthrough == o.passthrough &&
108
+ created_at == o.created_at &&
109
+ asset_state == o.asset_state &&
110
+ asset_duration == o.asset_duration &&
111
+ delivered_seconds == o.delivered_seconds
112
+ end
113
+
114
+ # @see the `==` method
115
+ # @param [Object] Object to be compared
116
+ def eql?(o)
117
+ self == o
118
+ end
119
+
120
+ # Calculates hash code according to all attributes.
121
+ # @return [Fixnum] Hash code
122
+ def hash
123
+ [live_stream_id, asset_id, passthrough, created_at, asset_state, asset_duration, delivered_seconds].hash
124
+ end
125
+
126
+ # Builds the object from hash
127
+ # @param [Hash] attributes Model attributes in the form of hash
128
+ # @return [Object] Returns the model itself
129
+ def self.build_from_hash(attributes)
130
+ new.build_from_hash(attributes)
131
+ end
132
+
133
+ # Builds the object from hash
134
+ # @param [Hash] attributes Model attributes in the form of hash
135
+ # @return [Object] Returns the model itself
136
+ def build_from_hash(attributes)
137
+ return nil unless attributes.is_a?(Hash)
138
+ self.class.openapi_types.each_pair do |key, type|
139
+ if type =~ /\AArray<(.*)>/i
140
+ # check to ensure the input is an array given that the attribute
141
+ # is documented as an array but the input is not
142
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
143
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
144
+ end
145
+ elsif !attributes[self.class.attribute_map[key]].nil?
146
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
147
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
148
+ end
149
+
150
+ self
151
+ end
152
+
153
+ # Deserializes the data based on type
154
+ # @param string type Data type
155
+ # @param string value Value to be deserialized
156
+ # @return [Object] Deserialized data
157
+ def _deserialize(type, value)
158
+ case type.to_sym
159
+ when :DateTime
160
+ DateTime.parse(value)
161
+ when :Date
162
+ Date.parse(value)
163
+ when :String
164
+ value.to_s
165
+ when :Integer
166
+ value.to_i
167
+ when :Float
168
+ value.to_f
169
+ when :BOOLEAN
170
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
171
+ true
172
+ else
173
+ false
174
+ end
175
+ when :Object
176
+ # generic object (usually a Hash), return directly
177
+ value
178
+ when /\AArray<(?<inner_type>.+)>\z/
179
+ inner_type = Regexp.last_match[:inner_type]
180
+ value.map { |v| _deserialize(inner_type, v) }
181
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
182
+ k_type = Regexp.last_match[:k_type]
183
+ v_type = Regexp.last_match[:v_type]
184
+ {}.tap do |hash|
185
+ value.each do |k, v|
186
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
187
+ end
188
+ end
189
+ else # model
190
+ MuxRuby.const_get(type).build_from_hash(value)
191
+ end
192
+ end
193
+
194
+ # Returns the string representation of the object
195
+ # @return [String] String presentation of the object
196
+ def to_s
197
+ to_hash.to_s
198
+ end
199
+
200
+ # to_body is an alias to to_hash (backward compatibility)
201
+ # @return [Hash] Returns the object in the form of hash
202
+ def to_body
203
+ to_hash
204
+ end
205
+
206
+ # Returns the object in the form of hash
207
+ # @return [Hash] Returns the object in the form of hash
208
+ def to_hash
209
+ hash = {}
210
+ self.class.attribute_map.each_pair do |attr, param|
211
+ value = self.send(attr)
212
+ next if value.nil?
213
+ hash[param] = _to_hash(value)
214
+ end
215
+ hash
216
+ end
217
+
218
+ # Outputs non-array value in the form of hash
219
+ # For object, use to_hash. Otherwise, just return the value
220
+ # @param [Object] value Any valid value
221
+ # @return [Hash] Returns the value in the form of hash
222
+ def _to_hash(value)
223
+ if value.is_a?(Array)
224
+ value.compact.map { |v| _to_hash(v) }
225
+ elsif value.is_a?(Hash)
226
+ {}.tap do |hash|
227
+ value.each { |k, v| hash[k] = _to_hash(v) }
228
+ end
229
+ elsif value.respond_to? :to_hash
230
+ value.to_hash
231
+ else
232
+ value
233
+ end
234
+ end
235
+
236
+ end
237
+
238
+ end
@@ -27,7 +27,7 @@ module MuxRuby
27
27
  {
28
28
  :'data' => :'Array<Array<String>>',
29
29
  :'total_row_count' => :'Integer',
30
- :'timeframe' => :'Array<String>'
30
+ :'timeframe' => :'Array<Integer>'
31
31
  }
32
32
  end
33
33
 
@@ -27,7 +27,7 @@ module MuxRuby
27
27
  {
28
28
  :'data' => :'OverallValues',
29
29
  :'total_row_count' => :'Integer',
30
- :'timeframe' => :'Array<String>'
30
+ :'timeframe' => :'Array<Integer>'
31
31
  }
32
32
  end
33
33
 
@@ -10,16 +10,53 @@ module MuxRuby
10
10
  class InputSettings
11
11
  attr_accessor :url
12
12
 
13
- attr_accessor :language
14
-
15
13
  attr_accessor :overlay_settings
16
14
 
15
+ attr_accessor :type
16
+
17
+ attr_accessor :text_type
18
+
19
+ attr_accessor :language_code
20
+
21
+ attr_accessor :name
22
+
23
+ attr_accessor :closed_captions
24
+
25
+ attr_accessor :passthrough
26
+
27
+ class EnumAttributeValidator
28
+ attr_reader :datatype
29
+ attr_reader :allowable_values
30
+
31
+ def initialize(datatype, allowable_values)
32
+ @allowable_values = allowable_values.map do |value|
33
+ case datatype.to_s
34
+ when /Integer/i
35
+ value.to_i
36
+ when /Float/i
37
+ value.to_f
38
+ else
39
+ value
40
+ end
41
+ end
42
+ end
43
+
44
+ def valid?(value)
45
+ !value || allowable_values.include?(value)
46
+ end
47
+ end
48
+
17
49
  # Attribute mapping from ruby-style variable name to JSON key.
18
50
  def self.attribute_map
19
51
  {
20
52
  :'url' => :'url',
21
- :'language' => :'language',
22
- :'overlay_settings' => :'overlay_settings'
53
+ :'overlay_settings' => :'overlay_settings',
54
+ :'type' => :'type',
55
+ :'text_type' => :'text_type',
56
+ :'language_code' => :'language_code',
57
+ :'name' => :'name',
58
+ :'closed_captions' => :'closed_captions',
59
+ :'passthrough' => :'passthrough'
23
60
  }
24
61
  end
25
62
 
@@ -27,8 +64,13 @@ module MuxRuby
27
64
  def self.openapi_types
28
65
  {
29
66
  :'url' => :'String',
30
- :'language' => :'String',
31
- :'overlay_settings' => :'InputSettingsOverlaySettings'
67
+ :'overlay_settings' => :'InputSettingsOverlaySettings',
68
+ :'type' => :'String',
69
+ :'text_type' => :'String',
70
+ :'language_code' => :'String',
71
+ :'name' => :'String',
72
+ :'closed_captions' => :'BOOLEAN',
73
+ :'passthrough' => :'String'
32
74
  }
33
75
  end
34
76
 
@@ -44,13 +86,33 @@ module MuxRuby
44
86
  self.url = attributes[:'url']
45
87
  end
46
88
 
47
- if attributes.has_key?(:'language')
48
- self.language = attributes[:'language']
49
- end
50
-
51
89
  if attributes.has_key?(:'overlay_settings')
52
90
  self.overlay_settings = attributes[:'overlay_settings']
53
91
  end
92
+
93
+ if attributes.has_key?(:'type')
94
+ self.type = attributes[:'type']
95
+ end
96
+
97
+ if attributes.has_key?(:'text_type')
98
+ self.text_type = attributes[:'text_type']
99
+ end
100
+
101
+ if attributes.has_key?(:'language_code')
102
+ self.language_code = attributes[:'language_code']
103
+ end
104
+
105
+ if attributes.has_key?(:'name')
106
+ self.name = attributes[:'name']
107
+ end
108
+
109
+ if attributes.has_key?(:'closed_captions')
110
+ self.closed_captions = attributes[:'closed_captions']
111
+ end
112
+
113
+ if attributes.has_key?(:'passthrough')
114
+ self.passthrough = attributes[:'passthrough']
115
+ end
54
116
  end
55
117
 
56
118
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -63,17 +125,46 @@ module MuxRuby
63
125
  # Check to see if the all the properties in the model are valid
64
126
  # @return true if the model is valid
65
127
  def valid?
128
+ type_validator = EnumAttributeValidator.new('String', ['video', 'audio', 'text'])
129
+ return false unless type_validator.valid?(@type)
130
+ text_type_validator = EnumAttributeValidator.new('String', ['subtitles'])
131
+ return false unless text_type_validator.valid?(@text_type)
66
132
  true
67
133
  end
68
134
 
135
+ # Custom attribute writer method checking allowed values (enum).
136
+ # @param [Object] type Object to be assigned
137
+ def type=(type)
138
+ validator = EnumAttributeValidator.new('String', ['video', 'audio', 'text'])
139
+ unless validator.valid?(type)
140
+ fail ArgumentError, 'invalid value for "type", must be one of #{validator.allowable_values}.'
141
+ end
142
+ @type = type
143
+ end
144
+
145
+ # Custom attribute writer method checking allowed values (enum).
146
+ # @param [Object] text_type Object to be assigned
147
+ def text_type=(text_type)
148
+ validator = EnumAttributeValidator.new('String', ['subtitles'])
149
+ unless validator.valid?(text_type)
150
+ fail ArgumentError, 'invalid value for "text_type", must be one of #{validator.allowable_values}.'
151
+ end
152
+ @text_type = text_type
153
+ end
154
+
69
155
  # Checks equality by comparing each attribute.
70
156
  # @param [Object] Object to be compared
71
157
  def ==(o)
72
158
  return true if self.equal?(o)
73
159
  self.class == o.class &&
74
160
  url == o.url &&
75
- language == o.language &&
76
- overlay_settings == o.overlay_settings
161
+ overlay_settings == o.overlay_settings &&
162
+ type == o.type &&
163
+ text_type == o.text_type &&
164
+ language_code == o.language_code &&
165
+ name == o.name &&
166
+ closed_captions == o.closed_captions &&
167
+ passthrough == o.passthrough
77
168
  end
78
169
 
79
170
  # @see the `==` method
@@ -85,7 +176,7 @@ module MuxRuby
85
176
  # Calculates hash code according to all attributes.
86
177
  # @return [Fixnum] Hash code
87
178
  def hash
88
- [url, language, overlay_settings].hash
179
+ [url, overlay_settings, type, text_type, language_code, name, closed_captions, passthrough].hash
89
180
  end
90
181
 
91
182
  # Builds the object from hash