Class: ApiReference::CreditNoteLineItemParams
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ApiReference::CreditNoteLineItemParams
- Defined in:
- lib/api_reference/models/credit_note_line_item_params.rb
Overview
CreditNoteLineItemParams Model.
Instance Attribute Summary collapse
-
#amount ⇒ String
The total amount in the invoice's currency to credit this line item.
-
#end_date ⇒ Date
A date string to specify this line item's credit note service period end date in the customer's timezone.
-
#invoice_line_item_id ⇒ String
The ID of the line item to credit.
-
#start_date ⇒ Date
A date string to specify this line item's credit note service period start date in the customer's timezone.
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.
Instance Method Summary collapse
-
#initialize(invoice_line_item_id:, amount:, start_date: SKIP, end_date: SKIP, additional_properties: nil) ⇒ CreditNoteLineItemParams
constructor
A new instance of CreditNoteLineItemParams.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(invoice_line_item_id:, amount:, start_date: SKIP, end_date: SKIP, additional_properties: nil) ⇒ CreditNoteLineItemParams
Returns a new instance of CreditNoteLineItemParams.
62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/api_reference/models/credit_note_line_item_params.rb', line 62 def initialize(invoice_line_item_id:, amount:, start_date: SKIP, end_date: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @invoice_line_item_id = invoice_line_item_id @amount = amount @start_date = start_date unless start_date == SKIP @end_date = end_date unless end_date == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#amount ⇒ String
The total amount in the invoice's currency to credit this line item.
18 19 20 |
# File 'lib/api_reference/models/credit_note_line_item_params.rb', line 18 def amount @amount end |
#end_date ⇒ Date
A date string to specify this line item's credit note service period end date in the customer's timezone. If provided, this will be used for this specific line item. If not provided, will use the global end_date if available, otherwise defaults to the original invoice line item's end date. This date is inclusive.
34 35 36 |
# File 'lib/api_reference/models/credit_note_line_item_params.rb', line 34 def end_date @end_date end |
#invoice_line_item_id ⇒ String
The ID of the line item to credit.
14 15 16 |
# File 'lib/api_reference/models/credit_note_line_item_params.rb', line 14 def invoice_line_item_id @invoice_line_item_id end |
#start_date ⇒ Date
A date string to specify this line item's credit note service period start date in the customer's timezone. If provided, this will be used for this specific line item. If not provided, will use the global start_date if available, otherwise defaults to the original invoice line item's start date. This date is inclusive.
26 27 28 |
# File 'lib/api_reference/models/credit_note_line_item_params.rb', line 26 def start_date @start_date end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/api_reference/models/credit_note_line_item_params.rb', line 75 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. invoice_line_item_id = hash.key?('invoice_line_item_id') ? hash['invoice_line_item_id'] : nil amount = hash.key?('amount') ? hash['amount'] : nil start_date = hash.key?('start_date') ? hash['start_date'] : SKIP end_date = hash.key?('end_date') ? hash['end_date'] : SKIP # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. CreditNoteLineItemParams.new(invoice_line_item_id: invoice_line_item_id, amount: amount, start_date: start_date, end_date: end_date, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
37 38 39 40 41 42 43 44 |
# File 'lib/api_reference/models/credit_note_line_item_params.rb', line 37 def self.names @_hash = {} if @_hash.nil? @_hash['invoice_line_item_id'] = 'invoice_line_item_id' @_hash['amount'] = 'amount' @_hash['start_date'] = 'start_date' @_hash['end_date'] = 'end_date' @_hash end |
.nullables ⇒ Object
An array for nullable fields
55 56 57 58 59 60 |
# File 'lib/api_reference/models/credit_note_line_item_params.rb', line 55 def self.nullables %w[ start_date end_date ] end |
.optionals ⇒ Object
An array for optional fields
47 48 49 50 51 52 |
# File 'lib/api_reference/models/credit_note_line_item_params.rb', line 47 def self.optionals %w[ start_date end_date ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
109 110 111 112 113 114 |
# File 'lib/api_reference/models/credit_note_line_item_params.rb', line 109 def inspect class_name = self.class.name.split('::').last "<#{class_name} invoice_line_item_id: #{@invoice_line_item_id.inspect}, amount:"\ " #{@amount.inspect}, start_date: #{@start_date.inspect}, end_date: #{@end_date.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
101 102 103 104 105 106 |
# File 'lib/api_reference/models/credit_note_line_item_params.rb', line 101 def to_s class_name = self.class.name.split('::').last "<#{class_name} invoice_line_item_id: #{@invoice_line_item_id}, amount: #{@amount},"\ " start_date: #{@start_date}, end_date: #{@end_date}, additional_properties:"\ " #{@additional_properties}>" end |