Class: AdvancedBilling::CreateInvoicePayment
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::CreateInvoicePayment
- Defined in:
- lib/advanced_billing/models/create_invoice_payment.rb
Overview
CreateInvoicePayment Model.
Instance Attribute Summary collapse
-
#amount ⇒ Object
A string of the dollar amount to be refunded (eg. “10.50” => $10.50).
-
#details ⇒ String
Additional information related to the payment method (eg. Check #).
-
#memo ⇒ String
A description to be attached to the payment.
-
#method ⇒ InvoicePaymentMethodType
The type of payment method used.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(amount = SKIP, memo = SKIP, method = InvoicePaymentMethodType::OTHER, details = SKIP) ⇒ CreateInvoicePayment
constructor
A new instance of CreateInvoicePayment.
Methods inherited from BaseModel
Constructor Details
#initialize(amount = SKIP, memo = SKIP, method = InvoicePaymentMethodType::OTHER, details = SKIP) ⇒ CreateInvoicePayment
Returns a new instance of CreateInvoicePayment.
53 54 55 56 57 58 59 |
# File 'lib/advanced_billing/models/create_invoice_payment.rb', line 53 def initialize(amount = SKIP, memo = SKIP, method = InvoicePaymentMethodType::OTHER, details = SKIP) @amount = amount unless amount == SKIP @memo = memo unless memo == SKIP @method = method unless method == SKIP @details = details unless details == SKIP end |
Instance Attribute Details
#amount ⇒ Object
A string of the dollar amount to be refunded (eg. “10.50” => $10.50)
14 15 16 |
# File 'lib/advanced_billing/models/create_invoice_payment.rb', line 14 def amount @amount end |
#details ⇒ String
Additional information related to the payment method (eg. Check #)
26 27 28 |
# File 'lib/advanced_billing/models/create_invoice_payment.rb', line 26 def details @details end |
#memo ⇒ String
A description to be attached to the payment.
18 19 20 |
# File 'lib/advanced_billing/models/create_invoice_payment.rb', line 18 def memo @memo end |
#method ⇒ InvoicePaymentMethodType
The type of payment method used.
22 23 24 |
# File 'lib/advanced_billing/models/create_invoice_payment.rb', line 22 def method @method end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/advanced_billing/models/create_invoice_payment.rb', line 62 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. amount = hash.key?('amount') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:CreateInvoicePaymentAmount), hash['amount'] ) : SKIP memo = hash.key?('memo') ? hash['memo'] : SKIP method = hash['method'] ||= InvoicePaymentMethodType::OTHER details = hash.key?('details') ? hash['details'] : SKIP # Create object from extracted values. CreateInvoicePayment.new(amount, memo, method, details) end |
.names ⇒ Object
A mapping from model property names to API property names.
29 30 31 32 33 34 35 36 |
# File 'lib/advanced_billing/models/create_invoice_payment.rb', line 29 def self.names @_hash = {} if @_hash.nil? @_hash['amount'] = 'amount' @_hash['memo'] = 'memo' @_hash['method'] = 'method' @_hash['details'] = 'details' @_hash end |
.nullables ⇒ Object
An array for nullable fields
49 50 51 |
# File 'lib/advanced_billing/models/create_invoice_payment.rb', line 49 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
39 40 41 42 43 44 45 46 |
# File 'lib/advanced_billing/models/create_invoice_payment.rb', line 39 def self.optionals %w[ amount memo method details ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
82 83 84 85 86 87 88 |
# File 'lib/advanced_billing/models/create_invoice_payment.rb', line 82 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |