mux_ruby 5.0.1 → 5.1.0

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 (79) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +4 -4
  4. data/docs/Annotation.md +24 -0
  5. data/docs/AnnotationInput.md +22 -0
  6. data/docs/AnnotationResponse.md +18 -0
  7. data/docs/AnnotationsApi.md +371 -0
  8. data/docs/Asset.md +3 -1
  9. data/docs/AssetProgress.md +20 -0
  10. data/docs/AssetsApi.md +3 -1
  11. data/docs/CreateAssetRequest.md +3 -1
  12. data/docs/CreateLiveStreamRequest.md +3 -1
  13. data/docs/DimensionsApi.md +87 -2
  14. data/docs/ErrorsApi.md +2 -2
  15. data/docs/FiltersApi.md +2 -2
  16. data/docs/ListAnnotationsResponse.md +22 -0
  17. data/docs/ListAssetsResponse.md +2 -0
  18. data/docs/LiveStream.md +5 -3
  19. data/docs/LiveStreamMetadata.md +18 -0
  20. data/docs/MetricsApi.md +10 -10
  21. data/docs/UpdateLiveStreamRequest.md +3 -1
  22. data/docs/VideoView.md +3 -1
  23. data/docs/VideoViewsApi.md +2 -2
  24. data/gen/generator-config.json +1 -1
  25. data/lib/mux_ruby/api/annotations_api.rb +355 -0
  26. data/lib/mux_ruby/api/assets_api.rb +5 -2
  27. data/lib/mux_ruby/api/dimensions_api.rb +91 -2
  28. data/lib/mux_ruby/api/errors_api.rb +2 -2
  29. data/lib/mux_ruby/api/filters_api.rb +2 -2
  30. data/lib/mux_ruby/api/metrics_api.rb +12 -12
  31. data/lib/mux_ruby/api/video_views_api.rb +2 -2
  32. data/lib/mux_ruby/configuration.rb +6 -0
  33. data/lib/mux_ruby/models/annotation.rb +250 -0
  34. data/lib/mux_ruby/models/annotation_input.rb +239 -0
  35. data/lib/mux_ruby/models/annotation_response.rb +218 -0
  36. data/lib/mux_ruby/models/asset.rb +13 -4
  37. data/lib/mux_ruby/models/asset_progress.rb +288 -0
  38. data/lib/mux_ruby/models/create_asset_request.rb +16 -4
  39. data/lib/mux_ruby/models/create_live_stream_request.rb +13 -4
  40. data/lib/mux_ruby/models/list_annotations_response.rb +266 -0
  41. data/lib/mux_ruby/models/list_assets_response.rb +12 -1
  42. data/lib/mux_ruby/models/live_stream.rb +15 -6
  43. data/lib/mux_ruby/models/live_stream_generated_subtitle_settings.rb +2 -2
  44. data/lib/mux_ruby/models/live_stream_metadata.rb +235 -0
  45. data/lib/mux_ruby/models/update_live_stream_request.rb +13 -4
  46. data/lib/mux_ruby/models/video_view.rb +16 -5
  47. data/lib/mux_ruby/version.rb +1 -1
  48. data/lib/mux_ruby.rb +7 -0
  49. data/spec/api/annotations_api_spec.rb +99 -0
  50. data/spec/models/annotation_input_spec.rb +46 -0
  51. data/spec/models/annotation_response_spec.rb +34 -0
  52. data/spec/models/annotation_spec.rb +52 -0
  53. data/spec/models/asset_progress_spec.rb +44 -0
  54. data/spec/models/list_annotations_response_spec.rb +46 -0
  55. data/spec/models/live_stream_metadata_spec.rb +34 -0
  56. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/byebug-11.1.3/byebug/byebug.so +0 -0
  57. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/byebug-11.1.3/gem_make.out +6 -6
  58. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/ffi-1.16.3/ffi_c.so +0 -0
  59. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/ffi-1.16.3/gem_make.out +6 -6
  60. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/ffi-1.16.3/mkmf.log +16 -16
  61. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/jaro_winkler-1.5.6/gem_make.out +6 -6
  62. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/jaro_winkler-1.5.6/jaro_winkler/jaro_winkler_ext.so +0 -0
  63. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-4.0.4/gem_make.out +6 -6
  64. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-4.0.4/mkmf.log +4 -4
  65. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-4.0.4/psych.so +0 -0
  66. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.0.2/gem_make.out +6 -6
  67. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.0.2/mkmf.log +2 -2
  68. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.0.2/stringio.so +0 -0
  69. data/vendor/bundle/ruby/3.2.0/gems/byebug-11.1.3/ext/byebug/Makefile +3 -3
  70. data/vendor/bundle/ruby/3.2.0/gems/byebug-11.1.3/lib/byebug/byebug.so +0 -0
  71. data/vendor/bundle/ruby/3.2.0/gems/ffi-1.16.3/ext/ffi_c/Makefile +3 -3
  72. data/vendor/bundle/ruby/3.2.0/gems/ffi-1.16.3/lib/ffi_c.so +0 -0
  73. data/vendor/bundle/ruby/3.2.0/gems/jaro_winkler-1.5.6/ext/jaro_winkler/Makefile +3 -3
  74. data/vendor/bundle/ruby/3.2.0/gems/jaro_winkler-1.5.6/lib/jaro_winkler/jaro_winkler_ext.so +0 -0
  75. data/vendor/bundle/ruby/3.2.0/gems/psych-4.0.4/ext/psych/Makefile +3 -3
  76. data/vendor/bundle/ruby/3.2.0/gems/psych-4.0.4/lib/psych.so +0 -0
  77. data/vendor/bundle/ruby/3.2.0/gems/stringio-3.0.2/ext/stringio/Makefile +3 -3
  78. data/vendor/bundle/ruby/3.2.0/gems/stringio-3.0.2/lib/stringio.so +0 -0
  79. metadata +30 -2
