Class: Ittybit::MediaSource

Inherits:
Object
  • Object
show all
Defined in:
lib/ittybit/types/media_source.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, object:, kind:, type:, filesize:, url:, created:, updated:, status:, codec: OMIT, container: OMIT, width: OMIT, height: OMIT, orientation: OMIT, rotation: OMIT, transparency: OMIT, frames: OMIT, duration: OMIT, fps: OMIT, bitrate: OMIT, ref: OMIT, folder: OMIT, filename: OMIT, metadata: OMIT, original: OMIT, additional_properties: nil) ⇒ Ittybit::MediaSource

Parameters:

  • id (String)
  • object (Ittybit::MediaSourceObject)
  • kind (Ittybit::MediaSourceKind)
  • type (String)
  • codec (String) (defaults to: OMIT)
  • container (String) (defaults to: OMIT)
  • width (Integer) (defaults to: OMIT)
  • height (Integer) (defaults to: OMIT)
  • orientation (Ittybit::MediaSourceOrientation) (defaults to: OMIT)
  • rotation (Float) (defaults to: OMIT)
  • transparency (Boolean) (defaults to: OMIT)
  • frames (Integer) (defaults to: OMIT)
  • duration (Float) (defaults to: OMIT)
  • fps (Float) (defaults to: OMIT)
  • filesize (Integer)
  • bitrate (Integer) (defaults to: OMIT)
  • ref (String) (defaults to: OMIT)
  • folder (String) (defaults to: OMIT)
  • filename (String) (defaults to: OMIT)
  • url (String)
  • metadata (Hash{String => Object}) (defaults to: OMIT)
  • original (Boolean) (defaults to: OMIT)
  • created (DateTime)
  • updated (DateTime)
  • status (Ittybit::MediaSourceStatus)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/ittybit/types/media_source.rb', line 98

