Class: Rev::Order
- Inherits:
-
ApiSerializable
- Object
- ApiSerializable
- Rev::Order
- Defined in:
- lib/rev-api/models/order.rb
Overview
Represents Translation, Caption, or Transcription order. Should have TranslationInfo, CaptionInfo, or TranscriptionInfo, list of comments and attachments. Attributes names reflect API exposed names, but occasional hyphens are replaced with underscores
Instance Attribute Summary collapse
-
#attachments ⇒ Object
readonly
Returns the value of attribute attachments.
-
#caption ⇒ Object
readonly
Returns the value of attribute caption.
-
#client_ref ⇒ Object
readonly
Returns the value of attribute client_ref.
-
#comments ⇒ Object
readonly
Returns the value of attribute comments.
-
#order_number ⇒ Object
readonly
Returns the value of attribute order_number.
-
#price ⇒ Object
readonly
Returns the value of attribute price.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#transcription ⇒ Object
readonly
Returns the value of attribute transcription.
-
#translation ⇒ Object
readonly
Returns the value of attribute translation.
Instance Method Summary collapse
-
#captions ⇒ Array of Attachment
With the kind of “caption”.
-
#initialize(fields) ⇒ Order
constructor
A new instance of Order.
-
#sources ⇒ Array of Attachment
With the kind of “sources”.
-
#transcripts ⇒ Array of Attachment
With the kind of “transcript”.
-
#translations ⇒ Array of Attachment
With the kind of “translation”.
Methods inherited from ApiSerializable
Constructor Details
#initialize(fields) ⇒ Order
Returns a new instance of Order.
14 15 16 17 18 19 20 21 |
# File 'lib/rev-api/models/order.rb', line 14 def initialize(fields) super fields @attachments = fields['attachments'].map { || Attachment.new() } @comments = fields['comments'].map { |comment_fields| Comment.new(comment_fields) } @translation = TranslationInfo.new(fields['translation']) if fields['translation'] @transcription = TranscriptionInfo.new(fields['transcription']) if fields['transcription'] @caption = CaptionInfo.new(fields['caption']) if fields['caption'] end |
Instance Attribute Details
#attachments ⇒ Object (readonly)
Returns the value of attribute attachments.
10 11 12 |
# File 'lib/rev-api/models/order.rb', line 10 def @attachments end |
#caption ⇒ Object (readonly)
Returns the value of attribute caption.
10 11 12 |
# File 'lib/rev-api/models/order.rb', line 10 def caption @caption end |
#client_ref ⇒ Object (readonly)
Returns the value of attribute client_ref.
10 11 12 |
# File 'lib/rev-api/models/order.rb', line 10 def client_ref @client_ref end |
#comments ⇒ Object (readonly)
Returns the value of attribute comments.
10 11 12 |
# File 'lib/rev-api/models/order.rb', line 10 def comments @comments end |
#order_number ⇒ Object (readonly)
Returns the value of attribute order_number.
10 11 12 |
# File 'lib/rev-api/models/order.rb', line 10 def order_number @order_number end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
10 11 12 |
# File 'lib/rev-api/models/order.rb', line 10 def price @price end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
10 11 12 |
# File 'lib/rev-api/models/order.rb', line 10 def status @status end |
#transcription ⇒ Object (readonly)
Returns the value of attribute transcription.
10 11 12 |
# File 'lib/rev-api/models/order.rb', line 10 def transcription @transcription end |
#translation ⇒ Object (readonly)
Returns the value of attribute translation.
10 11 12 |
# File 'lib/rev-api/models/order.rb', line 10 def translation @translation end |
Instance Method Details
#captions ⇒ Array of Attachment
Returns with the kind of “caption”.
34 35 36 |
# File 'lib/rev-api/models/order.rb', line 34 def captions @attachments.select { |a| a.kind == Attachment::KINDS[:caption] } end |
#sources ⇒ Array of Attachment
Returns with the kind of “sources”.
39 40 41 |
# File 'lib/rev-api/models/order.rb', line 39 def sources @attachments.select { |a| a.kind == Attachment::KINDS[:media]} end |
#transcripts ⇒ Array of Attachment
Returns with the kind of “transcript”.
24 25 26 |
# File 'lib/rev-api/models/order.rb', line 24 def transcripts @attachments.select { |a| a.kind == Attachment::KINDS[:transcript]} end |
#translations ⇒ Array of Attachment
Returns with the kind of “translation”.
29 30 31 |
# File 'lib/rev-api/models/order.rb', line 29 def translations @attachments.select { |a| a.kind == Attachment::KINDS[:translation]} end |