@@ -0,0 +1,288 @@
1
+ =begin
2
+ #Mux API
3
+
4
+ #Mux is how developers build online video. This API encompasses both Mux Video and Mux Data functionality to help you build your video-related projects better and faster than ever before.
5
+
6
+ The version of the OpenAPI document: v1
7
+ Contact: devex@mux.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.0.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module MuxRuby
17
+ # Detailed state information about the asset ingest process.
18
+ class AssetProgress
19
+ # The detailed state of the asset ingest process. This field is useful for relaying more granular processing information to end users when a [non-standard input is encountered](https://www.mux.com/docs/guides/minimize-processing-time#non-standard-input). - `ingesting`: Asset is being ingested (initial processing before or after transcoding). While in this state, the `progress` percentage will be 0. - `transcoding`: Asset is undergoing non-standard transcoding. - `completed`: Asset processing is complete (`status` is `ready`). While in this state, the `progress` percentage will be 100. - `live`: Asset is a live stream currently in progress. While in this state, the `progress` percentage will be -1. - `errored`: Asset has encountered an error (`status` is `errored`). While in this state, the `progress` percentage will be -1.
20
+ attr_accessor :state
21
+
22
+ # Represents the estimated completion percentage. Returns `0 - 100` when in `ingesting`, `transcoding`, or `completed` state, and `-1` when in `live` or `errored` state.
23
+ attr_accessor :progress
24
+
25
+ class EnumAttributeValidator
26
+ attr_reader :datatype
27
+ attr_reader :allowable_values
28
+
29
+ def initialize(datatype, allowable_values)
30
+ @allowable_values = allowable_values.map do |value|
31
+ case datatype.to_s
32
+ when /Integer/i
33
+ value.to_i
34
+ when /Float/i
35
+ value.to_f
36
+ else
37
+ value
38
+ end
39
+ end
40
+ end
41
+
42
+ def valid?(value)
43
+ !value || allowable_values.include?(value)
44
+ end
45
+ end
46
+
47
+ # Attribute mapping from ruby-style variable name to JSON key.
48
+ def self.attribute_map
49
+ {
50
+ :'state' => :'state',
51
+ :'progress' => :'progress'
52
+ }
53
+ end
54
+
55
+ # Returns all the JSON keys this model knows about
56
+ def self.acceptable_attributes
57
+ attribute_map.values
58
+ end
59
+
60
+ # Attribute type mapping.
61
+ def self.openapi_types
62
+ {
63
+ :'state' => :'String',
64
+ :'progress' => :'Float'
65
+ }
66
+ end
67
+
68
+ # List of attributes with nullable: true
69
+ def self.openapi_nullable
70
+ Set.new([
71
+ ])
72
+ end
73
+
74
+ # Initializes the object
75
+ # @param [Hash] attributes Model attributes in the form of hash
76
+ def initialize(attributes = {})
77
+ if (!attributes.is_a?(Hash))
78
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MuxRuby::AssetProgress` initialize method"
79
+ end
80
+
81
+ # check to see if the attribute exists and convert string to symbol for hash key
82
+ attributes = attributes.each_with_object({}) { |(k, v), h|
83
+ if (!self.class.attribute_map.key?(k.to_sym))
84
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MuxRuby::AssetProgress`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
85
+ end
86
+ h[k.to_sym] = v
87
+ }
88
+
89
+ if attributes.key?(:'state')
90
+ self.state = attributes[:'state']
91
+ end
92
+
93
+ if attributes.key?(:'progress')
94
+ self.progress = attributes[:'progress']
95
+ end
96
+ end
97
+
98
+ # Show invalid properties with the reasons. Usually used together with valid?
99
+ # @return Array for valid properties with the reasons
100
+ def list_invalid_properties
101
+ invalid_properties = Array.new
102
+ if !@progress.nil? && @progress > 100
103
+ invalid_properties.push('invalid value for "progress", must be smaller than or equal to 100.')
104
+ end
105
+
106
+ if !@progress.nil? && @progress < -1
107
+ invalid_properties.push('invalid value for "progress", must be greater than or equal to -1.')
108
+ end
109
+
110
+ invalid_properties
111
+ end
112
+
113
+ # Check to see if the all the properties in the model are valid
114
+ # @return true if the model is valid
115
+ def valid?
116
+ state_validator = EnumAttributeValidator.new('String', ["ingesting", "transcoding", "completed", "live", "errored"])
117
+ return false unless state_validator.valid?(@state)
118
+ return false if !@progress.nil? && @progress > 100
119
+ return false if !@progress.nil? && @progress < -1
120
+ true
121
+ end
122
+
123
+ # Custom attribute writer method checking allowed values (enum).
124
+ # @param [Object] state Object to be assigned
125
+ def state=(state)
126
+ validator = EnumAttributeValidator.new('String', ["ingesting", "transcoding", "completed", "live", "errored"])
127
+ unless validator.valid?(state)
128
+ fail ArgumentError, "invalid value for \"state\", must be one of #{validator.allowable_values}."
129
+ end
130
+ @state = state
131
+ end
132
+
133
+ # Custom attribute writer method with validation
134
+ # @param [Object] progress Value to be assigned
135
+ def progress=(progress)
136
+ if !progress.nil? && progress > 100
137
+ fail ArgumentError, 'invalid value for "progress", must be smaller than or equal to 100.'
138
+ end
139
+
140
+ if !progress.nil? && progress < -1
141
+ fail ArgumentError, 'invalid value for "progress", must be greater than or equal to -1.'
142
+ end
143
+
144
+ @progress = progress
145
+ end
146
+
147
+ # Checks equality by comparing each attribute.
148
+ # @param [Object] Object to be compared
149
+ def ==(o)
150
+ return true if self.equal?(o)
151
+ self.class == o.class &&
152
+ state == o.state &&
153
+ progress == o.progress
154
+ end
155
+
156
+ # @see the `==` method
157
+ # @param [Object] Object to be compared
158
+ def eql?(o)
159
+ self == o
160
+ end
161
+
162
+ # Calculates hash code according to all attributes.
163
+ # @return [Integer] Hash code
164
+ def hash
165
+ [state, progress].hash
166
+ end
167
+
168
+ # Builds the object from hash
169
+ # @param [Hash] attributes Model attributes in the form of hash
170
+ # @return [Object] Returns the model itself
171
+ def self.build_from_hash(attributes)
172
+ new.build_from_hash(attributes)
173
+ end
174
+
175
+ # Builds the object from hash
176
+ # @param [Hash] attributes Model attributes in the form of hash
177
+ # @return [Object] Returns the model itself
178
+ def build_from_hash(attributes)
179
+ return nil unless attributes.is_a?(Hash)
180
+ self.class.openapi_types.each_pair do |key, type|
181
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
182
+ self.send("#{key}=", nil)
183
+ elsif type =~ /\AArray<(.*)>/i
184
+ # check to ensure the input is an array given that the attribute
185
+ # is documented as an array but the input is not
186
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
187
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
188
+ end
189
+ elsif !attributes[self.class.attribute_map[key]].nil?
190
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
191
+ end
192
+ end
193
+
194
+ self
195
+ end
196
+
197
+ # Deserializes the data based on type
198
+ # @param string type Data type
199
+ # @param string value Value to be deserialized
200
+ # @return [Object] Deserialized data
201
+ def _deserialize(type, value)
202
+ case type.to_sym
203
+ when :Time
204
+ Time.parse(value)
205
+ when :Date
206
+ Date.parse(value)
207
+ when :String
208
+ value.to_s
209
+ when :Integer
210
+ value.to_i
211
+ when :Float
212
+ value.to_f
213
+ when :Boolean
214
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
215
+ true
216
+ else
217
+ false
218
+ end
219
+ when :Object
220
+ # generic object (usually a Hash), return directly
221
+ value
222
+ when /\AArray<(?<inner_type>.+)>\z/
223
+ inner_type = Regexp.last_match[:inner_type]
224
+ value.map { |v| _deserialize(inner_type, v) }
225
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
226
+ k_type = Regexp.last_match[:k_type]
227
+ v_type = Regexp.last_match[:v_type]
228
+ {}.tap do |hash|
229
+ value.each do |k, v|
230
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
231
+ end
232
+ end
233
+ else # model
234
+ # models (e.g. Pet) or oneOf
235
+ klass = MuxRuby.const_get(type)
236
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
237
+ end
238
+ end
239
+
240
+ # Returns the string representation of the object
241
+ # @return [String] String presentation of the object
242
+ def to_s
243
+ to_hash.to_s
244
+ end
245
+
246
+ # to_body is an alias to to_hash (backward compatibility)
247
+ # @return [Hash] Returns the object in the form of hash
248
+ def to_body
249
+ to_hash
250
+ end
251
+
252
+ # Returns the object in the form of hash
253
+ # @return [Hash] Returns the object in the form of hash
254
+ def to_hash
255
+ hash = {}
256
+ self.class.attribute_map.each_pair do |attr, param|
257
+ value = self.send(attr)
258
+ if value.nil?
259
+ is_nullable = self.class.openapi_nullable.include?(attr)
260
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
261
+ end
262
+
263
+ hash[param] = _to_hash(value)
264
+ end
265
+ hash
266
+ end
267
+
268
+ # Outputs non-array value in the form of hash
269
+ # For object, use to_hash. Otherwise, just return the value
270
+ # @param [Object] value Any valid value
271
+ # @return [Hash] Returns the value in the form of hash
272
+ def _to_hash(value)
273
+ if value.is_a?(Array)
274
+ value.compact.map { |v| _to_hash(v) }
275
+ elsif value.is_a?(Hash)
276
+ {}.tap do |hash|
277
+ value.each { |k, v| hash[k] = _to_hash(v) }
278
+ end
279
+ elsif value.respond_to? :to_hash
280
+ value.to_hash
281
+ else
282
+ value
283
+ end
284
+ end
285
+
286
+ end
287
+
288
+ end
@@ -61,6 +61,9 @@ module MuxRuby
61
61
 
