Class: DearInventoryRuby::Sale

Inherits:
Object
  • Object
show all
Defined in:
lib/dear-inventory-ruby/models/sale.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Sale

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



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
311
312
313
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
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
# File 'lib/dear-inventory-ruby/models/sale.rb', line 248

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `DearInventoryRuby::Sale` 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 `DearInventoryRuby::Sale`. 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?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.key?(:'customer')
    self.customer = attributes[:'customer']
  end

  if attributes.key?(:'customer_id')
    self.customer_id = attributes[:'customer_id']
  end

  if attributes.key?(:'contact')
    self.contact = attributes[:'contact']
  end

  if attributes.key?(:'phone')
    self.phone = attributes[:'phone']
  end

  if attributes.key?(:'email')
    self.email = attributes[:'email']
  end

  if attributes.key?(:'default_account')
    self. = attributes[:'default_account']
  end

  if attributes.key?(:'skip_quote')
    self.skip_quote = attributes[:'skip_quote']
  end

  if attributes.key?(:'billing_address')
    self.billing_address = attributes[:'billing_address']
  end

  if attributes.key?(:'shipping_address')
    self.shipping_address = attributes[:'shipping_address']
  end

  if attributes.key?(:'shipping_notes')
    self.shipping_notes = attributes[:'shipping_notes']
  end

  if attributes.key?(:'base_currency')
    self.base_currency = attributes[:'base_currency']
  end

  if attributes.key?(:'customer_currency')
    self.customer_currency = attributes[:'customer_currency']
  end

  if attributes.key?(:'tax_rule')
    self.tax_rule = attributes[:'tax_rule']
  end

  if attributes.key?(:'tax_calculation')
    self.tax_calculation = attributes[:'tax_calculation']
  end

  if attributes.key?(:'terms')
    self.terms = attributes[:'terms']
  end

  if attributes.key?(:'price_tier')
    self.price_tier = attributes[:'price_tier']
  end

  if attributes.key?(:'ship_by')
    self.ship_by = attributes[:'ship_by']
  end

  if attributes.key?(:'location')
    self.location = attributes[:'location']
  end

  if attributes.key?(:'sale_order_date')
    self.sale_order_date = attributes[:'sale_order_date']
  end

  if attributes.key?(:'last_modified_on')
    self.last_modified_on = attributes[:'last_modified_on']
  end

  if attributes.key?(:'note')
    self.note = attributes[:'note']
  end

  if attributes.key?(:'customer_reference')
    self.customer_reference = attributes[:'customer_reference']
  end

  if attributes.key?(:'cogs_amount')
    self.cogs_amount = attributes[:'cogs_amount']
  end

  if attributes.key?(:'status')
    self.status = attributes[:'status']
  end

  if attributes.key?(:'combined_picking_status')
    self.combined_picking_status = attributes[:'combined_picking_status']
  end

  if attributes.key?(:'combined_packing_status')
    self.combined_packing_status = attributes[:'combined_packing_status']
  end

  if attributes.key?(:'combined_shipping_status')
    self.combined_shipping_status = attributes[:'combined_shipping_status']
  end

  if attributes.key?(:'ful_filment_status')
    self.ful_filment_status = attributes[:'ful_filment_status']
  end

  if attributes.key?(:'combined_invoice_status')
    self.combined_invoice_status = attributes[:'combined_invoice_status']
  end

  if attributes.key?(:'combined_payment_status')
    self.combined_payment_status = attributes[:'combined_payment_status']
  end

  if attributes.key?(:'combined_tracking_numbers')
    self.combined_tracking_numbers = attributes[:'combined_tracking_numbers']
  end

  if attributes.key?(:'carrier')
    self.carrier = attributes[:'carrier']
  end

  if attributes.key?(:'currency_rate')
    self.currency_rate = attributes[:'currency_rate']
  end

  if attributes.key?(:'sales_representative')
    self.sales_representative = attributes[:'sales_representative']
  end

  if attributes.key?(:'type')
    self.type = attributes[:'type']
  end

  if attributes.key?(:'source_channel')
    self.source_channel = attributes[:'source_channel']
  end

  if attributes.key?(:'external_id')
    self.external_id = attributes[:'external_id']
  end

  if attributes.key?(:'service_only')
    self.service_only = attributes[:'service_only']
  end

  if attributes.key?(:'quote')
    self.quote = attributes[:'quote']
  end

  if attributes.key?(:'order')
    self.order = attributes[:'order']
  end

  if attributes.key?(:'invoices')
    if (value = attributes[:'invoices']).is_a?(Array)
      self.invoices = value
    end
  end

  if attributes.key?(:'attachments')
    if (value = attributes[:'attachments']).is_a?(Array)
      self.attachments = value
    end
  end
end

Instance Attribute Details

#attachmentsObject

Sale Attachments



140
141
142
# File 'lib/dear-inventory-ruby/models/sale.rb', line 140

def attachments
  @attachments
end

#base_currencyObject

3 character currency code of Base Currency defined in General Settings on the moment when Sale was created.



49
50
51
# File 'lib/dear-inventory-ruby/models/sale.rb', line 49

def base_currency
  @base_currency
end

#billing_addressObject

Returns the value of attribute billing_address.



41
42
43
# File 'lib/dear-inventory-ruby/models/sale.rb', line 41

def billing_address
  @billing_address
end

#carrierObject

Name of Carrier/shipping method



112
113
114
# File 'lib/dear-inventory-ruby/models/sale.rb', line 112

def carrier
  @carrier
end

#cogs_amountObject

COGS amount in base currency



85
86
87
# File 'lib/dear-inventory-ruby/models/sale.rb', line 85

def cogs_amount
  @cogs_amount
end

#combined_invoice_statusObject

Invoice status. Possible Values are INVOICED, INVOICED / CREDITED, NOT AVAILABLE, NOT INVOICED, PARTIALLY INVOICED, PARTIALLY INVOICED / CREDITED



103
104
105
# File 'lib/dear-inventory-ruby/models/sale.rb', line 103

def combined_invoice_status
  @combined_invoice_status
end

#combined_packing_statusObject

Pack status. Possible Values are VOIDED, NOT AVAILABLE, PACKED, PACKING, NOT PACKED, PARTIALLY PACKED



94
95
96
# File 'lib/dear-inventory-ruby/models/sale.rb', line 94

def combined_packing_status
  @combined_packing_status
end

#combined_payment_statusObject

Payment status. Possible Values are NOT REFUNDED, PREPAID, PARTIALLY PAID, UNPAID, PAID, VOIDED



106
107
108
# File 'lib/dear-inventory-ruby/models/sale.rb', line 106

def combined_payment_status
  @combined_payment_status
end

#combined_picking_statusObject

Pick status. Possible Values are VOIDED, NOT AVAILABLE, PICKED, PICKING , NOT PICKED , PARTIALLY PICKED



91
92
93
# File 'lib/dear-inventory-ruby/models/sale.rb', line 91

def combined_picking_status
  @combined_picking_status
end

#combined_shipping_statusObject

Ship status. Possible Values are VOIDED, NOT AVAILABLE, SHIPPED, SHIPPING , NOT SHIPPED , PARTIALLY SHIPPED



97
98
99
# File 'lib/dear-inventory-ruby/models/sale.rb', line 97

def combined_shipping_status
  @combined_shipping_status
end

#combined_tracking_numbersObject

Tracking Numbers



109
110
111
# File 'lib/dear-inventory-ruby/models/sale.rb', line 109

def combined_tracking_numbers
  @combined_tracking_numbers
end

#contactObject

Customer Contact name



27
28
29
# File 'lib/dear-inventory-ruby/models/sale.rb', line 27

def contact
  @contact
end

#currency_rateObject

Conversion Rate expressed as number of Base currency units for one Customer currency unit



115
116
117
# File 'lib/dear-inventory-ruby/models/sale.rb', line 115

def currency_rate
  @currency_rate
end

#customerObject

Customer name



21
22
23
# File 'lib/dear-inventory-ruby/models/sale.rb', line 21

def customer
  @customer
end

#customer_currencyObject

3 character currency code of customer Currency defined in Customer card at the moment when customer is selected for the Sale.



52
53
54
# File 'lib/dear-inventory-ruby/models/sale.rb', line 52

def customer_currency
  @customer_currency
end

#customer_idObject

Customer identifier



