Class: AmzSpApi::VendorInvoicesApiModel::Invoice
- Inherits:
-
Object
- Object
- AmzSpApi::VendorInvoicesApiModel::Invoice
- Defined in:
- lib/vendor-invoices-api-model/models/invoice.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#additional_details ⇒ Object
Additional details provided by the selling party, for tax related or other purposes.
-
#allowance_details ⇒ Object
Total allowance amount details for all line items.
-
#bill_to_party ⇒ Object
Returns the value of attribute bill_to_party.
-
#charge_details ⇒ Object
Total charge amount details for all line items.
-
#date ⇒ Object
Returns the value of attribute date.
-
#id ⇒ Object
Unique number relating to the charges defined in this document.
-
#invoice_total ⇒ Object
Returns the value of attribute invoice_total.
-
#invoice_type ⇒ Object
Identifies the type of invoice.
-
#items ⇒ Object
The list of invoice items.
-
#payment_terms ⇒ Object
Returns the value of attribute payment_terms.
-
#reference_number ⇒ Object
An additional unique reference number used for regulatory or other purposes.
-
#remit_to_party ⇒ Object
Returns the value of attribute remit_to_party.
-
#ship_from_party ⇒ Object
Returns the value of attribute ship_from_party.
-
#ship_to_party ⇒ Object
Returns the value of attribute ship_to_party.
-
#tax_details ⇒ Object
Total tax amount details for all line items.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Invoice
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ Invoice
Initializes the object
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 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
# File 'lib/vendor-invoices-api-model/models/invoice.rb', line 126 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `AmzSpApi::VendorInvoicesApiModel::Invoice` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `AmzSpApi::VendorInvoicesApiModel::Invoice`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'invoice_type') self.invoice_type = attributes[:'invoice_type'] end if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'reference_number') self.reference_number = attributes[:'reference_number'] end if attributes.key?(:'date') self.date = attributes[:'date'] end if attributes.key?(:'remit_to_party') self.remit_to_party = attributes[:'remit_to_party'] end if attributes.key?(:'ship_to_party') self.ship_to_party = attributes[:'ship_to_party'] end if attributes.key?(:'ship_from_party') self.ship_from_party = attributes[:'ship_from_party'] end if attributes.key?(:'bill_to_party') self.bill_to_party = attributes[:'bill_to_party'] end if attributes.key?(:'payment_terms') self.payment_terms = attributes[:'payment_terms'] end if attributes.key?(:'invoice_total') self.invoice_total = attributes[:'invoice_total'] end if attributes.key?(:'tax_details') if (value = attributes[:'tax_details']).is_a?(Array) self.tax_details = value end end if attributes.key?(:'additional_details') if (value = attributes[:'additional_details']).is_a?(Array) self.additional_details = value end end if attributes.key?(:'charge_details') if (value = attributes[:'charge_details']).is_a?(Array) self.charge_details = value end end if attributes.key?(:'allowance_details') if (value = attributes[:'allowance_details']).is_a?(Array) self.allowance_details = value end end if attributes.key?(:'items') if (value = attributes[:'items']).is_a?(Array) self.items = value end end end |
Instance Attribute Details
#additional_details ⇒ Object
Additional details provided by the selling party, for tax related or other purposes.
43 44 45 |
# File 'lib/vendor-invoices-api-model/models/invoice.rb', line 43 def additional_details @additional_details end |
#allowance_details ⇒ Object
Total allowance amount details for all line items.
49 50 51 |
# File 'lib/vendor-invoices-api-model/models/invoice.rb', line 49 def allowance_details @allowance_details end |
#bill_to_party ⇒ Object
Returns the value of attribute bill_to_party.
33 34 35 |
# File 'lib/vendor-invoices-api-model/models/invoice.rb', line 33 def bill_to_party @bill_to_party end |
#charge_details ⇒ Object
Total charge amount details for all line items.
46 47 48 |
# File 'lib/vendor-invoices-api-model/models/invoice.rb', line 46 def charge_details @charge_details end |
#date ⇒ Object
Returns the value of attribute date.
25 26 27 |
# File 'lib/vendor-invoices-api-model/models/invoice.rb', line 25 def date @date end |
#id ⇒ Object
Unique number relating to the charges defined in this document. This will be invoice number if the document type is Invoice or CreditNote number if the document type is Credit Note. Failure to provide this reference will result in a rejection.
20 21 22 |
# File 'lib/vendor-invoices-api-model/models/invoice.rb', line 20 def id @id end |
#invoice_total ⇒ Object
Returns the value of attribute invoice_total.
37 38 39 |
# File 'lib/vendor-invoices-api-model/models/invoice.rb', line 37 def invoice_total @invoice_total end |
#invoice_type ⇒ Object
Identifies the type of invoice.
17 18 19 |
# File 'lib/vendor-invoices-api-model/models/invoice.rb', line 17 def invoice_type @invoice_type end |
#items ⇒ Object
The list of invoice items.
52 53 54 |
# File 'lib/vendor-invoices-api-model/models/invoice.rb', line 52 def items @items end |
#payment_terms ⇒ Object
Returns the value of attribute payment_terms.
35 36 37 |
# File 'lib/vendor-invoices-api-model/models/invoice.rb', line 35 def payment_terms @payment_terms end |
#reference_number ⇒ Object
An additional unique reference number used for regulatory or other purposes.
23 24 25 |
# File 'lib/vendor-invoices-api-model/models/invoice.rb', line 23 def reference_number @reference_number end |
#remit_to_party ⇒ Object
Returns the value of attribute remit_to_party.
27 28 29 |
# File 'lib/vendor-invoices-api-model/models/invoice.rb', line 27 def remit_to_party @remit_to_party end |
#ship_from_party ⇒ Object
Returns the value of attribute ship_from_party.
31 32 33 |
# File 'lib/vendor-invoices-api-model/models/invoice.rb', line 31 def ship_from_party @ship_from_party end |
#ship_to_party ⇒ Object
Returns the value of attribute ship_to_party.
29 30 31 |
# File 'lib/vendor-invoices-api-model/models/invoice.rb', line 29 def ship_to_party @ship_to_party end |
#tax_details ⇒ Object
Total tax amount details for all line items.
40 41 42 |
# File 'lib/vendor-invoices-api-model/models/invoice.rb', line 40 def tax_details @tax_details end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/vendor-invoices-api-model/models/invoice.rb', line 77 def self.attribute_map { :'invoice_type' => :'invoiceType', :'id' => :'id', :'reference_number' => :'referenceNumber', :'date' => :'date', :'remit_to_party' => :'remitToParty', :'ship_to_party' => :'shipToParty', :'ship_from_party' => :'shipFromParty', :'bill_to_party' => :'billToParty', :'payment_terms' => :'paymentTerms', :'invoice_total' => :'invoiceTotal', :'tax_details' => :'taxDetails', :'additional_details' => :'additionalDetails', :'charge_details' => :'chargeDetails', :'allowance_details' => :'allowanceDetails', :'items' => :'items' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
297 298 299 |
# File 'lib/vendor-invoices-api-model/models/invoice.rb', line 297 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
119 120 121 122 |
# File 'lib/vendor-invoices-api-model/models/invoice.rb', line 119 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/vendor-invoices-api-model/models/invoice.rb', line 98 def self.openapi_types { :'invoice_type' => :'Object', :'id' => :'Object', :'reference_number' => :'Object', :'date' => :'Object', :'remit_to_party' => :'Object', :'ship_to_party' => :'Object', :'ship_from_party' => :'Object', :'bill_to_party' => :'Object', :'payment_terms' => :'Object', :'invoice_total' => :'Object', :'tax_details' => :'Object', :'additional_details' => :'Object', :'charge_details' => :'Object', :'allowance_details' => :'Object', :'items' => :'Object' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 |
# File 'lib/vendor-invoices-api-model/models/invoice.rb', line 262 def ==(o) return true if self.equal?(o) self.class == o.class && invoice_type == o.invoice_type && id == o.id && reference_number == o.reference_number && date == o.date && remit_to_party == o.remit_to_party && ship_to_party == o.ship_to_party && ship_from_party == o.ship_from_party && bill_to_party == o.bill_to_party && payment_terms == o.payment_terms && invoice_total == o.invoice_total && tax_details == o.tax_details && additional_details == o.additional_details && charge_details == o.charge_details && allowance_details == o.allowance_details && items == o.items end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 |
# File 'lib/vendor-invoices-api-model/models/invoice.rb', line 327 def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model AmzSpApi::VendorInvoicesApiModel.const_get(type).build_from_hash(value) end end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
396 397 398 399 400 401 402 403 404 405 406 407 408 |
# File 'lib/vendor-invoices-api-model/models/invoice.rb', line 396 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 |
# File 'lib/vendor-invoices-api-model/models/invoice.rb', line 304 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) self.send("#{key}=", nil) end end self end |
#eql?(o) ⇒ Boolean
284 285 286 |
# File 'lib/vendor-invoices-api-model/models/invoice.rb', line 284 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
290 291 292 |
# File 'lib/vendor-invoices-api-model/models/invoice.rb', line 290 def hash [invoice_type, id, reference_number, date, remit_to_party, ship_to_party, ship_from_party, bill_to_party, payment_terms, invoice_total, tax_details, additional_details, charge_details, allowance_details, items].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 |
# File 'lib/vendor-invoices-api-model/models/invoice.rb', line 212 def list_invalid_properties invalid_properties = Array.new if @invoice_type.nil? invalid_properties.push('invalid value for "invoice_type", invoice_type cannot be nil.') end if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @date.nil? invalid_properties.push('invalid value for "date", date cannot be nil.') end if @remit_to_party.nil? invalid_properties.push('invalid value for "remit_to_party", remit_to_party cannot be nil.') end if @invoice_total.nil? invalid_properties.push('invalid value for "invoice_total", invoice_total cannot be nil.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
372 373 374 |
# File 'lib/vendor-invoices-api-model/models/invoice.rb', line 372 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
378 379 380 381 382 383 384 385 386 387 388 389 390 |
# File 'lib/vendor-invoices-api-model/models/invoice.rb', line 378 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
366 367 368 |
# File 'lib/vendor-invoices-api-model/models/invoice.rb', line 366 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
239 240 241 242 243 244 245 246 247 248 |
# File 'lib/vendor-invoices-api-model/models/invoice.rb', line 239 def valid? return false if @invoice_type.nil? invoice_type_validator = EnumAttributeValidator.new('Object', ['Invoice', 'CreditNote']) return false unless invoice_type_validator.valid?(@invoice_type) return false if @id.nil? return false if @date.nil? return false if @remit_to_party.nil? return false if @invoice_total.nil? true end |