Class: Rev::Order
- Inherits:
-
ApiSerializable
- Object
- ApiSerializable
- Rev::Order
- Defined in:
- lib/rev-api/models/order.rb
Overview
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
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.
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”.
Methods inherited from ApiSerializable
Constructor Details
#initialize(fields) ⇒ Order
Returns a new instance of Order.
14 15 16 17 18 19 20 |
# 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) } @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 |
Instance Method Details
#captions ⇒ Array of Attachment
Returns with the kind of “caption”.
28 29 30 |
# File 'lib/rev-api/models/order.rb', line 28 def captions @attachments.select { |a| a.kind == Attachment::KINDS[:caption] } end |
#sources ⇒ Array of Attachment
Returns with the kind of “sources”.
33 34 35 |
# File 'lib/rev-api/models/order.rb', line 33 def sources @attachments.select { |a| a.kind == Attachment::KINDS[:media]} end |
#transcripts ⇒ Array of Attachment
Returns with the kind of “transcript”.
23 24 25 |
# File 'lib/rev-api/models/order.rb', line 23 def transcripts @attachments.select { |a| a.kind == Attachment::KINDS[:transcript]} end |