lib/rev-api/models/order_request.rb in rev-api-1.0.4 vs lib/rev-api/models/order_request.rb in rev-api-2.0.0
- old
+ new
@@ -37,52 +37,44 @@
:time_insensitivie => 'TimeInsensitivie'
}
# @param payment [Payment] payment info
# @param fields [Hash] of fields to initialize instance. See instance attributes for available fields.
- def initialize(payment, fields = {})
+ # @deprecated payment always defaults to :accoount_balance
+ def self.new_with_payment(payment, fields = {})
fields = { :priority => PRIORITY[:normal] }.merge(fields)
super fields
@payment = payment
end
+
+ # @param fields [Hash] of fields to initialize instance. See instance attributes for available fields.
+ def initialize(fields = {})
+ fields = { :priority => PRIORITY[:normal] }.merge(fields)
+ @payment = Rev::Payment.with_account_balance
+ super fields
+ end
end
- # Payment Info. Payment can be done either by charging a credit card or by debiting the user's
- # account balance. If using a credit card, then either the user's saved credit card can be used
- # or credit card details provided.
- #
- # For credit card payments, if specifying the credit card details in the request, the required
- # elements are the card number, cardholder name, expiration month and year, and billing zipcode.
- # If using the user's saved card, you must currently specify the value "1" for the saved card id,
- # as we currently only allow a single card to be saved for a user.
+ # Payment Info. Payment can only be done by debiting the user's account balance.
+ # @deprecated setting the payment is no longer necessary. All orders now default to :account_balance
class Payment < ApiSerializable
- attr_accessor :type, :credit_card
+ attr_accessor :type
# use to correctly set payment type
TYPES = {
- :credit_card => 'CreditCard',
:account_balance => 'AccountBalance'
}
CC_ON_FILE_ID = 1
# @param type [String] payment method
- # @param credit_card [CreditCard] cc obj, if type is 'CreditCard'
- def initialize(type, credit_card = nil)
+ def initialize(type)
+ warn "[DEPRECATION] `Payment` option is now optional, since it will always default to AccountBalance"
@type = type
- @credit_card = credit_card unless credit_card.nil?
end
class << self
- def with_credit_card_on_file()
- Payment::new(TYPES[:credit_card], CreditCard.new(:saved_id => CC_ON_FILE_ID))
- end
-
- def with_saved_credit_card(credit_card)
- Payment::new(TYPES[:credit_card], credit_card)
- end
-
def with_account_balance()
Payment::new(TYPES[:account_balance])
end
end
end
@@ -90,15 +82,10 @@
# Billing address
class BillingAddress < ApiSerializable
attr_reader :street, :street2, :city, :state, :zip, :country_alpha2
end
- # Credit Card
- class CreditCard < ApiSerializable
- attr_reader :number, :expiration_month, :expiration_year, :cardholder, :billing_address, :saved_id
- end
-
# Superclass for the business-line options that handles capture and common validation of inputs.
class InputOptions < ApiSerializable
# Mandatory, contains list of inputs. Must have at least one element.
attr_reader :inputs
@@ -189,12 +176,16 @@
# Input for order (aka source file)
class Input < ApiSerializable
# Mandatory when used with {Rev::OrderRequest::TranslationInfo}, length of document, in words
attr_reader :word_length
- # Length of audio, in minutes (mandatory in case of inability to determine it automatically).
- # Used within {Rev::OrderRequest::TranscriptionInfo} and {Rev::OrderRequest::CaptionInfo}
- attr_reader :audio_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.
# :external_link might substitute :uri for Transcription or Caption.
attr_reader :uri