def initialize(id:, object:, kind:, type:, filesize:, url:, created:, updated:, status:, codec: OMIT, container: OMIT, width: OMIT, height: OMIT,
               orientation: OMIT, rotation: OMIT, transparency: OMIT, frames: OMIT, duration: OMIT, fps: OMIT, bitrate: OMIT, ref: OMIT, folder: OMIT, filename: OMIT, metadata: OMIT, original: OMIT, additional_properties: nil)
  @id = id
  @object = object
  @kind = kind
  @type = type
  @codec = codec if codec != OMIT
  @container = container if container != OMIT
  @width = width if width != OMIT
  @height = height if height != OMIT
  @orientation = orientation if orientation != OMIT
  @rotation = rotation if rotation != OMIT
  @transparency = transparency if transparency != OMIT
  @frames = frames if frames != OMIT
  @duration = duration if duration != OMIT
  @fps = fps if fps != OMIT
  @filesize = filesize
  @bitrate = bitrate if bitrate != OMIT
  @ref = ref if ref != OMIT
  @folder = folder if folder != OMIT
  @filename = filename if filename != OMIT
  @url = url
   =  if  != OMIT
  @original = original if original != OMIT
  @created = created
  @updated = updated
  @status = status
  @additional_properties = additional_properties
  @_field_set = {
    "id": id,
    "object": object,
    "kind": kind,
    "type": type,
    "codec": codec,
    "container": container,
    "width": width,
    "height": height,
    "orientation": orientation,
    "rotation": rotation,
    "transparency": transparency,
    "frames": frames,
    "duration": duration,
    "fps": fps,
    "filesize": filesize,
    "bitrate": bitrate,
    "ref": ref,
    "folder": folder,
    "filename": filename,
    "url": url,
    "metadata": ,
    "original": original,
    "created": created,
    "updated": updated,
    "status": status
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



64
65
66
# File 'lib/ittybit/types/media_source.rb', line 64

def additional_properties
  @additional_properties
end

#bitrateInteger (readonly)

Returns:

  • (Integer)


44
45
46
# File 'lib/ittybit/types/media_source.rb', line 44

def bitrate
  @bitrate
end

#codecString (readonly)

Returns:

  • (String)


22
23
24
# File 'lib/ittybit/types/media_source.rb', line 22

def codec
  @codec
end

#containerString (readonly)

Returns:

  • (String)


24
25
26
# File 'lib/ittybit/types/media_source.rb', line 24

def container
  @container
end

#createdDateTime (readonly)

Returns:

  • (DateTime)


58
59
60
# File 'lib/ittybit/types/media_source.rb', line 58

def created
  @created
end

#durationFloat (readonly)

Returns:

  • (Float)


38
39
40
# File 'lib/ittybit/types/media_source.rb', line 38

def duration
  @duration
end

#filenameString (readonly)

Returns:

  • (String)


50
51
52
# File 'lib/ittybit/types/media_source.rb', line 50

def filename
  @filename
end

#filesizeInteger (readonly)

Returns:

  • (Integer)


42
43
44
# File 'lib/ittybit/types/media_source.rb', line 42

def filesize
  @filesize
end

#folderString (readonly)

Returns:

  • (String)


48
49
50
# File 'lib/ittybit/types/media_source.rb', line 48

def folder
  @folder
end

#fpsFloat (readonly)

Returns:

  • (Float)


40
41
42
# File 'lib/ittybit/types/media_source.rb', line 40

def fps
  @fps
end

#framesInteger (readonly)

Returns:

  • (Integer)


36
37
38
# File 'lib/ittybit/types/media_source.rb', line 36

def frames
  @frames
end

#heightInteger (readonly)

Returns:

  • (Integer)


28
29
30
# File 'lib/ittybit/types/media_source.rb', line 28

def height
  @height
end

#idString (readonly)

Returns:

  • (String)


14
15
16
# File 'lib/ittybit/types/media_source.rb', line 14

def id
  @id
end

#kindIttybit::MediaSourceKind (readonly)



18
19
20
# File 'lib/ittybit/types/media_source.rb', line 18

def kind
  @kind
end

#metadataHash{String => Object} (readonly)

Returns:

  • (Hash{String => Object})


54
55
56
# File 'lib/ittybit/types/media_source.rb', line 54

def 
  
end

#objectIttybit::MediaSourceObject (readonly)



16
17
18
# File 'lib/ittybit/types/media_source.rb', line 16

def object
  @object
end

#orientationIttybit::MediaSourceOrientation (readonly)



30
31
32
# File 'lib/ittybit/types/media_source.rb', line 30

def orientation
  @orientation
end

#originalBoolean (readonly)

Returns:

  • (Boolean)


56
57
58
# File 'lib/ittybit/types/media_source.rb', line 56

def original
  @original
end

#refString (readonly)

Returns:

  • (String)


46
47
48
# File 'lib/ittybit/types/media_source.rb', line 46

def ref
  @ref
end

#rotationFloat (readonly)

Returns:

  • (Float)


32
33
34
# File 'lib/ittybit/types/media_source.rb', line 32

def rotation
  @rotation
end

#statusIttybit::MediaSourceStatus (readonly)



62
63
64
# File 'lib/ittybit/types/media_source.rb', line 62

def status
  @status
end

#transparencyBoolean (readonly)

Returns:

  • (Boolean)


34
35
36
# File 'lib/ittybit/types/media_source.rb', line 34

def transparency
  @transparency
end

#typeString (readonly)

Returns:

  • (String)


20
21
22
# File 'lib/ittybit/types/media_source.rb', line 20

def type
  @type
end

#updatedDateTime (readonly)

Returns:

  • (DateTime)


60
61
62
# File 'lib/ittybit/types/media_source.rb', line 60

def updated
  @updated
end

#urlString (readonly)

Returns:

  • (String)


52
53
54
# File 'lib/ittybit/types/media_source.rb', line 52

def url
  @url
end

#widthInteger (readonly)

Returns:

  • (Integer)


26
27
28
# File 'lib/ittybit/types/media_source.rb', line 26

def width
  @width
end

Class Method Details

.from_json(json_object:) ⇒ Ittybit::MediaSource

Deserialize a JSON object to an instance of MediaSource

Parameters:

  • json_object (String)

Returns:



161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/ittybit/types/media_source.rb', line 161

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  id = parsed_json["id"]
  object = parsed_json["object"]
  kind = parsed_json["kind"]
  type = parsed_json["type"]
  codec = parsed_json["codec"]
  container = parsed_json["container"]
  width = parsed_json["width"]
  height = parsed_json["height"]
  orientation = parsed_json["orientation"]
  rotation = parsed_json["rotation"]
  transparency = parsed_json["transparency"]
  frames = parsed_json["frames"]
  duration = parsed_json["duration"]
  fps = parsed_json["fps"]
  filesize = parsed_json["filesize"]
  bitrate = parsed_json["bitrate"]
  ref = parsed_json["ref"]
  folder = parsed_json["folder"]
  filename = parsed_json["filename"]
  url = parsed_json["url"]
   = parsed_json["metadata"]
  original = parsed_json["original"]
  created = (DateTime.parse(parsed_json["created"]) unless parsed_json["created"].nil?)
  updated = (DateTime.parse(parsed_json["updated"]) unless parsed_json["updated"].nil?)
  status = parsed_json["status"]
  new(
    id: id,
    object: object,
    kind: kind,
    type: type,
    codec: codec,
    container: container,
    width: width,
    height: height,
    orientation: orientation,
    rotation: rotation,
    transparency: transparency,
    frames: frames,
    duration: duration,
    fps: fps,
    filesize: filesize,
    bitrate: bitrate,
    ref: ref,
    folder: folder,
    filename: filename,
    url: url,
    metadata: ,
    original: original,
    created: created,
    updated: updated,
    status: status,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Leveraged for Union-type generation, validate_raw attempts to parse the given

hash and check each fields type against the current object's property
definitions.

Parameters:

  • obj (Object)

Returns:

  • (Void)


232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
# File 'lib/ittybit/types/media_source.rb', line 232

def self.validate_raw(obj:)
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
  obj.object.is_a?(Ittybit::MediaSourceObject) != false || raise("Passed value for field obj.object is not the expected type, validation failed.")
  obj.kind.is_a?(Ittybit::MediaSourceKind) != false || raise("Passed value for field obj.kind is not the expected type, validation failed.")
  obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
  obj.codec&.is_a?(String) != false || raise("Passed value for field obj.codec is not the expected type, validation failed.")
  obj.container&.is_a?(String) != false || raise("Passed value for field obj.container is not the expected type, validation failed.")
  obj.width&.is_a?(Integer) != false || raise("Passed value for field obj.width is not the expected type, validation failed.")
  obj.height&.is_a?(Integer) != false || raise("Passed value for field obj.height is not the expected type, validation failed.")
  obj.orientation&.is_a?(Ittybit::MediaSourceOrientation) != false || raise("Passed value for field obj.orientation is not the expected type, validation failed.")
  obj.rotation&.is_a?(Float) != false || raise("Passed value for field obj.rotation is not the expected type, validation failed.")
  obj.transparency&.is_a?(Boolean) != false || raise("Passed value for field obj.transparency is not the expected type, validation failed.")
  obj.frames&.is_a?(Integer) != false || raise("Passed value for field obj.frames is not the expected type, validation failed.")
  obj.duration&.is_a?(Float) != false || raise("Passed value for field obj.duration is not the expected type, validation failed.")
  obj.fps&.is_a?(Float) != false || raise("Passed value for field obj.fps is not the expected type, validation failed.")
  obj.filesize.is_a?(Integer) != false || raise("Passed value for field obj.filesize is not the expected type, validation failed.")
  obj.bitrate&.is_a?(Integer) != false || raise("Passed value for field obj.bitrate is not the expected type, validation failed.")
  obj.ref&.is_a?(String) != false || raise("Passed value for field obj.ref is not the expected type, validation failed.")
  obj.folder&.is_a?(String) != false || raise("Passed value for field obj.folder is not the expected type, validation failed.")
  obj.filename&.is_a?(String) != false || raise("Passed value for field obj.filename is not the expected type, validation failed.")
  obj.url.is_a?(String) != false || raise("Passed value for field obj.url is not the expected type, validation failed.")
  obj.&.is_a?(Hash) != false || raise("Passed value for field obj.metadata is not the expected type, validation failed.")
  obj.original&.is_a?(Boolean) != false || raise("Passed value for field obj.original is not the expected type, validation failed.")
  obj.created.is_a?(DateTime) != false || raise("Passed value for field obj.created is not the expected type, validation failed.")
  obj.updated.is_a?(DateTime) != false || raise("Passed value for field obj.updated is not the expected type, validation failed.")
  obj.status.is_a?(Ittybit::MediaSourceStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of MediaSource to a JSON object

Returns:

  • (String)


222
223
224
# File 'lib/ittybit/types/media_source.rb', line 222

def to_json(*_args)
  @_field_set&.to_json
end