class Rev::Order

Represents a Caption or Transcription order. Should have CaptionInfo or TranscriptionInfo, list of comments and attachments. Attributes names reflect API exposed names, but occasional hyphens are replaced with underscores

Attributes

attachments[R]
caption[R]
client_ref[R]
comments[R]
order_number[R]
price[R]
status[R]
transcription[R]

Public Class Methods

new(fields) click to toggle source

@param fields [Hash] hash of order fields parsed from JSON API response

Calls superclass method Rev::ApiSerializable::new
# File lib/rev-api/models/order.rb, line 14
def initialize(fields)
  super fields
  @attachments = fields['attachments'].map { |attachment_fields| Attachment.new(attachment_fields) }
  @comments = fields['comments'].map { |comment_fields| Comment.new(comment_fields) }
  @transcription = TranscriptionInfo.new(fields['transcription']) if fields['transcription']
  @caption = CaptionInfo.new(fields['caption']) if fields['caption']
end

Public Instance Methods

captions() click to toggle source

@return [Array of Attachment] with the kind of “caption”

# File lib/rev-api/models/order.rb, line 28
def captions
  @attachments.select { |a| a.kind == Attachment::KINDS[:caption] }
end
sources() click to toggle source

@return [Array of Attachment] with the kind of “sources”

# File lib/rev-api/models/order.rb, line 33
def sources
  @attachments.select { |a| a.kind == Attachment::KINDS[:media]}
end
transcripts() click to toggle source

@return [Array of Attachment] with the kind of “transcript”

# File lib/rev-api/models/order.rb, line 23
def transcripts
  @attachments.select { |a| a.kind == Attachment::KINDS[:transcript]}
end