62
62
  attr_accessor :meta
63
63
 
64
+ # If the created asset is a clip, this controls whether overlays are copied from the source asset.
65
+ attr_accessor :copy_overlays
66
+
64
67
  class EnumAttributeValidator
65
68
  attr_reader :datatype
66
69
  attr_reader :allowable_values
@@ -101,7 +104,8 @@ module MuxRuby
101
104
  :'encoding_tier' => :'encoding_tier',
102
105
  :'video_quality' => :'video_quality',
103
106
  :'static_renditions' => :'static_renditions',
104
- :'meta' => :'meta'
107
+ :'meta' => :'meta',
108
+ :'copy_overlays' => :'copy_overlays'
105
109
  }
106
110
  end
107
111
 
@@ -128,7 +132,8 @@ module MuxRuby
128
132
  :'encoding_tier' => :'String',
129
133
  :'video_quality' => :'String',
130
134
  :'static_renditions' => :'Array<CreateStaticRenditionRequest>',
131
- :'meta' => :'AssetMetadata'
135
+ :'meta' => :'AssetMetadata',
136
+ :'copy_overlays' => :'Boolean'
132
137
  }
133
138
  end
134
139
 
@@ -230,6 +235,12 @@ module MuxRuby
230
235
  if attributes.key?(:'meta')
