Class: ApiReference::CreateCreditNoteParams
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ApiReference::CreateCreditNoteParams
- Defined in:
- lib/api_reference/models/create_credit_note_params.rb
Overview
CreateCreditNoteParams Model.
Instance Attribute Summary collapse
-
#end_date ⇒ Date
A date string to specify the global credit note service period end date in the customer's timezone.
-
#line_items ⇒ Array[CreditNoteLineItemParams]
TODO: Write general description for this method.
-
#memo ⇒ String
An optional memo to attach to the credit note.
-
#reason ⇒ Reason1
An optional reason for the credit note.
-
#start_date ⇒ Date
A date string to specify the global 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(line_items:, reason:, memo: SKIP, start_date: SKIP, end_date: SKIP) ⇒ CreateCreditNoteParams
constructor
A new instance of CreateCreditNoteParams.
-
#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(line_items:, reason:, memo: SKIP, start_date: SKIP, end_date: SKIP) ⇒ CreateCreditNoteParams
Returns a new instance of CreateCreditNoteParams.
69 70 71 72 73 74 75 76 |
# File 'lib/api_reference/models/create_credit_note_params.rb', line 69 def initialize(line_items:, reason:, memo: SKIP, start_date: SKIP, end_date: SKIP) @line_items = line_items @reason = reason @memo = memo unless memo == SKIP @start_date = start_date unless start_date == SKIP @end_date = end_date unless end_date == SKIP end |
Instance Attribute Details
#end_date ⇒ Date
A date string to specify the global credit note service period end date in the customer's timezone. This will be applied to all line items that don't have their own individual service periods specified. If not provided, line items will use their original invoice line item service periods. This date is inclusive.
38 39 40 |
# File 'lib/api_reference/models/create_credit_note_params.rb', line 38 def end_date @end_date end |
#line_items ⇒ Array[CreditNoteLineItemParams]
TODO: Write general description for this method
14 15 16 |
# File 'lib/api_reference/models/create_credit_note_params.rb', line 14 def line_items @line_items end |
#memo ⇒ String
An optional memo to attach to the credit note.
22 23 24 |
# File 'lib/api_reference/models/create_credit_note_params.rb', line 22 def memo @memo end |
#reason ⇒ Reason1
An optional reason for the credit note.
18 19 20 |
# File 'lib/api_reference/models/create_credit_note_params.rb', line 18 def reason @reason end |
#start_date ⇒ Date
A date string to specify the global credit note service period start date in the customer's timezone. This will be applied to all line items that don't have their own individual service periods specified. If not provided, line items will use their original invoice line item service periods. This date is inclusive.
30 31 32 |
# File 'lib/api_reference/models/create_credit_note_params.rb', line 30 def start_date @start_date end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/api_reference/models/create_credit_note_params.rb', line 79 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. # Parameter is an array, so we need to iterate through it line_items = nil unless hash['line_items'].nil? line_items = [] hash['line_items'].each do |structure| line_items << (CreditNoteLineItemParams.from_hash(structure) if structure) end end line_items = nil unless hash.key?('line_items') reason = hash.key?('reason') ? hash['reason'] : nil memo = hash.key?('memo') ? hash['memo'] : SKIP start_date = hash.key?('start_date') ? hash['start_date'] : SKIP end_date = hash.key?('end_date') ? hash['end_date'] : SKIP # Create object from extracted values. CreateCreditNoteParams.new(line_items: line_items, reason: reason, memo: memo, start_date: start_date, end_date: end_date) end |
.names ⇒ Object
A mapping from model property names to API property names.
41 42 43 44 45 46 47 48 49 |
# File 'lib/api_reference/models/create_credit_note_params.rb', line 41 def self.names @_hash = {} if @_hash.nil? @_hash['line_items'] = 'line_items' @_hash['reason'] = 'reason' @_hash['memo'] = 'memo' @_hash['start_date'] = 'start_date' @_hash['end_date'] = 'end_date' @_hash end |
.nullables ⇒ Object
An array for nullable fields
61 62 63 64 65 66 67 |
# File 'lib/api_reference/models/create_credit_note_params.rb', line 61 def self.nullables %w[ memo start_date end_date ] end |
.optionals ⇒ Object
An array for optional fields
52 53 54 55 56 57 58 |
# File 'lib/api_reference/models/create_credit_note_params.rb', line 52 def self.optionals %w[ memo start_date end_date ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
114 115 116 117 118 |
# File 'lib/api_reference/models/create_credit_note_params.rb', line 114 def inspect class_name = self.class.name.split('::').last "<#{class_name} line_items: #{@line_items.inspect}, reason: #{@reason.inspect}, memo:"\ " #{@memo.inspect}, start_date: #{@start_date.inspect}, end_date: #{@end_date.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
107 108 109 110 111 |
# File 'lib/api_reference/models/create_credit_note_params.rb', line 107 def to_s class_name = self.class.name.split('::').last "<#{class_name} line_items: #{@line_items}, reason: #{@reason}, memo: #{@memo}, start_date:"\ " #{@start_date}, end_date: #{@end_date}>" end |