24
25
26
# File 'lib/dear-inventory-ruby/models/sale.rb', line 24

def customer_id
  @customer_id
end

#customer_referenceObject

Reference number used by customer to identify this sale. Could be a purchase order number generated by customer.



82
83
84
# File 'lib/dear-inventory-ruby/models/sale.rb', line 82

def customer_reference
  @customer_reference
end

#default_accountObject

Account code used by default for invoice lines when no revenue account is defined on Product. By default it is equal to Customer Sale account



36
37
38
# File 'lib/dear-inventory-ruby/models/sale.rb', line 36

def 
  @default_account
end

#emailObject

Customer Contact email



33
34
35
# File 'lib/dear-inventory-ruby/models/sale.rb', line 33

def email
  @email
end

#external_idObject

Custom field that is only available in API and allows to set arbitrary value for the sale for later search and any custom logic



127
128
129
# File 'lib/dear-inventory-ruby/models/sale.rb', line 127

def external_id
  @external_id
end

#ful_filment_statusObject

Fulfilment status. Possible Values are FULFILLED, PARTIALLY FULFILLED, NOT AVAILABLE, NOT FULFILLED, VOIDED



100
101
102
# File 'lib/dear-inventory-ruby/models/sale.rb', line 100

def ful_filment_status
  @ful_filment_status
end

#idObject

Unique DEAR Sale ID. Required for PUT



18
19
20
# File 'lib/dear-inventory-ruby/models/sale.rb', line 18

def id
  @id
end

#invoicesObject

Sale Invoices



137
138
139
# File 'lib/dear-inventory-ruby/models/sale.rb', line 137

def invoices
  @invoices
end

#last_modified_onObject

UTC Time



76
77
78
# File 'lib/dear-inventory-ruby/models/sale.rb', line 76

def last_modified_on
  @last_modified_on
end

#locationObject

Default location to pick stock from



70
71
72
# File 'lib/dear-inventory-ruby/models/sale.rb', line 70

def location
  @location
end

#noteObject

Custom Sale note



79
80
81
# File 'lib/dear-inventory-ruby/models/sale.rb', line 79

def note
  @note
end

#orderObject

Returns the value of attribute order.



134
135
136
# File 'lib/dear-inventory-ruby/models/sale.rb', line 134

def order
  @order
end

#phoneObject

Customer Contact phone



30
31
32
# File 'lib/dear-inventory-ruby/models/sale.rb', line 30

def phone
  @phone
end

#price_tierObject

Price Tier name selected for Sale



64
65
66
# File 'lib/dear-inventory-ruby/models/sale.rb', line 64

def price_tier
  @price_tier
end

#quoteObject

Returns the value of attribute quote.



132
133
134
# File 'lib/dear-inventory-ruby/models/sale.rb', line 132

def quote
  @quote
end

#sale_order_dateObject

Date when task was created



73
74
75
# File 'lib/dear-inventory-ruby/models/sale.rb', line 73

def sale_order_date
  @sale_order_date
end

#sales_representativeObject

Sales representative name



118
119
120
# File 'lib/dear-inventory-ruby/models/sale.rb', line 118

def sales_representative
  @sales_representative
end

#service_onlyObject

true when it is service-only sale



130
131
132
# File 'lib/dear-inventory-ruby/models/sale.rb', line 130

def service_only
  @service_only
end

#ship_byObject

Date when shipment is due



67
68
69
# File 'lib/dear-inventory-ruby/models/sale.rb', line 67

def ship_by
  @ship_by
end

#shipping_addressObject

Returns the value of attribute shipping_address.



43
44
45
# File 'lib/dear-inventory-ruby/models/sale.rb', line 43

def shipping_address
  @shipping_address
end

#shipping_notesObject

Shipping Notes



46
47
48
# File 'lib/dear-inventory-ruby/models/sale.rb', line 46

def shipping_notes
  @shipping_notes
end

#skip_quoteObject

True if there is no quote in the sale



39
40
41
# File 'lib/dear-inventory-ruby/models/sale.rb', line 39

def skip_quote
  @skip_quote
end

#source_channelObject

Source of the sale. read-only field



124
125
126
# File 'lib/dear-inventory-ruby/models/sale.rb', line 124

