Class: FactPulse::InvoiceLine
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- FactPulse::InvoiceLine
- Defined in:
- lib/factpulse/models/invoice_line.rb
Overview
Represents a line item in an invoice.
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#allowance_amount ⇒ Object
Returns the value of attribute allowance_amount.
-
#allowance_reason ⇒ Object
Returns the value of attribute allowance_reason.
-
#allowance_reason_code ⇒ Object
Returns the value of attribute allowance_reason_code.
-
#item_name ⇒ Object
Returns the value of attribute item_name.
-
#line_net_amount ⇒ Object
Returns the value of attribute line_net_amount.
-
#line_number ⇒ Object
Returns the value of attribute line_number.
-
#manual_vat_rate ⇒ Object
Returns the value of attribute manual_vat_rate.
-
#period_end_date ⇒ Object
Returns the value of attribute period_end_date.
-
#period_start_date ⇒ Object
Returns the value of attribute period_start_date.
-
#quantity ⇒ Object
Returns the value of attribute quantity.
-
#reference ⇒ Object
Returns the value of attribute reference.
-
#unit ⇒ Object
Returns the value of attribute unit.
-
#unit_net_price ⇒ Object
Returns the value of attribute unit_net_price.
-
#vat_category ⇒ Object
Returns the value of attribute vat_category.
-
#vat_rate ⇒ Object
Returns the value of attribute vat_rate.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.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.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ InvoiceLine
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ InvoiceLine
Initializes the object
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 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
# File 'lib/factpulse/models/invoice_line.rb', line 139 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `FactPulse::InvoiceLine` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| if (!acceptable_attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `FactPulse::InvoiceLine`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'line_number') self.line_number = attributes[:'line_number'] else self.line_number = nil end if attributes.key?(:'reference') self.reference = attributes[:'reference'] end if attributes.key?(:'item_name') self.item_name = attributes[:'item_name'] else self.item_name = nil end if attributes.key?(:'quantity') self.quantity = attributes[:'quantity'] else self.quantity = nil end if attributes.key?(:'unit') self.unit = attributes[:'unit'] else self.unit = nil end if attributes.key?(:'unit_net_price') self.unit_net_price = attributes[:'unit_net_price'] else self.unit_net_price = nil end if attributes.key?(:'allowance_amount') self.allowance_amount = attributes[:'allowance_amount'] end if attributes.key?(:'line_net_amount') self.line_net_amount = attributes[:'line_net_amount'] end if attributes.key?(:'vat_rate') self.vat_rate = attributes[:'vat_rate'] end if attributes.key?(:'manual_vat_rate') self.manual_vat_rate = attributes[:'manual_vat_rate'] end if attributes.key?(:'vat_category') self.vat_category = attributes[:'vat_category'] end if attributes.key?(:'period_start_date') self.period_start_date = attributes[:'period_start_date'] end if attributes.key?(:'period_end_date') self.period_end_date = attributes[:'period_end_date'] end if attributes.key?(:'allowance_reason_code') self.allowance_reason_code = attributes[:'allowance_reason_code'] end if attributes.key?(:'allowance_reason') self.allowance_reason = attributes[:'allowance_reason'] end end |
Instance Attribute Details
#allowance_amount ⇒ Object
Returns the value of attribute allowance_amount.
31 32 33 |
# File 'lib/factpulse/models/invoice_line.rb', line 31 def allowance_amount @allowance_amount end |
#allowance_reason ⇒ Object
Returns the value of attribute allowance_reason.
47 48 49 |
# File 'lib/factpulse/models/invoice_line.rb', line 47 def allowance_reason @allowance_reason end |
#allowance_reason_code ⇒ Object
Returns the value of attribute allowance_reason_code.
45 46 47 |
# File 'lib/factpulse/models/invoice_line.rb', line 45 def allowance_reason_code @allowance_reason_code end |
#item_name ⇒ Object
Returns the value of attribute item_name.
23 24 25 |
# File 'lib/factpulse/models/invoice_line.rb', line 23 def item_name @item_name end |
#line_net_amount ⇒ Object
Returns the value of attribute line_net_amount.
33 34 35 |
# File 'lib/factpulse/models/invoice_line.rb', line 33 def line_net_amount @line_net_amount end |
#line_number ⇒ Object
Returns the value of attribute line_number.
19 20 21 |
# File 'lib/factpulse/models/invoice_line.rb', line 19 def line_number @line_number end |
#manual_vat_rate ⇒ Object
Returns the value of attribute manual_vat_rate.
37 38 39 |
# File 'lib/factpulse/models/invoice_line.rb', line 37 def manual_vat_rate @manual_vat_rate end |
#period_end_date ⇒ Object
Returns the value of attribute period_end_date.
43 44 45 |
# File 'lib/factpulse/models/invoice_line.rb', line 43 def period_end_date @period_end_date end |
#period_start_date ⇒ Object
Returns the value of attribute period_start_date.
41 42 43 |
# File 'lib/factpulse/models/invoice_line.rb', line 41 def period_start_date @period_start_date end |
#quantity ⇒ Object
Returns the value of attribute quantity.
25 26 27 |
# File 'lib/factpulse/models/invoice_line.rb', line 25 def quantity @quantity end |
#reference ⇒ Object
Returns the value of attribute reference.
21 22 23 |
# File 'lib/factpulse/models/invoice_line.rb', line 21 def reference @reference end |
#unit ⇒ Object
Returns the value of attribute unit.
27 28 29 |
# File 'lib/factpulse/models/invoice_line.rb', line 27 def unit @unit end |
#unit_net_price ⇒ Object
Returns the value of attribute unit_net_price.
29 30 31 |
# File 'lib/factpulse/models/invoice_line.rb', line 29 def unit_net_price @unit_net_price end |
#vat_category ⇒ Object
Returns the value of attribute vat_category.
39 40 41 |
# File 'lib/factpulse/models/invoice_line.rb', line 39 def vat_category @vat_category end |
#vat_rate ⇒ Object
Returns the value of attribute vat_rate.
35 36 37 |
# File 'lib/factpulse/models/invoice_line.rb', line 35 def vat_rate @vat_rate end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
93 94 95 |
# File 'lib/factpulse/models/invoice_line.rb', line 93 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
98 99 100 |
# File 'lib/factpulse/models/invoice_line.rb', line 98 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/factpulse/models/invoice_line.rb', line 72 def self.attribute_map { :'line_number' => :'line_number', :'reference' => :'reference', :'item_name' => :'item_name', :'quantity' => :'quantity', :'unit' => :'unit', :'unit_net_price' => :'unit_net_price', :'allowance_amount' => :'allowanceAmount', :'line_net_amount' => :'lineNetAmount', :'vat_rate' => :'vat_rate', :'manual_vat_rate' => :'manual_vat_rate', :'vat_category' => :'vat_category', :'period_start_date' => :'periodStartDate', :'period_end_date' => :'periodEndDate', :'allowance_reason_code' => :'allowanceReasonCode', :'allowance_reason' => :'allowanceReason' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 |
# File 'lib/factpulse/models/invoice_line.rb', line 351 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif 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[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/factpulse/models/invoice_line.rb', line 124 def self.openapi_nullable Set.new([ :'reference', :'allowance_amount', :'vat_rate', :'vat_category', :'period_start_date', :'period_end_date', :'allowance_reason_code', :'allowance_reason' ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/factpulse/models/invoice_line.rb', line 103 def self.openapi_types { :'line_number' => :'Integer', :'reference' => :'String', :'item_name' => :'String', :'quantity' => :'Quantity', :'unit' => :'UnitOfMeasure', :'unit_net_price' => :'UnitNetPrice', :'allowance_amount' => :'InvoiceLineAllowanceAmount', :'line_net_amount' => :'LineNetAmount', :'vat_rate' => :'String', :'manual_vat_rate' => :'ManualVatRate', :'vat_category' => :'VATCategory', :'period_start_date' => :'String', :'period_end_date' => :'String', :'allowance_reason_code' => :'AllowanceReasonCode', :'allowance_reason' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 |
# File 'lib/factpulse/models/invoice_line.rb', line 316 def ==(o) return true if self.equal?(o) self.class == o.class && line_number == o.line_number && reference == o.reference && item_name == o.item_name && quantity == o.quantity && unit == o.unit && unit_net_price == o.unit_net_price && allowance_amount == o.allowance_amount && line_net_amount == o.line_net_amount && vat_rate == o.vat_rate && manual_vat_rate == o.manual_vat_rate && vat_category == o.vat_category && period_start_date == o.period_start_date && period_end_date == o.period_end_date && allowance_reason_code == o.allowance_reason_code && allowance_reason == o.allowance_reason end |
#eql?(o) ⇒ Boolean
338 339 340 |
# File 'lib/factpulse/models/invoice_line.rb', line 338 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
344 345 346 |
# File 'lib/factpulse/models/invoice_line.rb', line 344 def hash [line_number, reference, item_name, quantity, unit, unit_net_price, allowance_amount, line_net_amount, vat_rate, manual_vat_rate, vat_category, period_start_date, period_end_date, allowance_reason_code, allowance_reason].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
# File 'lib/factpulse/models/invoice_line.rb', line 226 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @line_number.nil? invalid_properties.push('invalid value for "line_number", line_number cannot be nil.') end if @item_name.nil? invalid_properties.push('invalid value for "item_name", item_name cannot be nil.') end if @quantity.nil? invalid_properties.push('invalid value for "quantity", quantity cannot be nil.') end if @unit.nil? invalid_properties.push('invalid value for "unit", unit cannot be nil.') end if @unit_net_price.nil? invalid_properties.push('invalid value for "unit_net_price", unit_net_price cannot be nil.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
373 374 375 376 377 378 379 380 381 382 383 384 385 |
# File 'lib/factpulse/models/invoice_line.rb', line 373 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 |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
254 255 256 257 258 259 260 261 262 |
# File 'lib/factpulse/models/invoice_line.rb', line 254 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @line_number.nil? return false if @item_name.nil? return false if @quantity.nil? return false if @unit.nil? return false if @unit_net_price.nil? true end |