Class: AdvancedBilling::ApplyDebitNoteEventData
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::ApplyDebitNoteEventData
- Defined in:
- lib/advanced_billing/models/apply_debit_note_event_data.rb
Overview
Example schema for an ‘apply_debit_note` event
Instance Attribute Summary collapse
-
#applied_amount ⇒ String
The amount of the debit note applied to invoice.
-
#debit_note_number ⇒ String
A unique, identifying string that appears on the debit note and in places it is referenced.
-
#debit_note_uid ⇒ String
Unique identifier for the debit note.
-
#original_amount ⇒ String
The full, original amount of the debit note.
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(debit_note_number = SKIP, debit_note_uid = SKIP, original_amount = SKIP, applied_amount = SKIP) ⇒ ApplyDebitNoteEventData
constructor
A new instance of ApplyDebitNoteEventData.
Methods inherited from BaseModel
Constructor Details
#initialize(debit_note_number = SKIP, debit_note_uid = SKIP, original_amount = SKIP, applied_amount = SKIP) ⇒ ApplyDebitNoteEventData
Returns a new instance of ApplyDebitNoteEventData.
55 56 57 58 59 60 61 |
# File 'lib/advanced_billing/models/apply_debit_note_event_data.rb', line 55 def initialize(debit_note_number = SKIP, debit_note_uid = SKIP, original_amount = SKIP, applied_amount = SKIP) @debit_note_number = debit_note_number unless debit_note_number == SKIP @debit_note_uid = debit_note_uid unless debit_note_uid == SKIP @original_amount = original_amount unless original_amount == SKIP @applied_amount = applied_amount unless applied_amount == SKIP end |
Instance Attribute Details
#applied_amount ⇒ String
The amount of the debit note applied to invoice.
28 29 30 |
# File 'lib/advanced_billing/models/apply_debit_note_event_data.rb', line 28 def applied_amount @applied_amount end |
#debit_note_number ⇒ String
A unique, identifying string that appears on the debit note and in places it is referenced.
15 16 17 |
# File 'lib/advanced_billing/models/apply_debit_note_event_data.rb', line 15 def debit_note_number @debit_note_number end |
#debit_note_uid ⇒ String
Unique identifier for the debit note. It is generated automatically by Chargify and has the prefix “db_” followed by alphanumeric characters.
20 21 22 |
# File 'lib/advanced_billing/models/apply_debit_note_event_data.rb', line 20 def debit_note_uid @debit_note_uid end |
#original_amount ⇒ String
The full, original amount of the debit note.
24 25 26 |
# File 'lib/advanced_billing/models/apply_debit_note_event_data.rb', line 24 def original_amount @original_amount end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/advanced_billing/models/apply_debit_note_event_data.rb', line 64 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. debit_note_number = hash.key?('debit_note_number') ? hash['debit_note_number'] : SKIP debit_note_uid = hash.key?('debit_note_uid') ? hash['debit_note_uid'] : SKIP original_amount = hash.key?('original_amount') ? hash['original_amount'] : SKIP applied_amount = hash.key?('applied_amount') ? hash['applied_amount'] : SKIP # Create object from extracted values. ApplyDebitNoteEventData.new(debit_note_number, debit_note_uid, original_amount, applied_amount) end |
.names ⇒ Object
A mapping from model property names to API property names.
31 32 33 34 35 36 37 38 |
# File 'lib/advanced_billing/models/apply_debit_note_event_data.rb', line 31 def self.names @_hash = {} if @_hash.nil? @_hash['debit_note_number'] = 'debit_note_number' @_hash['debit_note_uid'] = 'debit_note_uid' @_hash['original_amount'] = 'original_amount' @_hash['applied_amount'] = 'applied_amount' @_hash end |
.nullables ⇒ Object
An array for nullable fields
51 52 53 |
# File 'lib/advanced_billing/models/apply_debit_note_event_data.rb', line 51 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
41 42 43 44 45 46 47 48 |
# File 'lib/advanced_billing/models/apply_debit_note_event_data.rb', line 41 def self.optionals %w[ debit_note_number debit_note_uid original_amount applied_amount ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
86 87 88 89 90 91 92 |
# File 'lib/advanced_billing/models/apply_debit_note_event_data.rb', line 86 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |