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',
  :translation => 'translation',
  :caption => 'caption',
  :media => 'media'
}
REPRESENTATIONS =

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

{
  # Supported by :transcript and :translation
  :docx => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
  :doc => 'application/msword',
  :pdf => 'application/pdf',
  :txt => 'text/plain',
  :youtube => 'text/plain; format=youtube-transcript',
  
  # Supported by :caption
  :srt => 'application/x-subrip',
  :scc => 'text/x-scc',
  :ttml => 'application/ttml+xml',
  :qt => 'application/x-quicktime-timedtext'
}

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



111
112
113
114
# File 'lib/rev-api/models/order.rb', line 111

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.



84
85
86
# File 'lib/rev-api/models/order.rb', line 84

def audio_length_seconds
  @audio_length_seconds
end

#idObject (readonly)

Returns the value of attribute id.



84
85
86
# File 'lib/rev-api/models/order.rb', line 84

def id
  @id
end

#kindObject (readonly)

Returns the value of attribute kind.



84
85
86
# File 'lib/rev-api/models/order.rb', line 84

def kind
  @kind
end

Returns the value of attribute links.



84
85
86
# File 'lib/rev-api/models/order.rb', line 84

def links
  @links
end

#nameObject (readonly)

Returns the value of attribute name.



84
85
86
# File 'lib/rev-api/models/order.rb', line 84

def name
  @name
end

#video_length_secondsObject (readonly)

Returns the value of attribute video_length_seconds.



84
85
86
# File 'lib/rev-api/models/order.rb', line 84

def video_length_seconds
  @video_length_seconds
end

#word_countObject (readonly)

Returns the value of attribute word_count.



84
85
86
# File 'lib/rev-api/models/order.rb', line 84

def word_count
  @word_count
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



118
119
120
# File 'lib/rev-api/models/order.rb', line 118

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