Class: Rev::Attachment

Inherits:
ApiSerializable show all
Defined in:
lib/rev-api/models/order.rb

Overview

Represents order attachment - logical document associated with order

Constant Summary collapse

KINDS =
{
  :transcript => 'transcript',
  :caption => 'caption',
  :media => 'media'
}
REPRESENTATIONS =

List of supported mime-types used to request attachment’s content within ‘Accept’ header

{
  # Supported by :transcript
  :docx => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
  :pdf => 'application/pdf',
  :txt => 'text/plain',
  :youtube => 'text/plain; format=youtube-transcript',

  # Supported by :caption
  :srt => 'application/x-subrip',
  :scc => 'text/x-scc',
  :mcc => 'text/x-mcc',
  :ttml => 'application/ttml+xml',
  :qt => 'application/x-quicktime-timedtext',
  :vtt => 'text/vtt',
  :dfxp => 'application/ttaf+xml',
  :cap => 'application/x-cheetah-cap',
  :stl => 'text/x-stl',
  :avidds => 'text/vnd.avid-ds'
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiSerializable

#to_hash, #to_json

Constructor Details

#initialize(fields) ⇒ Attachment

Returns a new instance of Attachment.

Parameters:

  • fields (Hash)

    fields of attachment fields parsed from JSON API response



102
103
104
105
# File 'lib/rev-api/models/order.rb', line 102

def initialize(fields)
  super fields
  @links = fields['links'].map { |link_fields| Link.new(link_fields) }
end

Instance Attribute Details

#audio_length_secondsObject (readonly)

Returns the value of attribute audio_length_seconds.



71
72
73
# File 'lib/rev-api/models/order.rb', line 71

def audio_length_seconds
  @audio_length_seconds
end

#idObject (readonly)

Returns the value of attribute id.



71
72
73
# File 'lib/rev-api/models/order.rb', line 71

def id
  @id
end

#kindObject (readonly)

Returns the value of attribute kind.



71
72
73
# File 'lib/rev-api/models/order.rb', line 71

def kind
  @kind
end

Returns the value of attribute links.



71
72
73
# File 'lib/rev-api/models/order.rb', line 71

def links
  @links
end

#nameObject (readonly)

Returns the value of attribute name.



71
72
73
# File 'lib/rev-api/models/order.rb', line 71

def name
  @name
end

#video_length_secondsObject (readonly)

Returns the value of attribute video_length_seconds.



71
72
73
# File 'lib/rev-api/models/order.rb', line 71

def video_length_seconds
  @video_length_seconds
end

Class Method Details

.representation_mime(ext) ⇒ String

Returns mime-type for requested extension.

Parameters:

  • ext (Symbol)

    extension

Returns:

  • (String)

    mime-type for requested extension



109
110
111
# File 'lib/rev-api/models/order.rb', line 109

def self.representation_mime(ext)
  REPRESENTATIONS[ext]
end