231
236
  self.meta = attributes[:'meta']
232
237
  end
238
+
239
+ if attributes.key?(:'copy_overlays')
240
+ self.copy_overlays = attributes[:'copy_overlays']
241
+ else
242
+ self.copy_overlays = true
243
+ end
233
244
  end
234
245
 
235
246
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -325,7 +336,8 @@ module MuxRuby
325
336
  encoding_tier == o.encoding_tier &&
326
337
  video_quality == o.video_quality &&
327
338
  static_renditions == o.static_renditions &&
328
- meta == o.meta
339
+ meta == o.meta &&
340
+ copy_overlays == o.copy_overlays
329
341
  end
330
342
 
331
343
  # @see the `==` method
@@ -337,7 +349,7 @@ module MuxRuby
337
349
  # Calculates hash code according to all attributes.
338
350
  # @return [Integer] Hash code
339
351
  def hash
340
- [input, inputs, playback_policy, playback_policies, advanced_playback_policies, per_title_encode, passthrough, mp4_support, normalize_audio, master_access, test, max_resolution_tier, encoding_tier, video_quality, static_renditions, meta].hash
352
+ [input, inputs, playback_policy, playback_policies, advanced_playback_policies, per_title_encode, passthrough, mp4_support, normalize_audio, master_access, test, max_resolution_tier, encoding_tier, video_quality, static_renditions, meta, copy_overlays].hash
341
353
  end
