Class: TripletexRubyClient::PurchaseOrder
- Inherits:
-
Object
- Object
- TripletexRubyClient::PurchaseOrder
- Defined in:
- lib/tripletex_ruby_client/models/purchase_order.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#attachment ⇒ Object
The attachments on this PurchaseOrder (if any).
-
#attention ⇒ Object
Attention.
-
#changes ⇒ Object
Returns the value of attribute changes.
-
#comments ⇒ Object
Delivery information and invoice comments.
-
#creation_date ⇒ Object
Returns the value of attribute creation_date.
-
#currency ⇒ Object
Company currency.
-
#delivery_address ⇒ Object
Delivery address.
-
#delivery_date ⇒ Object
Returns the value of attribute delivery_date.
-
#department ⇒ Object
Department/order.
-
#discount ⇒ Object
Discount Percentage.
-
#document ⇒ Object
The PDF representing this PurchaseOrder.
-
#edi_document ⇒ Object
The machine readable document (such as EHF or EFO/NELFO) this PurchaseOrder is based on (if any).
-
#id ⇒ Object
Returns the value of attribute id.
-
#is_closed ⇒ Object
Returns the value of attribute is_closed.
-
#number ⇒ Object
Purchase order number.
-
#order_lines ⇒ Object
Order lines tied to the purchase order.
-
#our_contact ⇒ Object
Returns the value of attribute our_contact.
-
#packing_note_message ⇒ Object
Message on packing note.Wholesaler specific.
-
#pickup_point ⇒ Object
Pickup point, wholesaler specific.
-
#project ⇒ Object
Project/order.
-
#receiver_email ⇒ Object
Email when purchase order is send by email.
-
#restorder ⇒ Object
Returns the value of attribute restorder.
-
#status ⇒ Object
Returns the value of attribute status.
-
#supplier ⇒ Object
Returns the value of attribute supplier.
-
#supplier_contact ⇒ Object
Recipient when purchase order is send by email.
-
#transport_type ⇒ Object
Transport type.
-
#transporter_message ⇒ Object
Message to transporter.Wholesaler specific.
-
#url ⇒ Object
Returns the value of attribute url.
-
#version ⇒ Object
Returns the value of attribute version.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_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 ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ PurchaseOrder
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 = {}) ⇒ PurchaseOrder
Initializes the object
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 223 224 225 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 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 185 def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } if attributes.has_key?(:'id') self.id = attributes[:'id'] end if attributes.has_key?(:'version') self.version = attributes[:'version'] end if attributes.has_key?(:'changes') if (value = attributes[:'changes']).is_a?(Array) self.changes = value end end if attributes.has_key?(:'url') self.url = attributes[:'url'] end if attributes.has_key?(:'number') self.number = attributes[:'number'] end if attributes.has_key?(:'receiverEmail') self.receiver_email = attributes[:'receiverEmail'] end if attributes.has_key?(:'discount') self.discount = attributes[:'discount'] end if attributes.has_key?(:'packingNoteMessage') self. = attributes[:'packingNoteMessage'] end if attributes.has_key?(:'transporterMessage') self. = attributes[:'transporterMessage'] end if attributes.has_key?(:'comments') self.comments = attributes[:'comments'] end if attributes.has_key?(:'supplier') self.supplier = attributes[:'supplier'] end if attributes.has_key?(:'deliveryDate') self.delivery_date = attributes[:'deliveryDate'] end if attributes.has_key?(:'orderLines') if (value = attributes[:'orderLines']).is_a?(Array) self.order_lines = value end end if attributes.has_key?(:'project') self.project = attributes[:'project'] end if attributes.has_key?(:'department') self.department = attributes[:'department'] end if attributes.has_key?(:'deliveryAddress') self.delivery_address = attributes[:'deliveryAddress'] end if attributes.has_key?(:'creationDate') self.creation_date = attributes[:'creationDate'] end if attributes.has_key?(:'isClosed') self.is_closed = attributes[:'isClosed'] end if attributes.has_key?(:'ourContact') self.our_contact = attributes[:'ourContact'] end if attributes.has_key?(:'supplierContact') self.supplier_contact = attributes[:'supplierContact'] end if attributes.has_key?(:'attention') self.attention = attributes[:'attention'] end if attributes.has_key?(:'status') self.status = attributes[:'status'] end if attributes.has_key?(:'currency') self.currency = attributes[:'currency'] end if attributes.has_key?(:'restorder') self.restorder = attributes[:'restorder'] end if attributes.has_key?(:'transportType') self.transport_type = attributes[:'transportType'] end if attributes.has_key?(:'pickupPoint') self.pickup_point = attributes[:'pickupPoint'] end if attributes.has_key?(:'document') self.document = attributes[:'document'] end if attributes.has_key?(:'attachment') self. = attributes[:'attachment'] end if attributes.has_key?(:'ediDocument') self.edi_document = attributes[:'ediDocument'] end end |
Instance Attribute Details
#attachment ⇒ Object
The attachments on this PurchaseOrder (if any)
86 87 88 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 86 def @attachment end |
#attention ⇒ Object
Attention
67 68 69 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 67 def attention @attention end |
#changes ⇒ Object
Returns the value of attribute changes.
19 20 21 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 19 def changes @changes end |
#comments ⇒ Object
Delivery information and invoice comments
39 40 41 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 39 def comments @comments end |
#creation_date ⇒ Object
Returns the value of attribute creation_date.
57 58 59 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 57 def creation_date @creation_date end |
#currency ⇒ Object
Company currency
72 73 74 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 72 def currency @currency end |
#delivery_address ⇒ Object
Delivery address
55 56 57 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 55 def delivery_address @delivery_address end |
#delivery_date ⇒ Object
Returns the value of attribute delivery_date.
43 44 45 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 43 def delivery_date @delivery_date end |
#department ⇒ Object
Department/order
52 53 54 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 52 def department @department end |
#discount ⇒ Object
Discount Percentage
30 31 32 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 30 def discount @discount end |
#document ⇒ Object
The PDF representing this PurchaseOrder
83 84 85 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 83 def document @document end |
#edi_document ⇒ Object
The machine readable document (such as EHF or EFO/NELFO) this PurchaseOrder is based on (if any)
89 90 91 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 89 def edi_document @edi_document end |
#id ⇒ Object
Returns the value of attribute id.
15 16 17 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 15 def id @id end |
#is_closed ⇒ Object
Returns the value of attribute is_closed.
59 60 61 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 59 def is_closed @is_closed end |
#number ⇒ Object
Purchase order number
24 25 26 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 24 def number @number end |
#order_lines ⇒ Object
Order lines tied to the purchase order
46 47 48 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 46 def order_lines @order_lines end |
#our_contact ⇒ Object
Returns the value of attribute our_contact.
61 62 63 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 61 def our_contact @our_contact end |
#packing_note_message ⇒ Object
Message on packing note.Wholesaler specific.
33 34 35 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 33 def @packing_note_message end |
#pickup_point ⇒ Object
Pickup point, wholesaler specific
80 81 82 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 80 def pickup_point @pickup_point end |
#project ⇒ Object
Project/order
49 50 51 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 49 def project @project end |
#receiver_email ⇒ Object
Email when purchase order is send by email.
27 28 29 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 27 def receiver_email @receiver_email end |
#restorder ⇒ Object
Returns the value of attribute restorder.
74 75 76 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 74 def restorder @restorder end |
#status ⇒ Object
Returns the value of attribute status.
69 70 71 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 69 def status @status end |
#supplier ⇒ Object
Returns the value of attribute supplier.
41 42 43 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 41 def supplier @supplier end |
#supplier_contact ⇒ Object
Recipient when purchase order is send by email.
64 65 66 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 64 def supplier_contact @supplier_contact end |
#transport_type ⇒ Object
Transport type
77 78 79 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 77 def transport_type @transport_type end |
#transporter_message ⇒ Object
Message to transporter.Wholesaler specific.
36 37 38 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 36 def @transporter_message end |
#url ⇒ Object
Returns the value of attribute url.
21 22 23 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 21 def url @url end |
#version ⇒ Object
Returns the value of attribute version.
17 18 19 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 17 def version @version end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
114 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 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 114 def self.attribute_map { :'id' => :'id', :'version' => :'version', :'changes' => :'changes', :'url' => :'url', :'number' => :'number', :'receiver_email' => :'receiverEmail', :'discount' => :'discount', :'packing_note_message' => :'packingNoteMessage', :'transporter_message' => :'transporterMessage', :'comments' => :'comments', :'supplier' => :'supplier', :'delivery_date' => :'deliveryDate', :'order_lines' => :'orderLines', :'project' => :'project', :'department' => :'department', :'delivery_address' => :'deliveryAddress', :'creation_date' => :'creationDate', :'is_closed' => :'isClosed', :'our_contact' => :'ourContact', :'supplier_contact' => :'supplierContact', :'attention' => :'attention', :'status' => :'status', :'currency' => :'currency', :'restorder' => :'restorder', :'transport_type' => :'transportType', :'pickup_point' => :'pickupPoint', :'document' => :'document', :'attachment' => :'attachment', :'edi_document' => :'ediDocument' } end |
.swagger_types ⇒ Object
Attribute type mapping.
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 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 149 def self.swagger_types { :'id' => :'Integer', :'version' => :'Integer', :'changes' => :'Array<Change>', :'url' => :'String', :'number' => :'String', :'receiver_email' => :'String', :'discount' => :'Float', :'packing_note_message' => :'String', :'transporter_message' => :'String', :'comments' => :'String', :'supplier' => :'Supplier', :'delivery_date' => :'String', :'order_lines' => :'Array<PurchaseOrderline>', :'project' => :'Project', :'department' => :'Department', :'delivery_address' => :'Address', :'creation_date' => :'String', :'is_closed' => :'BOOLEAN', :'our_contact' => :'Employee', :'supplier_contact' => :'Employee', :'attention' => :'Employee', :'status' => :'String', :'currency' => :'Currency', :'restorder' => :'PurchaseOrder', :'transport_type' => :'TransportType', :'pickup_point' => :'PickupPoint', :'document' => :'Document', :'attachment' => :'Document', :'edi_document' => :'Document' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 414 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && version == o.version && changes == o.changes && url == o.url && number == o.number && receiver_email == o.receiver_email && discount == o.discount && == o. && == o. && comments == o.comments && supplier == o.supplier && delivery_date == o.delivery_date && order_lines == o.order_lines && project == o.project && department == o.department && delivery_address == o.delivery_address && creation_date == o.creation_date && is_closed == o.is_closed && our_contact == o.our_contact && supplier_contact == o.supplier_contact && attention == o.attention && status == o.status && currency == o.currency && restorder == o.restorder && transport_type == o.transport_type && pickup_point == o.pickup_point && document == o.document && == o. && edi_document == o.edi_document end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 484 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 temp_model = TripletexRubyClient.const_get(type).new temp_model.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
550 551 552 553 554 555 556 557 558 559 560 561 562 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 550 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
463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 463 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_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]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end |
#eql?(o) ⇒ Boolean
450 451 452 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 450 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
456 457 458 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 456 def hash [id, version, changes, url, number, receiver_email, discount, , , comments, supplier, delivery_date, order_lines, project, department, delivery_address, creation_date, is_closed, our_contact, supplier_contact, attention, status, currency, restorder, transport_type, pickup_point, document, , edi_document].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 314 def list_invalid_properties invalid_properties = Array.new if !@number.nil? && @number.to_s.length > 100 invalid_properties.push('invalid value for "number", the character length must be smaller than or equal to 100.') end if !@receiver_email.nil? && @receiver_email.to_s.length > 100 invalid_properties.push('invalid value for "receiver_email", the character length must be smaller than or equal to 100.') end if !@packing_note_message.nil? && @packing_note_message.to_s.length > 50 invalid_properties.push('invalid value for "packing_note_message", the character length must be smaller than or equal to 50.') end if !@transporter_message.nil? && @transporter_message.to_s.length > 255 invalid_properties.push('invalid value for "transporter_message", the character length must be smaller than or equal to 255.') end if @supplier.nil? invalid_properties.push('invalid value for "supplier", supplier cannot be nil.') end if @delivery_date.nil? invalid_properties.push('invalid value for "delivery_date", delivery_date cannot be nil.') end if @our_contact.nil? invalid_properties.push('invalid value for "our_contact", our_contact cannot be nil.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
530 531 532 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 530 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
536 537 538 539 540 541 542 543 544 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 536 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
524 525 526 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 524 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
349 350 351 352 353 354 355 356 357 358 359 360 |
# File 'lib/tripletex_ruby_client/models/purchase_order.rb', line 349 def valid? return false if !@number.nil? && @number.to_s.length > 100 return false if !@receiver_email.nil? && @receiver_email.to_s.length > 100 return false if !@packing_note_message.nil? && @packing_note_message.to_s.length > 50 return false if !@transporter_message.nil? && @transporter_message.to_s.length > 255 return false if @supplier.nil? return false if @delivery_date.nil? return false if @our_contact.nil? status_validator = EnumAttributeValidator.new('String', ['STATUS_OPEN', 'STATUS_SENT', 'STATUS_RECEIVING', 'STATUS_CONFIRMED_DEVIATION_DETECTED', 'STATUS_DEVIATION_OPEN', 'STATUS_DEVIATION_CONFIRMED', 'STATUS_CONFIRMED', 'STATUS_CANCELLED']) return false unless status_validator.valid?(@status) true end |