Class: CyberSourceMergedSpec::InvoiceInformation
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- CyberSourceMergedSpec::InvoiceInformation
- Defined in:
- lib/cyber_source_merged_spec/models/invoice_information.rb
Overview
Contains all of the invoice-specific fields, such as the invoice number and due date.
Instance Attribute Summary collapse
-
#allow_partial_payments ⇒ TrueClass | FalseClass
If set to
true, the payer can make a partial invoice payment. -
#delivery_mode ⇒ String
If this field is set to 'None', an invoice will be generated with the status 'CREATED', but no email will be dispatched.
-
#description ⇒ String
The description included in the invoice.
-
#due_date ⇒ Date
The invoice due date.
-
#expiration_date ⇒ Date
Define an expiration date for the link.
-
#invoice_number ⇒ String
Invoice Number.
-
#send_immediately ⇒ TrueClass | FalseClass
If set to
true, we send the invoice immediately.
Class Method Summary collapse
- .from_element(root) ⇒ Object
-
.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(description:, due_date:, invoice_number: SKIP, expiration_date: SKIP, send_immediately: false, allow_partial_payments: false, delivery_mode: SKIP, additional_properties: nil) ⇒ InvoiceInformation
constructor
A new instance of InvoiceInformation.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
- #to_xml_element(doc, root_name) ⇒ 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(description:, due_date:, invoice_number: SKIP, expiration_date: SKIP, send_immediately: false, allow_partial_payments: false, delivery_mode: SKIP, additional_properties: nil) ⇒ InvoiceInformation
Returns a new instance of InvoiceInformation.
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/cyber_source_merged_spec/models/invoice_information.rb', line 77 def initialize(description:, due_date:, invoice_number: SKIP, expiration_date: SKIP, send_immediately: false, allow_partial_payments: false, delivery_mode: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @invoice_number = invoice_number unless invoice_number == SKIP @description = description @due_date = due_date @expiration_date = expiration_date unless expiration_date == SKIP @send_immediately = send_immediately unless send_immediately == SKIP @allow_partial_payments = allow_partial_payments unless allow_partial_payments == SKIP @delivery_mode = delivery_mode unless delivery_mode == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#allow_partial_payments ⇒ TrueClass | FalseClass
If set to true, the payer can make a partial invoice payment.
38 39 40 |
# File 'lib/cyber_source_merged_spec/models/invoice_information.rb', line 38 def allow_partial_payments @allow_partial_payments end |
#delivery_mode ⇒ String
If this field is set to 'None', an invoice will be generated with the
status 'CREATED', but no email will be dispatched.
Possible values:
NoneEmail
46 47 48 |
# File 'lib/cyber_source_merged_spec/models/invoice_information.rb', line 46 def delivery_mode @delivery_mode end |
#description ⇒ String
The description included in the invoice.
19 20 21 |
# File 'lib/cyber_source_merged_spec/models/invoice_information.rb', line 19 def description @description end |
#due_date ⇒ Date
The invoice due date. This field is required for creating an invoice.
Format: YYYY-MM-DD, where YYYY = year, MM = month, and DD = day
24 25 26 |
# File 'lib/cyber_source_merged_spec/models/invoice_information.rb', line 24 def due_date @due_date end |
#expiration_date ⇒ Date
Define an expiration date for the link.
Format: YYYY-MM-DD, where YYYY = year, MM = month, and DD = day
29 30 31 |
# File 'lib/cyber_source_merged_spec/models/invoice_information.rb', line 29 def expiration_date @expiration_date end |
#invoice_number ⇒ String
Invoice Number.
15 16 17 |
# File 'lib/cyber_source_merged_spec/models/invoice_information.rb', line 15 def invoice_number @invoice_number end |
#send_immediately ⇒ TrueClass | FalseClass
If set to true, we send the invoice immediately. If set to false, the
invoice remains in draft mode.
34 35 36 |
# File 'lib/cyber_source_merged_spec/models/invoice_information.rb', line 34 def send_immediately @send_immediately end |
Class Method Details
.from_element(root) ⇒ Object
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/cyber_source_merged_spec/models/invoice_information.rb', line 126 def self.from_element(root) description = XmlUtilities.from_element(root, 'description', String) due_date = XmlUtilities.from_element(root, 'dueDate', String) invoice_number = XmlUtilities.from_element(root, 'invoiceNumber', String) expiration_date = XmlUtilities.from_element(root, 'expirationDate', String) send_immediately = XmlUtilities.from_element(root, 'sendImmediately', TrueClass) allow_partial_payments = XmlUtilities.from_element(root, 'allowPartialPayments', TrueClass) delivery_mode = XmlUtilities.from_element(root, 'deliveryMode', String) new(description: description, due_date: due_date, invoice_number: invoice_number, expiration_date: expiration_date, send_immediately: send_immediately, allow_partial_payments: allow_partial_payments, delivery_mode: delivery_mode, additional_properties: additional_properties) end |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/cyber_source_merged_spec/models/invoice_information.rb', line 95 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. description = hash.key?('description') ? hash['description'] : nil due_date = hash.key?('dueDate') ? hash['dueDate'] : nil invoice_number = hash.key?('invoiceNumber') ? hash['invoiceNumber'] : SKIP expiration_date = hash.key?('expirationDate') ? hash['expirationDate'] : SKIP send_immediately = hash['sendImmediately'] ||= false allow_partial_payments = hash['allowPartialPayments'] ||= false delivery_mode = hash.key?('deliveryMode') ? hash['deliveryMode'] : 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. InvoiceInformation.new(description: description, due_date: due_date, invoice_number: invoice_number, expiration_date: expiration_date, send_immediately: send_immediately, allow_partial_payments: allow_partial_payments, delivery_mode: delivery_mode, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/cyber_source_merged_spec/models/invoice_information.rb', line 49 def self.names @_hash = {} if @_hash.nil? @_hash['invoice_number'] = 'invoiceNumber' @_hash['description'] = 'description' @_hash['due_date'] = 'dueDate' @_hash['expiration_date'] = 'expirationDate' @_hash['send_immediately'] = 'sendImmediately' @_hash['allow_partial_payments'] = 'allowPartialPayments' @_hash['delivery_mode'] = 'deliveryMode' @_hash end |
.nullables ⇒ Object
An array for nullable fields
73 74 75 |
# File 'lib/cyber_source_merged_spec/models/invoice_information.rb', line 73 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
62 63 64 65 66 67 68 69 70 |
# File 'lib/cyber_source_merged_spec/models/invoice_information.rb', line 62 def self.optionals %w[ invoice_number expiration_date send_immediately allow_partial_payments delivery_mode ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
178 179 180 181 182 183 184 185 |
# File 'lib/cyber_source_merged_spec/models/invoice_information.rb', line 178 def inspect class_name = self.class.name.split('::').last "<#{class_name} invoice_number: #{@invoice_number.inspect}, description:"\ " #{@description.inspect}, due_date: #{@due_date.inspect}, expiration_date:"\ " #{@expiration_date.inspect}, send_immediately: #{@send_immediately.inspect},"\ " allow_partial_payments: #{@allow_partial_payments.inspect}, delivery_mode:"\ " #{@delivery_mode.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
169 170 171 172 173 174 175 |
# File 'lib/cyber_source_merged_spec/models/invoice_information.rb', line 169 def to_s class_name = self.class.name.split('::').last "<#{class_name} invoice_number: #{@invoice_number}, description: #{@description}, due_date:"\ " #{@due_date}, expiration_date: #{@expiration_date}, send_immediately:"\ " #{@send_immediately}, allow_partial_payments: #{@allow_partial_payments}, delivery_mode:"\ " #{@delivery_mode}, additional_properties: #{@additional_properties}>" end |
#to_xml_element(doc, root_name) ⇒ Object
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/cyber_source_merged_spec/models/invoice_information.rb', line 149 def to_xml_element(doc, root_name) root = doc.create_element(root_name) XmlUtilities.add_as_subelement(doc, root, 'description', description) XmlUtilities.add_as_subelement(doc, root, 'dueDate', due_date) XmlUtilities.add_as_subelement(doc, root, 'invoiceNumber', invoice_number) XmlUtilities.add_as_subelement(doc, root, 'expirationDate', expiration_date) XmlUtilities.add_as_subelement(doc, root, 'sendImmediately', send_immediately) XmlUtilities.add_as_subelement(doc, root, 'allowPartialPayments', allow_partial_payments) XmlUtilities.add_as_subelement(doc, root, 'deliveryMode', delivery_mode) XmlUtilities.add_as_subelement(doc, root, 'additional_properties', additional_properties) root end |