Class: ApiReference::IncrementCreditLedgerEntryInvoiceSettings
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ApiReference::IncrementCreditLedgerEntryInvoiceSettings
- Defined in:
- lib/api_reference/models/increment_credit_ledger_entry_invoice_settings.rb
Overview
IncrementCreditLedgerEntryInvoiceSettings Model.
Instance Attribute Summary collapse
-
#auto_collection ⇒ TrueClass | FalseClass
Whether the credits purchase invoice should auto collect with the customer's saved payment method.
-
#custom_due_date ⇒ Object
An optional custom due date for the invoice.
-
#invoice_date ⇒ Object
An ISO 8601 format date that denotes when this invoice should be dated in the customer's timezone.
-
#item_id ⇒ String
The ID of the Item to be used for the invoice line item.
-
#mark_as_paid ⇒ TrueClass | FalseClass
If true, the new credits purchase invoice will be marked as paid.
-
#memo ⇒ String
An optional memo to display on the invoice.
-
#net_terms ⇒ Integer
The net terms determines the due date of the invoice.
-
#require_successful_payment ⇒ TrueClass | FalseClass
If true, the new credit block will require that the corresponding invoice is paid before it can be drawn down from.
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(auto_collection:, net_terms: SKIP, memo: SKIP, require_successful_payment: false, invoice_date: SKIP, custom_due_date: SKIP, item_id: SKIP, mark_as_paid: false, additional_properties: nil) ⇒ IncrementCreditLedgerEntryInvoiceSettings
constructor
A new instance of IncrementCreditLedgerEntryInvoiceSettings.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
- #to_union_type_custom_due_date ⇒ Object
- #to_union_type_invoice_date ⇒ 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(auto_collection:, net_terms: SKIP, memo: SKIP, require_successful_payment: false, invoice_date: SKIP, custom_due_date: SKIP, item_id: SKIP, mark_as_paid: false, additional_properties: nil) ⇒ IncrementCreditLedgerEntryInvoiceSettings
Returns a new instance of IncrementCreditLedgerEntryInvoiceSettings.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/api_reference/models/increment_credit_ledger_entry_invoice_settings.rb', line 93 def initialize(auto_collection:, net_terms: SKIP, memo: SKIP, require_successful_payment: false, invoice_date: SKIP, custom_due_date: SKIP, item_id: SKIP, mark_as_paid: false, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @auto_collection = auto_collection @net_terms = net_terms unless net_terms == SKIP @memo = memo unless memo == SKIP unless require_successful_payment == SKIP @require_successful_payment = require_successful_payment end @invoice_date = invoice_date unless invoice_date == SKIP @custom_due_date = custom_due_date unless custom_due_date == SKIP @item_id = item_id unless item_id == SKIP @mark_as_paid = mark_as_paid unless mark_as_paid == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#auto_collection ⇒ TrueClass | FalseClass
Whether the credits purchase invoice should auto collect with the customer's saved payment method.
15 16 17 |
# File 'lib/api_reference/models/increment_credit_ledger_entry_invoice_settings.rb', line 15 def auto_collection @auto_collection end |
#custom_due_date ⇒ Object
An optional custom due date for the invoice. If not set, the due date will
be calculated based on the net_terms value.
44 45 46 |
# File 'lib/api_reference/models/increment_credit_ledger_entry_invoice_settings.rb', line 44 def custom_due_date @custom_due_date end |
#invoice_date ⇒ Object
An ISO 8601 format date that denotes when this invoice should be dated in the customer's timezone. If not provided, the invoice date will default to the credit block's effective date.
39 40 41 |
# File 'lib/api_reference/models/increment_credit_ledger_entry_invoice_settings.rb', line 39 def invoice_date @invoice_date end |
#item_id ⇒ String
The ID of the Item to be used for the invoice line item. If not provided, a default 'Credits' item will be used.
49 50 51 |
# File 'lib/api_reference/models/increment_credit_ledger_entry_invoice_settings.rb', line 49 def item_id @item_id end |
#mark_as_paid ⇒ TrueClass | FalseClass
If true, the new credits purchase invoice will be marked as paid.
53 54 55 |
# File 'lib/api_reference/models/increment_credit_ledger_entry_invoice_settings.rb', line 53 def mark_as_paid @mark_as_paid end |
#memo ⇒ String
An optional memo to display on the invoice.
28 29 30 |
# File 'lib/api_reference/models/increment_credit_ledger_entry_invoice_settings.rb', line 28 def memo @memo end |
#net_terms ⇒ Integer
The net terms determines the due date of the invoice. Due date is
calculated based on the invoice or issuance date, depending on the
account's configured due date calculation method. A value of '0' here
represents that the invoice is due on issue, whereas a value of '30'
represents that the customer has 30 days to pay the invoice. You must set
either net_terms or custom_due_date, but not both.
24 25 26 |
# File 'lib/api_reference/models/increment_credit_ledger_entry_invoice_settings.rb', line 24 def net_terms @net_terms end |
#require_successful_payment ⇒ TrueClass | FalseClass
If true, the new credit block will require that the corresponding invoice is paid before it can be drawn down from.
33 34 35 |
# File 'lib/api_reference/models/increment_credit_ledger_entry_invoice_settings.rb', line 33 def require_successful_payment @require_successful_payment end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/api_reference/models/increment_credit_ledger_entry_invoice_settings.rb', line 115 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. auto_collection = hash.key?('auto_collection') ? hash['auto_collection'] : nil net_terms = hash.key?('net_terms') ? hash['net_terms'] : SKIP memo = hash.key?('memo') ? hash['memo'] : SKIP require_successful_payment = hash['require_successful_payment'] ||= false invoice_date = hash.key?('invoice_date') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:IncrementCreditLedgerEntryInvoiceSettingsInvoiceDate), hash['invoice_date'] ) : SKIP custom_due_date = hash.key?('custom_due_date') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:IncrementCreditLedgerEntryInvoiceSettingsCustomDueDate), hash['custom_due_date'] ) : SKIP item_id = hash.key?('item_id') ? hash['item_id'] : SKIP mark_as_paid = hash['mark_as_paid'] ||= false # 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. IncrementCreditLedgerEntryInvoiceSettings.new(auto_collection: auto_collection, net_terms: net_terms, memo: memo, require_successful_payment: require_successful_payment, invoice_date: invoice_date, custom_due_date: custom_due_date, item_id: item_id, mark_as_paid: mark_as_paid, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/api_reference/models/increment_credit_ledger_entry_invoice_settings.rb', line 56 def self.names @_hash = {} if @_hash.nil? @_hash['auto_collection'] = 'auto_collection' @_hash['net_terms'] = 'net_terms' @_hash['memo'] = 'memo' @_hash['require_successful_payment'] = 'require_successful_payment' @_hash['invoice_date'] = 'invoice_date' @_hash['custom_due_date'] = 'custom_due_date' @_hash['item_id'] = 'item_id' @_hash['mark_as_paid'] = 'mark_as_paid' @_hash end |
.nullables ⇒ Object
An array for nullable fields
83 84 85 86 87 88 89 90 91 |
# File 'lib/api_reference/models/increment_credit_ledger_entry_invoice_settings.rb', line 83 def self.nullables %w[ net_terms memo invoice_date custom_due_date item_id ] end |
.optionals ⇒ Object
An array for optional fields
70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/api_reference/models/increment_credit_ledger_entry_invoice_settings.rb', line 70 def self.optionals %w[ net_terms memo require_successful_payment invoice_date custom_due_date item_id mark_as_paid ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
166 167 168 169 170 171 172 173 174 175 176 |
# File 'lib/api_reference/models/increment_credit_ledger_entry_invoice_settings.rb', line 166 def self.validate(value) if value.instance_of? self return APIHelper.valid_type?(value.auto_collection, ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) end return false unless value.instance_of? Hash APIHelper.valid_type?(value['auto_collection'], ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
188 189 190 191 192 193 194 195 |
# File 'lib/api_reference/models/increment_credit_ledger_entry_invoice_settings.rb', line 188 def inspect class_name = self.class.name.split('::').last "<#{class_name} auto_collection: #{@auto_collection.inspect}, net_terms:"\ " #{@net_terms.inspect}, memo: #{@memo.inspect}, require_successful_payment:"\ " #{@require_successful_payment.inspect}, invoice_date: #{@invoice_date.inspect},"\ " custom_due_date: #{@custom_due_date.inspect}, item_id: #{@item_id.inspect}, mark_as_paid:"\ " #{@mark_as_paid.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
179 180 181 182 183 184 185 |
# File 'lib/api_reference/models/increment_credit_ledger_entry_invoice_settings.rb', line 179 def to_s class_name = self.class.name.split('::').last "<#{class_name} auto_collection: #{@auto_collection}, net_terms: #{@net_terms}, memo:"\ " #{@memo}, require_successful_payment: #{@require_successful_payment}, invoice_date:"\ " #{@invoice_date}, custom_due_date: #{@custom_due_date}, item_id: #{@item_id},"\ " mark_as_paid: #{@mark_as_paid}, additional_properties: #{@additional_properties}>" end |
#to_union_type_custom_due_date ⇒ Object
158 159 160 161 162 |
# File 'lib/api_reference/models/increment_credit_ledger_entry_invoice_settings.rb', line 158 def to_union_type_custom_due_date UnionTypeLookUp.get(:IncrementCreditLedgerEntryInvoiceSettingsCustomDueDate) .validate(custom_due_date) .serialize(custom_due_date) end |
#to_union_type_invoice_date ⇒ Object
152 153 154 155 156 |
# File 'lib/api_reference/models/increment_credit_ledger_entry_invoice_settings.rb', line 152 def to_union_type_invoice_date UnionTypeLookUp.get(:IncrementCreditLedgerEntryInvoiceSettingsInvoiceDate) .validate(invoice_date) .serialize(invoice_date) end |