Class: ApiReference::NewTopUpInvoiceSettings2
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ApiReference::NewTopUpInvoiceSettings2
- Defined in:
- lib/api_reference/models/new_top_up_invoice_settings2.rb
Overview
Settings for invoices generated by triggered top-ups.
Instance Attribute Summary collapse
-
#auto_collection ⇒ TrueClass | FalseClass
Whether the credits purchase invoice should auto collect with the customer's saved payment method.
-
#memo ⇒ String
An optional memo to display on the invoice.
-
#net_terms ⇒ Integer
The net terms determines the difference between the invoice date and the issue date for the invoice.
-
#require_successful_payment ⇒ TrueClass | FalseClass
When true, credit blocks created by this top-up will require that the corresponding invoice is paid before they are 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.
Instance Method Summary collapse
-
#initialize(auto_collection:, net_terms:, memo: SKIP, require_successful_payment: false, additional_properties: nil) ⇒ NewTopUpInvoiceSettings2
constructor
A new instance of NewTopUpInvoiceSettings2.
-
#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(auto_collection:, net_terms:, memo: SKIP, require_successful_payment: false, additional_properties: nil) ⇒ NewTopUpInvoiceSettings2
Returns a new instance of NewTopUpInvoiceSettings2.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/api_reference/models/new_top_up_invoice_settings2.rb', line 59 def initialize(auto_collection:, net_terms:, memo: SKIP, require_successful_payment: 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 @memo = memo unless memo == SKIP unless require_successful_payment == SKIP @require_successful_payment = require_successful_payment end @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/new_top_up_invoice_settings2.rb', line 15 def auto_collection @auto_collection end |
#memo ⇒ String
An optional memo to display on the invoice.
25 26 27 |
# File 'lib/api_reference/models/new_top_up_invoice_settings2.rb', line 25 def memo @memo end |
#net_terms ⇒ Integer
The net terms determines the difference between the invoice date and the issue date for the invoice. If you intend the invoice to be due on issue, set this to 0.
21 22 23 |
# File 'lib/api_reference/models/new_top_up_invoice_settings2.rb', line 21 def net_terms @net_terms end |
#require_successful_payment ⇒ TrueClass | FalseClass
When true, credit blocks created by this top-up will require that the corresponding invoice is paid before they are drawn down from. If any topup block is pending payment, further automatic top-ups will be paused until the invoice is paid or voided.
32 33 34 |
# File 'lib/api_reference/models/new_top_up_invoice_settings2.rb', line 32 def require_successful_payment @require_successful_payment end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/api_reference/models/new_top_up_invoice_settings2.rb', line 76 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'] : nil memo = hash.key?('memo') ? hash['memo'] : SKIP require_successful_payment = hash['require_successful_payment'] ||= 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. NewTopUpInvoiceSettings2.new(auto_collection: auto_collection, net_terms: net_terms, memo: memo, require_successful_payment: require_successful_payment, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
35 36 37 38 39 40 41 42 |
# File 'lib/api_reference/models/new_top_up_invoice_settings2.rb', line 35 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 end |
.nullables ⇒ Object
An array for nullable fields
53 54 55 56 57 |
# File 'lib/api_reference/models/new_top_up_invoice_settings2.rb', line 53 def self.nullables %w[ memo ] end |
.optionals ⇒ Object
An array for optional fields
45 46 47 48 49 50 |
# File 'lib/api_reference/models/new_top_up_invoice_settings2.rb', line 45 def self.optionals %w[ memo require_successful_payment ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
110 111 112 113 114 115 |
# File 'lib/api_reference/models/new_top_up_invoice_settings2.rb', line 110 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}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
102 103 104 105 106 107 |
# File 'lib/api_reference/models/new_top_up_invoice_settings2.rb', line 102 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},"\ " additional_properties: #{@additional_properties}>" end |