lib/rev-api/models/order_request.rb in rev-api-2.0.0 vs lib/rev-api/models/order_request.rb in rev-api-2.0.1

- old
+ new

@@ -3,21 +3,21 @@ module Rev # OrderRequest is used for constructing order 'spec' in consumer code and passing it into. # It consists of three main elements: :payment, :transcription_options and :notification. # You can also supply priority, reference number, and customer comment # - # @note http://www.rev.com/api/ordersposttranscription, http://www.rev.com/api/ordersposttranslation, http://www.rev.com/api/orderspostcaption + # @note https://www.rev.com/api/ordersposttranscription, https://www.rev.com/api/ordersposttranslation, https://www.rev.com/api/orderspostcaption class OrderRequest < ApiSerializable # see {Rev::Payment} attr_reader :payment # see {Rev::TranscriptionOptions} attr_reader :transcription_options # see {Rev::TranslationOptions} attr_reader :translation_options - + # see {Rev::CaptionOptions} attr_reader :caption_options # see {Rev::Notification} attr_reader :notification @@ -25,23 +25,23 @@ # a reference number for the order meaningful for the client (optional) attr_reader :client_ref # a comment with any special messages about the order (optional) attr_reader :comment - + # a requested priority for the order, defaults to normal (optional) attr_reader :priority - + # use to correctly set priority PRIORITY = { :normal => 'Normal', :time_insensitivie => 'TimeInsensitivie' } # @param payment [Payment] payment info # @param fields [Hash] of fields to initialize instance. See instance attributes for available fields. - # @deprecated payment always defaults to :accoount_balance + # @deprecated payment always defaults to :account_balance def self.new_with_payment(payment, fields = {}) fields = { :priority => PRIORITY[:normal] }.merge(fields) super fields @payment = payment end @@ -73,11 +73,11 @@ end class << self def with_account_balance() Payment::new(TYPES[:account_balance]) - end + end end end # Billing address class BillingAddress < ApiSerializable @@ -96,19 +96,19 @@ raise(ArgumentError, "inputs must have at least one element") unless validate_inputs(inputs) @inputs = inputs end private - + def validate_inputs(inputs) !inputs.nil? && inputs.length > 0 end end # Transcription options. This section contains the input media that must be transferred to our servers # using a POST to /inputs, and are referenced using the URIs returned by that call. We also support external links. - # @see http://www.rev.com/api/ordersposttranscription + # @see https://www.rev.com/api/ordersposttranscription class TranscriptionOptions < InputOptions # Optional, should we transcribe the provided files verbatim? If true, # all filler words (i.e. umm, huh) will be included. attr_reader :verbatim @@ -116,21 +116,21 @@ attr_reader :timestamps # @param inputs [Array] list of inputs # @param info [Hash] of fields to initialize instance. May contain: # - :verbatim => true/false - # - :timestams => true/false + # - :timestamps => true/false def initialize(inputs, info = {}) super inputs, info end end # Translation options. This section contains the input media that must be transferred to our # servers using a POST to /inputs, and are referenced using the URIs returned by that call. # For each media, word count must be specified. The language code for the source and desitination # languages must also be specified. - # @see http://www.rev.com/api/ordersposttranslation + # @see https://www.rev.com/api/ordersposttranslation class TranslationOptions < InputOptions # Mandatory, source language code attr_reader :source_language_code # Mandatory, destination language code @@ -143,14 +143,14 @@ # @note For language codes refer to http://www.loc.gov/standards/iso639-2/php/code_list.php def initialize(inputs, info = {}) super inputs, info end end - + # Caption options. This section contains the input media that must be transferred to our servers # using a POST to /inputs, and are referenced using the URIs returned by that call. We also support external links. - # @see http://www.rev.com/api/orderspostcaption + # @see https://www.rev.com/api/orderspostcaption class CaptionOptions < InputOptions # Array of file formats the captions should be delivered as. (Optional, default is SubRip) attr_reader :output_file_formats # All supported output file formats @@ -158,18 +158,18 @@ :subrip => 'SubRip', :scc => 'Scc', :ttml => 'Ttml', :qttext => 'QTtext' } - + def initialize(inputs, info = {}) super(inputs, info) raise(ArgumentError, "invalid format(s)") unless validate_output_formats(info[:output_file_formats]) end - + private - + def validate_output_formats(formats) formats.nil? || formats.select{|f| !OUTPUT_FILE_FORMATS.has_value?(f) }.empty? end end @@ -179,10 +179,10 @@ attr_reader :word_length # Length of audio in seconds (mandatory in case of inability to determine it automatically). # Used within {Rev::OrderRequest::TranscriptionInfo} attr_reader :audio_length_seconds - + # Length of video in seconds (mandatory in case of inability to determine it automatically). # Used within {Rev::OrderRequest::CaptionInfo} attr_reader :video_length_seconds # Mandatory, URI of the media, as returned from the call to POST /inputs.