def source_channel
  @source_channel
end

#statusObject

Sale Status, see possible values



88
89
90
# File 'lib/dear-inventory-ruby/models/sale.rb', line 88

def status
  @status
end

#tax_calculationObject

Inclusive or Exclusive



58
59
60
# File 'lib/dear-inventory-ruby/models/sale.rb', line 58

def tax_calculation
  @tax_calculation
end

#tax_ruleObject

Default Tax Rule name selected for Sale



55
56
57
# File 'lib/dear-inventory-ruby/models/sale.rb', line 55

def tax_rule
  @tax_rule
end

#termsObject

Payment terms name



61
62
63
# File 'lib/dear-inventory-ruby/models/sale.rb', line 61

def terms
  @terms
end

#typeObject

Type of sale Simple Sale or Advanced Sale, Service Sale



121
122
123
# File 'lib/dear-inventory-ruby/models/sale.rb', line 121

def type
  @type
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



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
# File 'lib/dear-inventory-ruby/models/sale.rb', line 143

def self.attribute_map
  {
    :'id' => :'ID',
    :'customer' => :'Customer',
    :'customer_id' => :'CustomerID',
    :'contact' => :'Contact',
    :'phone' => :'Phone',
    :'email' => :'Email',
    :'default_account' => :'DefaultAccount',
    :'skip_quote' => :'SkipQuote',
    :'billing_address' => :'BillingAddress',
    :'shipping_address' => :'ShippingAddress',
    :'shipping_notes' => :'ShippingNotes',
    :'base_currency' => :'BaseCurrency',
    :'customer_currency' => :'CustomerCurrency',
    :'tax_rule' => :'TaxRule',
    :'tax_calculation' => :'TaxCalculation',
    :'terms' => :'Terms',
    :'price_tier' => :'PriceTier',
    :'ship_by' => :'ShipBy',
    :'location' => :'Location',
    :'sale_order_date' => :'SaleOrderDate',
    :'last_modified_on' => :'LastModifiedOn',
    :'note' => :'Note',
    :'customer_reference' => :'CustomerReference',
    :'cogs_amount' => :'COGSAmount',
    :'status' => :'Status',
    :'combined_picking_status' => :'CombinedPickingStatus',
    :'combined_packing_status' => :'CombinedPackingStatus',
    :'combined_shipping_status' => :'CombinedShippingStatus',
    :'ful_filment_status' => :'FulFilmentStatus',
    :'combined_invoice_status' => :'CombinedInvoiceStatus',
    :'combined_payment_status' => :'CombinedPaymentStatus',
    :'combined_tracking_numbers' => :'CombinedTrackingNumbers',
    :'carrier' => :'Carrier',
    :'currency_rate' => :'CurrencyRate',
    :'sales_representative' => :'SalesRepresentative',
    :'type' => :'Type',
    :'source_channel' => :'SourceChannel',
    :'external_id' => :'ExternalID',
    :'service_only' => :'ServiceOnly',
    :'quote' => :'Quote',
    :'order' => :'Order',
    :'invoices' => :'Invoices',
    :'attachments' => :'Attachments'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



516
517
518
# File 'lib/dear-inventory-ruby/models/sale.rb', line 516

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



241
242
243
244
# File 'lib/dear-inventory-ruby/models/sale.rb', line 241

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/dear-inventory-ruby/models/sale.rb', line 192

def self.openapi_types
  {
    :'id' => :'String',
    :'customer' => :'String',
    :'customer_id' => :'String',
    :'contact' => :'String',
    :'phone' => :'String',
    :'email' => :'String',
    :'default_account' => :'String',
    :'skip_quote' => :'Boolean',
    :'billing_address' => :'Address',
    :'shipping_address' => :'ShippingAddress',
    :'shipping_notes' => :'String',
    :'base_currency' => :'String',
    :'customer_currency' => :'String',
    :'tax_rule' => :'String',
    :'tax_calculation' => :'String',
    :'terms' => :'String',
    :'price_tier' => :'String',
    :'ship_by' => :'Date',
    :'location' => :'String',
    :'sale_order_date' => :'Date',
    :'last_modified_on' => :'Date',
    :'note' => :'String',
    :'customer_reference' => :'String',
    :'cogs_amount' => :'Float',
    :'status' => :'String',
    :'combined_picking_status' => :'String',
    :'combined_packing_status' => :'String',
    :'combined_shipping_status' => :'String',
    :'ful_filment_status' => :'String',
    :'combined_invoice_status' => :'String',
    :'combined_payment_status' => :'String',
    :'combined_tracking_numbers' => :'String',
    :'carrier' => :'String',
    :'currency_rate' => :'Float',
    :'sales_representative' => :'String',
    :'type' => :'String',
    :'source_channel' => :'String',
    :'external_id' => :'String',
    :'service_only' => :'String',
    :'quote' => :'SaleQuote',
    :'order' => :'SaleOrder',
    :'invoices' => :'Array<SaleInvoice>',
    :'attachments' => :'Array<AttachmentLine>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
# File 'lib/dear-inventory-ruby/models/sale.rb', line 453

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      customer == o.customer &&
      customer_id == o.customer_id &&
      contact == o.contact &&
      phone == o.phone &&
      email == o.email &&
       == o. &&
      skip_quote == o.skip_quote &&
      billing_address == o.billing_address &&
      shipping_address == o.shipping_address &&
      shipping_notes == o.shipping_notes &&
      base_currency == o.base_currency &&
      customer_currency == o.customer_currency &&
      tax_rule == o.tax_rule &&
      tax_calculation == o.tax_calculation &&
      terms == o.terms &&
      price_tier == o.price_tier &&
      ship_by == o.ship_by &&
      location == o.location &&
      sale_order_date == o.sale_order_date &&
      last_modified_on == o.last_modified_on &&
      note == o.note &&
      customer_reference == o.customer_reference &&
      cogs_amount == o.cogs_amount &&
      status == o.status &&
      combined_picking_status == o.combined_picking_status &&
      combined_packing_status == o.combined_packing_status &&
      combined_shipping_status == o.combined_shipping_status &&
      ful_filment_status == o.ful_filment_status &&
      combined_invoice_status == o.combined_invoice_status &&
      combined_payment_status == o.combined_payment_status &&
      combined_tracking_numbers == o.combined_tracking_numbers &&
      carrier == o.carrier &&
      currency_rate == o.currency_rate &&
      sales_representative == o.sales_representative &&
      type == o.type &&
      source_channel == o.source_channel &&
      external_id == o.external_id &&
      service_only == o.service_only &&
      quote == o.quote &&
      order == o.order &&
      invoices == o.invoices &&
      attachments == o.attachments
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
# File 'lib/dear-inventory-ruby/models/sale.rb', line 544

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
    DearInventoryRuby.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

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



613
614
615
616
617
618
619
620
621
622
623
624
625
# File 'lib/dear-inventory-ruby/models/sale.rb', line 613

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

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
# File 'lib/dear-inventory-ruby/models/sale.rb', line 523

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]]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


