class Ittybit::File

def self.from_json(json_object:)

Returns:
  • (Ittybit::File) -

Parameters:
  • json_object (String) --
def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  id = parsed_json["id"]
  media_id = parsed_json["media_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"]
  animated = parsed_json["animated"]
  frames = parsed_json["frames"]
  duration = parsed_json["duration"]
  fps = parsed_json["fps"]
  filesize = parsed_json["filesize"]
  bitrate = parsed_json["bitrate"]
  language = parsed_json["language"]
  label = parsed_json["label"]
  ref = parsed_json["ref"]
  folder = parsed_json["folder"]
  filename = parsed_json["filename"]
  url = parsed_json["url"]
  placeholder = parsed_json["placeholder"]
  background = parsed_json["background"]
  metadata = parsed_json["metadata"]
  original = parsed_json["original"]
  created_by = parsed_json["created_by"]
  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,
    media_id: media_id,
    object: object,
    kind: kind,
    type: type,
    codec: codec,
    container: container,
    width: width,
    height: height,
    orientation: orientation,
    rotation: rotation,
    transparency: transparency,
    animated: animated,
    frames: frames,
    duration: duration,
    fps: fps,
    filesize: filesize,
    bitrate: bitrate,
    language: language,
    label: label,
    ref: ref,
    folder: folder,
    filename: filename,
    url: url,
    placeholder: placeholder,
    background: background,
    metadata: metadata,
    original: original,
    created_by: created_by,
    created: created,
    updated: updated,
    status: status,
    additional_properties: struct
  )
end

def self.validate_raw(obj:)

Returns:
  • (Void) -

Parameters:
  • obj (Object) --
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.media_id.is_a?(String) != false || raise("Passed value for field obj.media_id is not the expected type, validation failed.")
  obj.object.is_a?(Ittybit::FileObject) != false || raise("Passed value for field obj.object is not the expected type, validation failed.")
  obj.kind.is_a?(Ittybit::FileKind) != 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?(String) != 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.animated&.is_a?(Boolean) != false || raise("Passed value for field obj.animated 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.language&.is_a?(String) != false || raise("Passed value for field obj.language is not the expected type, validation failed.")
  obj.label&.is_a?(String) != false || raise("Passed value for field obj.label 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.placeholder&.is_a?(String) != false || raise("Passed value for field obj.placeholder is not the expected type, validation failed.")
  obj.background&.is_a?(String) != false || raise("Passed value for field obj.background is not the expected type, validation failed.")
  obj.metadata&.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_by&.is_a?(String) != false || raise("Passed value for field obj.created_by 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::FileStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
end

def initialize(id:, media_id:, object:, kind:, type:, filesize:, url:, created:, updated:, status:, codec: OMIT, container: OMIT, width: OMIT, height: OMIT,

Returns:
  • (Ittybit::File) -

Parameters:
  • additional_properties (OpenStruct) -- Additional properties unmapped to the current class definition
  • status (Ittybit::FileStatus) --
  • updated (DateTime) --
  • created (DateTime) --
  • created_by (String) --
  • original (Boolean) --
  • metadata (Hash{String => Object}) --
  • background (String) --
  • placeholder (String) --
  • url (String) --
  • filename (String) --
  • folder (String) --
  • ref (String) --
  • label (String) --
  • language (String) --
  • bitrate (Integer) --
  • filesize (Integer) --
  • fps (Float) --
  • duration (Float) --
  • frames (Integer) --
  • animated (Boolean) --
  • transparency (Boolean) --
  • rotation (Float) --
  • orientation (String) --
  • height (Integer) --
  • width (Integer) --
  • container (String) --
  • codec (String) --
  • type (String) --
  • kind (Ittybit::FileKind) --
  • object (Ittybit::FileObject) --
  • media_id (String) --
  • id (String) --
def initialize(id:, media_id:, object:, kind:, type:, filesize:, url:, created:, updated:, status:, codec: OMIT, container: OMIT, width: OMIT, height: OMIT,
               orientation: OMIT, rotation: OMIT, transparency: OMIT, animated: OMIT, frames: OMIT, duration: OMIT, fps: OMIT, bitrate: OMIT, language: OMIT, label: OMIT, ref: OMIT, folder: OMIT, filename: OMIT, placeholder: OMIT, background: OMIT, metadata: OMIT, original: OMIT, created_by: OMIT, additional_properties: nil)
  @id = id
  @media_id = media_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
  @animated = animated if animated != OMIT
  @frames = frames if frames != OMIT
  @duration = duration if duration != OMIT
  @fps = fps if fps != OMIT
  @filesize = filesize
  @bitrate = bitrate if bitrate != OMIT
  @language = language if language != OMIT
  @label = label if label != OMIT
  @ref = ref if ref != OMIT
  @folder = folder if folder != OMIT
  @filename = filename if filename != OMIT
  @url = url
  @placeholder = placeholder if placeholder != OMIT
  @background = background if background != OMIT
  @metadata = metadata if metadata != OMIT
  @original = original if original != OMIT
  @created_by = created_by if created_by != OMIT
  @created = created
  @updated = updated
  @status = status
  @additional_properties = additional_properties
  @_field_set = {
    "id": id,
    "media_id": media_id,
    "object": object,
    "kind": kind,
    "type": type,
    "codec": codec,
    "container": container,
    "width": width,
    "height": height,
    "orientation": orientation,
    "rotation": rotation,
    "transparency": transparency,
    "animated": animated,
    "frames": frames,
    "duration": duration,
    "fps": fps,
    "filesize": filesize,
    "bitrate": bitrate,
    "language": language,
    "label": label,
    "ref": ref,
    "folder": folder,
    "filename": filename,
    "url": url,
    "placeholder": placeholder,
    "background": background,
    "metadata": metadata,
    "original": original,
    "created_by": created_by,
    "created": created,
    "updated": updated,
    "status": status
  }.reject do |_k, v|
    v == OMIT
  end
end

def to_json(*_args)

Returns:
  • (String) -
def to_json(*_args)
  @_field_set&.to_json
end