342
354
 
343
355
  # Builds the object from hash
@@ -63,6 +63,8 @@ module MuxRuby
63
63
  # The time in seconds a live stream may be continuously active before being disconnected. Defaults to 12 hours.
64
64
  attr_accessor :max_continuous_duration
65
65
 
66
+ attr_accessor :meta
67
+
66
68
  class EnumAttributeValidator
67
69
  attr_reader :datatype
68
70
  attr_reader :allowable_values
@@ -104,7 +106,8 @@ module MuxRuby
104
106
  :'latency_mode' => :'latency_mode',
105
107
  :'test' => :'test',
106
108
  :'simulcast_targets' => :'simulcast_targets',
107
- :'max_continuous_duration' => :'max_continuous_duration'
109
+ :'max_continuous_duration' => :'max_continuous_duration',
110
+ :'meta' => :'meta'
108
111
  }
109
112
  end
110
113
 
@@ -132,7 +135,8 @@ module MuxRuby
132
135
  :'latency_mode' => :'String',
133
136
  :'test' => :'Boolean',
134
137
  :'simulcast_targets' => :'Array<CreateSimulcastTargetRequest>',
135
- :'max_continuous_duration' => :'Integer'
138
+ :'max_continuous_duration' => :'Integer',
139
+ :'meta' => :'LiveStreamMetadata'
136
140
  }
137
141
  end
138
142
 
@@ -242,6 +246,10 @@ module MuxRuby
242
246
  else
243
247
  self.max_continuous_duration = 43200
244
248
  end
249
+
250
+ if attributes.key?(:'meta')
251
+ self.meta = attributes[:'meta']
252
+ end
245
253
  end
246
254
 
247
255
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -338,7 +346,8 @@ module MuxRuby
338
346
  latency_mode == o.latency_mode &&
339
347
  test == o.test &&
340
348
  simulcast_targets == o.simulcast_targets &&
341
- max_continuous_duration == o.max_continuous_duration
349
+ max_continuous_duration == o.max_continuous_duration &&
350
+ meta == o.meta
342
351
  end
343
352
 
344
353
  # @see the `==` method
@@ -350,7 +359,7 @@ module MuxRuby
350
359
  # Calculates hash code according to all attributes.
351
360
  # @return [Integer] Hash code