503
504
505
# File 'lib/dear-inventory-ruby/models/sale.rb', line 503

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



509
510
511
# File 'lib/dear-inventory-ruby/models/sale.rb', line 509

def hash
  [id, customer, customer_id, contact, phone, email, , skip_quote, billing_address, shipping_address, shipping_notes, base_currency, customer_currency, tax_rule, tax_calculation, terms, price_tier, ship_by, location, sale_order_date, last_modified_on, note, customer_reference, cogs_amount, status, combined_picking_status, combined_packing_status, combined_shipping_status, ful_filment_status, combined_invoice_status, combined_payment_status, combined_tracking_numbers, carrier, currency_rate, sales_representative, type, source_channel, external_id, service_only, quote, order, invoices, attachments].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



440
441
442
443
# File 'lib/dear-inventory-ruby/models/sale.rb', line 440

def list_invalid_properties
  invalid_properties = Array.new
  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



589
590
591
# File 'lib/dear-inventory-ruby/models/sale.rb', line 589

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



595
596
597
598
599
600
601
602
603
604
605
606
607
# File 'lib/dear-inventory-ruby/models/sale.rb', line 595

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_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



583
584
585
# File 'lib/dear-inventory-ruby/models/sale.rb', line 583

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



447
448
449
# File 'lib/dear-inventory-ruby/models/sale.rb', line 447

def valid?
  true
end