352
361
  def hash
353
- [playback_policy, playback_policies, advanced_playback_policies, new_asset_settings, reconnect_window, use_slate_for_standard_latency, reconnect_slate_url, passthrough, audio_only, embedded_subtitles, generated_subtitles, reduced_latency, low_latency, latency_mode, test, simulcast_targets, max_continuous_duration].hash
362
+ [playback_policy, playback_policies, advanced_playback_policies, new_asset_settings, reconnect_window, use_slate_for_standard_latency, reconnect_slate_url, passthrough, audio_only, embedded_subtitles, generated_subtitles, reduced_latency, low_latency, latency_mode, test, simulcast_targets, max_continuous_duration, meta].hash
354
363
  end
355
364
 
356
365
  # Builds the object from hash
@@ -0,0 +1,266 @@
1
+ =begin
2
+ #Mux API
3
+
4
+ #Mux is how developers build online video. This API encompasses both Mux Video and Mux Data functionality to help you build your video-related projects better and faster than ever before.
5
+
6
+ The version of the OpenAPI document: v1
7
+ Contact: devex@mux.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.0.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module MuxRuby
17
+ class ListAnnotationsResponse
18
+ attr_accessor :data
19
+
20
+ # Total number of annotations available
21
+ attr_accessor :total_row_count
22
+
23
+ # Start and end unix timestamps for the data range
24
+ attr_accessor :timeframe
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'data' => :'data',
30
+ :'total_row_count' => :'total_row_count',
31
+ :'timeframe' => :'timeframe'
32
+ }
33
+ end
34
+
35
+ # Returns all the JSON keys this model knows about
36
+ def self.acceptable_attributes
37
+ attribute_map.values
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.openapi_types
42
+ {
43
+ :'data' => :'Array<Annotation>',
44
+ :'total_row_count' => :'Integer',
45
+ :'timeframe' => :'Array<Integer>'
46
+ }
47
+ end
48
+
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ ])
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MuxRuby::ListAnnotationsResponse` initialize method"
60
+ end
61
+
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!self.class.attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MuxRuby::ListAnnotationsResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'data')
71
+ if (value = attributes[:'data']).is_a?(Array)
72
+ self.data = value
73
+ end
74
+ end
75
+
76
+ if attributes.key?(:'total_row_count')
77
+ self.total_row_count = attributes[:'total_row_count']
78
+ end
79
+
80
+ if attributes.key?(:'timeframe')
81
+ if (value = attributes[:'timeframe']).is_a?(Array)
82
+ self.timeframe = value
83
+ end
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
+ if !@timeframe.nil? && @timeframe.length > 2
92
+ invalid_properties.push('invalid value for "timeframe", number of items must be less than or equal to 2.')
93
+ end
94
+
95
+ if !@timeframe.nil? && @timeframe.length < 2
96
+ invalid_properties.push('invalid value for "timeframe", number of items must be greater than or equal to 2.')
97
+ end
98
+
99
+ invalid_properties
100
+ end
101
+
102
+ # Check to see if the all the properties in the model are valid
103
+ # @return true if the model is valid
104
+ def valid?
105
+ return false if !@timeframe.nil? && @timeframe.length > 2
106
+ return false if !@timeframe.nil? && @timeframe.length < 2
107
+ true
108
+ end
109
+
110
+ # Custom attribute writer method with validation
111
+ # @param [Object] timeframe Value to be assigned
112
+ def timeframe=(timeframe)
113
+ if !timeframe.nil? && timeframe.length > 2
114
+ fail ArgumentError, 'invalid value for "timeframe", number of items must be less than or equal to 2.'
115
+ end
116
+
117
+ if !timeframe.nil? && timeframe.length < 2
118
+ fail ArgumentError, 'invalid value for "timeframe", number of items must be greater than or equal to 2.'
119
+ end
120
+
121
+ @timeframe = timeframe
122
+ end
123
+
124
+ # Checks equality by comparing each attribute.
125
+ # @param [Object] Object to be compared
126
+ def ==(o)
127
+ return true if self.equal?(o)
128
+ self.class == o.class &&
129
+ data == o.data &&
130
+ total_row_count == o.total_row_count &&
131
+ timeframe == o.timeframe
132
+ end
133
+
134
+ # @see the `==` method
135
+ # @param [Object] Object to be compared
136
+ def eql?(o)
137
+ self == o
138
+ end
139
+
140
+ # Calculates hash code according to all attributes.
141
+ # @return [Integer] Hash code
142
+ def hash
143
+ [data, total_row_count, timeframe].hash
144
+ end
145
+
146
+ # Builds the object from hash
147
+ # @param [Hash] attributes Model attributes in the form of hash
148
+ # @return [Object] Returns the model itself
149
+ def self.build_from_hash(attributes)
150
+ new.build_from_hash(attributes)
151
+ end
152
+
153
+ # Builds the object from hash
154
+ # @param [Hash] attributes Model attributes in the form of hash
155
+ # @return [Object] Returns the model itself
156
+ def build_from_hash(attributes)
157
+ return nil unless attributes.is_a?(Hash)
158
+ self.class.openapi_types.each_pair do |key, type|
159
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
160
+ self.send("#{key}=", nil)
161
+ elsif type =~ /\AArray<(.*)>/i
162
+ # check to ensure the input is an array given that the attribute
163
+ # is documented as an array but the input is not
164
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
165
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
166
+ end
167
+ elsif !attributes[self.class.attribute_map[key]].nil?
168
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
169
+ end
170
+ end
171
+
172
+ self
173
+ end
174
+
175
+ # Deserializes the data based on type
176
+ # @param string type Data type
177
+ # @param string value Value to be deserialized
178
+ # @return [Object] Deserialized data
179
+ def _deserialize(type, value)
180
+ case type.to_sym
181
+ when :Time
182
+ Time.parse(value)
183
+ when :Date
184
+ Date.parse(value)
185
+ when :String
186
+ value.to_s
187
+ when :Integer
188
+ value.to_i
189
+ when :Float
190
+ value.to_f
191
+ when :Boolean
192
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
193
+ true
194
+ else
195
+ false
196
+ end
197
+ when :Object
198
+ # generic object (usually a Hash), return directly
199
+ value
200
+ when /\AArray<(?<inner_type>.+)>\z/
201
+ inner_type = Regexp.last_match[:inner_type]
202
+ value.map { |v| _deserialize(inner_type, v) }
203
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
204
+ k_type = Regexp.last_match[:k_type]
205
+ v_type = Regexp.last_match[:v_type]
206
+ {}.tap do |hash|
207
+ value.each do |k, v|
208
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
209
+ end
210
+ end
211
+ else # model
212
+ # models (e.g. Pet) or oneOf
213
+ klass = MuxRuby.const_get(type)
214
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
215
+ end
216
+ end
217
+
218
+ # Returns the string representation of the object
219
+ # @return [String] String presentation of the object
220
+ def to_s
221
+ to_hash.to_s
222
+ end
223
+
224
+ # to_body is an alias to to_hash (backward compatibility)
225
+ # @return [Hash] Returns the object in the form of hash
226
+ def to_body
227
+ to_hash
228
+ end
229
+
230
+ # Returns the object in the form of hash
231
+ # @return [Hash] Returns the object in the form of hash
232
+ def to_hash
233
+ hash = {}
234
+ self.class.attribute_map.each_pair do |attr, param|
235
+ value = self.send(attr)
236
+ if value.nil?
237
+ is_nullable = self.class.openapi_nullable.include?(attr)
238
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
239
+ end
240
+
241
+ hash[param] = _to_hash(value)
242
+ end
243
+ hash
244
+ end
245
+
246
+ # Outputs non-array value in the form of hash
247
+ # For object, use to_hash. Otherwise, just return the value
248
+ # @param [Object] value Any valid value
249
+ # @return [Hash] Returns the value in the form of hash
250
+ def _to_hash(value)
251
+ if value.is_a?(Array)
252
+ value.compact.map { |v| _to_hash(v) }
253
+ elsif value.is_a?(Hash)
254
+ {}.tap do |hash|
255
+ value.each { |k, v| hash[k] = _to_hash(v) }
256
+ end
257
+ elsif value.respond_to? :to_hash
258
+ value.to_hash
259
+ else
260
+ value
261
+ end
262
+ end
263
+
264
+ end
265
+
266
+ end