Class: TripletexRubyClient::Product

Inherits:
Object
  • Object
show all
Defined in:
lib/tripletex_ruby_client/models/product.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Product

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
# File 'lib/tripletex_ruby_client/models/product.rb', line 217

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?(:'name')
    self.name = attributes[:'name']
  end

  if attributes.has_key?(:'number')
    self.number = attributes[:'number']
  end

  if attributes.has_key?(:'description')
    self.description = attributes[:'description']
  end

  if attributes.has_key?(:'ean')
    self.ean = attributes[:'ean']
  end

  if attributes.has_key?(:'elNumber')
    self.el_number = attributes[:'elNumber']
  end

  if attributes.has_key?(:'nrfNumber')
    self.nrf_number = attributes[:'nrfNumber']
  end

  if attributes.has_key?(:'costExcludingVatCurrency')
    self.cost_excluding_vat_currency = attributes[:'costExcludingVatCurrency']
  end

  if attributes.has_key?(:'expenses')
    self.expenses = attributes[:'expenses']
  end

  if attributes.has_key?(:'expensesInPercent')
    self.expenses_in_percent = attributes[:'expensesInPercent']
  end

  if attributes.has_key?(:'costPrice')
    self.cost_price = attributes[:'costPrice']
  end

  if attributes.has_key?(:'profit')
    self.profit = attributes[:'profit']
  end

  if attributes.has_key?(:'profitInPercent')
    self.profit_in_percent = attributes[:'profitInPercent']
  end

  if attributes.has_key?(:'priceExcludingVatCurrency')
    self.price_excluding_vat_currency = attributes[:'priceExcludingVatCurrency']
  end

  if attributes.has_key?(:'priceIncludingVatCurrency')
    self.price_including_vat_currency = attributes[:'priceIncludingVatCurrency']
  end

  if attributes.has_key?(:'isInactive')
    self.is_inactive = attributes[:'isInactive']
  end

  if attributes.has_key?(:'discountGroup')
    self.discount_group = attributes[:'discountGroup']
  end

  if attributes.has_key?(:'productUnit')
    self.product_unit = attributes[:'productUnit']
  end

  if attributes.has_key?(:'isStockItem')
    self.is_stock_item = attributes[:'isStockItem']
  end

  if attributes.has_key?(:'stockOfGoods')
    self.stock_of_goods = attributes[:'stockOfGoods']
  end

  if attributes.has_key?(:'vatType')
    self.vat_type = attributes[:'vatType']
  end

  if attributes.has_key?(:'currency')
    self.currency = attributes[:'currency']
  end

  if attributes.has_key?(:'department')
    self.department = attributes[:'department']
  end

  if attributes.has_key?(:'account')
    self. = attributes[:'account']
  end

  if attributes.has_key?(:'discountPrice')
    self.discount_price = attributes[:'discountPrice']
  end

  if attributes.has_key?(:'supplier')
    self.supplier = attributes[:'supplier']
  end

  if attributes.has_key?(:'resaleProduct')
    self.resale_product = attributes[:'resaleProduct']
  end

  if attributes.has_key?(:'isDeletable')
    self.is_deletable = attributes[:'isDeletable']
  end

  if attributes.has_key?(:'hasSupplierProductConnected')
    self.has_supplier_product_connected = attributes[:'hasSupplierProductConnected']
  end

  if attributes.has_key?(:'weight')
    self.weight = attributes[:'weight']
  end

  if attributes.has_key?(:'weightUnit')
    self.weight_unit = attributes[:'weightUnit']
  end

  if attributes.has_key?(:'volume')
    self.volume = attributes[:'volume']
  end

  if attributes.has_key?(:'volumeUnit')
    self.volume_unit = attributes[:'volumeUnit']
  end

  if attributes.has_key?(:'hsnCode')
    self.hsn_code = attributes[:'hsnCode']
  end

  if attributes.has_key?(:'image')
    self.image = attributes[:'image']
  end

  if attributes.has_key?(:'markupListPercentage')
    self.markup_list_percentage = attributes[:'markupListPercentage']
  end

  if attributes.has_key?(:'markupNetPercentage')
    self.markup_net_percentage = attributes[:'markupNetPercentage']
  end
end

Instance Attribute Details

#accountObject

Returns the value of attribute account.



73
74
75
# File 'lib/tripletex_ruby_client/models/product.rb', line 73

def 
  @account
end

#changesObject

Returns the value of attribute changes.



21
22
23
# File 'lib/tripletex_ruby_client/models/product.rb', line 21

def changes
  @changes
end

#cost_excluding_vat_currencyObject

Price purchase (cost) excluding VAT in the product’s currency



38
39
40
# File 'lib/tripletex_ruby_client/models/product.rb', line 38

def cost_excluding_vat_currency
  @cost_excluding_vat_currency
end

#cost_priceObject

Cost price of purchase



45
46
47
# File 'lib/tripletex_ruby_client/models/product.rb', line 45

def cost_price
  @cost_price
end

#currencyObject

Returns the value of attribute currency.



69
70
71
# File 'lib/tripletex_ruby_client/models/product.rb', line 69

def currency
  @currency
end

#departmentObject

Returns the value of attribute department.



71
72
73
# File 'lib/tripletex_ruby_client/models/product.rb', line 71

def department
  @department
end

#descriptionObject

Returns the value of attribute description.



29
30
31
# File 'lib/tripletex_ruby_client/models/product.rb', line 29

def description
  @description
end

#discount_groupObject

Returns the value of attribute discount_group.



59
60
61
# File 'lib/tripletex_ruby_client/models/product.rb', line 59

def discount_group
  @discount_group
end

#discount_priceObject

Returns the value of attribute discount_price.



75
76
77
# File 'lib/tripletex_ruby_client/models/product.rb', line 75

def discount_price
  @discount_price
end

#eanObject

Returns the value of attribute ean.



31
32
33
# File 'lib/tripletex_ruby_client/models/product.rb', line 31

def ean
  @ean
end

#el_numberObject

Returns the value of attribute el_number.



33
34
35
# File 'lib/tripletex_ruby_client/models/product.rb', line 33

def el_number
  @el_number
end

#expensesObject

Returns the value of attribute expenses.



40
41
42
# File 'lib/tripletex_ruby_client/models/product.rb', line 40

def expenses
  @expenses
end

#expenses_in_percentObject

Returns the value of attribute expenses_in_percent.



42
43
44
# File 'lib/tripletex_ruby_client/models/product.rb', line 42

def expenses_in_percent
  @expenses_in_percent
end

#has_supplier_product_connectedObject

Returns the value of attribute has_supplier_product_connected.



83
84
85
# File 'lib/tripletex_ruby_client/models/product.rb', line 83

def has_supplier_product_connected
  @has_supplier_product_connected
end

#hsn_codeObject

Returns the value of attribute hsn_code.



93
94
95
# File 'lib/tripletex_ruby_client/models/product.rb', line 93

def hsn_code
  @hsn_code
end

#idObject

Returns the value of attribute id.



17
18
19
# File 'lib/tripletex_ruby_client/models/product.rb', line 17

def id
  @id
end

#imageObject

Returns the value of attribute image.



95
96
97
# File 'lib/tripletex_ruby_client/models/product.rb', line 95

def image
  @image
end

#is_deletableObject

Returns the value of attribute is_deletable.



81
82
83
# File 'lib/tripletex_ruby_client/models/product.rb', line 81

def is_deletable
  @is_deletable
end

#is_inactiveObject

Returns the value of attribute is_inactive.



57
58
59
# File 'lib/tripletex_ruby_client/models/product.rb', line 57

def is_inactive
  @is_inactive
end

#is_stock_itemObject

Returns the value of attribute is_stock_item.



63
64
65
# File 'lib/tripletex_ruby_client/models/product.rb', line 63

def is_stock_item
  @is_stock_item
end

#markup_list_percentageObject

Returns the value of attribute markup_list_percentage.



97
98
99
# File 'lib/tripletex_ruby_client/models/product.rb', line 97

def markup_list_percentage
  @markup_list_percentage
end

#markup_net_percentageObject

Returns the value of attribute markup_net_percentage.



99
100
101
# File 'lib/tripletex_ruby_client/models/product.rb', line 99

def markup_net_percentage
  @markup_net_percentage
end

#nameObject

Returns the value of attribute name.



25
26
27
# File 'lib/tripletex_ruby_client/models/product.rb', line 25

def name
  @name
end

#nrf_numberObject

Returns the value of attribute nrf_number.



35
36
37
# File 'lib/tripletex_ruby_client/models/product.rb', line 35

def nrf_number
  @nrf_number
end

#numberObject

Returns the value of attribute number.



27
28
29
# File 'lib/tripletex_ruby_client/models/product.rb', line 27

def number
  @number
end

#price_excluding_vat_currencyObject

Price of purchase excluding VAT in the product’s currency



52
53
54
# File 'lib/tripletex_ruby_client/models/product.rb', line 52

def price_excluding_vat_currency
  @price_excluding_vat_currency
end

#price_including_vat_currencyObject

Price of purchase including VAT in the product’s currency



55
56
57
# File 'lib/tripletex_ruby_client/models/product.rb', line 55

def price_including_vat_currency
  @price_including_vat_currency
end

#product_unitObject

Returns the value of attribute product_unit.



61
62
63
# File 'lib/tripletex_ruby_client/models/product.rb', line 61

def product_unit
  @product_unit
end

#profitObject

Returns the value of attribute profit.



47
48
49
# File 'lib/tripletex_ruby_client/models/product.rb', line 47

def profit
  @profit
end

#profit_in_percentObject

Returns the value of attribute profit_in_percent.



49
50
51
# File 'lib/tripletex_ruby_client/models/product.rb', line 49

def profit_in_percent
  @profit_in_percent
end

#resale_productObject

Returns the value of attribute resale_product.



79
80
81
# File 'lib/tripletex_ruby_client/models/product.rb', line 79

def resale_product
  @resale_product
end

#stock_of_goodsObject

Returns the value of attribute stock_of_goods.



65
66
67
# File 'lib/tripletex_ruby_client/models/product.rb', line 65

def stock_of_goods
  @stock_of_goods
end

#supplierObject

Returns the value of attribute supplier.



77
78
79
# File 'lib/tripletex_ruby_client/models/product.rb', line 77

def supplier
  @supplier
end

#urlObject

Returns the value of attribute url.



23
24
25
# File 'lib/tripletex_ruby_client/models/product.rb', line 23

def url
  @url
end

#vat_typeObject

Returns the value of attribute vat_type.



67
68
69
# File 'lib/tripletex_ruby_client/models/product.rb', line 67

def vat_type
  @vat_type
end

#versionObject

Returns the value of attribute version.



19
20
21
# File 'lib/tripletex_ruby_client/models/product.rb', line 19

def version
  @version
end

#volumeObject

Returns the value of attribute volume.



89
90
91
# File 'lib/tripletex_ruby_client/models/product.rb', line 89

def volume
  @volume
end

#volume_unitObject

Returns the value of attribute volume_unit.



91
92
93
# File 'lib/tripletex_ruby_client/models/product.rb', line 91

def volume_unit
  @volume_unit
end

#weightObject

Returns the value of attribute weight.



85
86
87
# File 'lib/tripletex_ruby_client/models/product.rb', line 85

def weight
  @weight
end

#weight_unitObject

Returns the value of attribute weight_unit.



87
88
89
# File 'lib/tripletex_ruby_client/models/product.rb', line 87

def weight_unit
  @weight_unit
end

Class Method Details

.attribute_mapObject

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



124
125
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
# File 'lib/tripletex_ruby_client/models/product.rb', line 124

def self.attribute_map
  {
    :'id' => :'id',
    :'version' => :'version',
    :'changes' => :'changes',
    :'url' => :'url',
    :'name' => :'name',
    :'number' => :'number',
    :'description' => :'description',
    :'ean' => :'ean',
    :'el_number' => :'elNumber',
    :'nrf_number' => :'nrfNumber',
    :'cost_excluding_vat_currency' => :'costExcludingVatCurrency',
    :'expenses' => :'expenses',
    :'expenses_in_percent' => :'expensesInPercent',
    :'cost_price' => :'costPrice',
    :'profit' => :'profit',
    :'profit_in_percent' => :'profitInPercent',
    :'price_excluding_vat_currency' => :'priceExcludingVatCurrency',
    :'price_including_vat_currency' => :'priceIncludingVatCurrency',
    :'is_inactive' => :'isInactive',
    :'discount_group' => :'discountGroup',
    :'product_unit' => :'productUnit',
    :'is_stock_item' => :'isStockItem',
    :'stock_of_goods' => :'stockOfGoods',
    :'vat_type' => :'vatType',
    :'currency' => :'currency',
    :'department' => :'department',
    :'account' => :'account',
    :'discount_price' => :'discountPrice',
    :'supplier' => :'supplier',
    :'resale_product' => :'resaleProduct',
    :'is_deletable' => :'isDeletable',
    :'has_supplier_product_connected' => :'hasSupplierProductConnected',
    :'weight' => :'weight',
    :'weight_unit' => :'weightUnit',
    :'volume' => :'volume',
    :'volume_unit' => :'volumeUnit',
    :'hsn_code' => :'hsnCode',
    :'image' => :'image',
    :'markup_list_percentage' => :'markupListPercentage',
    :'markup_net_percentage' => :'markupNetPercentage'
  }
end

.swagger_typesObject

Attribute type mapping.



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
# File 'lib/tripletex_ruby_client/models/product.rb', line 170

def self.swagger_types
  {
    :'id' => :'Integer',
    :'version' => :'Integer',
    :'changes' => :'Array<Change>',
    :'url' => :'String',
    :'name' => :'String',
    :'number' => :'String',
    :'description' => :'String',
    :'ean' => :'String',
    :'el_number' => :'String',
    :'nrf_number' => :'String',
    :'cost_excluding_vat_currency' => :'Float',
    :'expenses' => :'Float',
    :'expenses_in_percent' => :'Float',
    :'cost_price' => :'Float',
    :'profit' => :'Float',
    :'profit_in_percent' => :'Float',
    :'price_excluding_vat_currency' => :'Float',
    :'price_including_vat_currency' => :'Float',
    :'is_inactive' => :'BOOLEAN',
    :'discount_group' => :'DiscountGroup',
    :'product_unit' => :'ProductUnit',
    :'is_stock_item' => :'BOOLEAN',
    :'stock_of_goods' => :'Float',
    :'vat_type' => :'VatType',
    :'currency' => :'Currency',
    :'department' => :'Department',
    :'account' => :'Account',
    :'discount_price' => :'Float',
    :'supplier' => :'Supplier',
    :'resale_product' => :'Product',
    :'is_deletable' => :'BOOLEAN',
    :'has_supplier_product_connected' => :'BOOLEAN',
    :'weight' => :'Float',
    :'weight_unit' => :'String',
    :'volume' => :'Float',
    :'volume_unit' => :'String',
    :'hsn_code' => :'String',
    :'image' => :'Document',
    :'markup_list_percentage' => :'Float',
    :'markup_net_percentage' => :'Float'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
# File 'lib/tripletex_ruby_client/models/product.rb', line 515

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      version == o.version &&
      changes == o.changes &&
      url == o.url &&
      name == o.name &&
      number == o.number &&
      description == o.description &&
      ean == o.ean &&
      el_number == o.el_number &&
      nrf_number == o.nrf_number &&
      cost_excluding_vat_currency == o.cost_excluding_vat_currency &&
      expenses == o.expenses &&
      expenses_in_percent == o.expenses_in_percent &&
      cost_price == o.cost_price &&
      profit == o.profit &&
      profit_in_percent == o.profit_in_percent &&
      price_excluding_vat_currency == o.price_excluding_vat_currency &&
      price_including_vat_currency == o.price_including_vat_currency &&
      is_inactive == o.is_inactive &&
      discount_group == o.discount_group &&
      product_unit == o.product_unit &&
      is_stock_item == o.is_stock_item &&
      stock_of_goods == o.stock_of_goods &&
      vat_type == o.vat_type &&
      currency == o.currency &&
      department == o.department &&
       == o. &&
      discount_price == o.discount_price &&
      supplier == o.supplier &&
      resale_product == o.resale_product &&
      is_deletable == o.is_deletable &&
      has_supplier_product_connected == o.has_supplier_product_connected &&
      weight == o.weight &&
      weight_unit == o.weight_unit &&
      volume == o.volume &&
      volume_unit == o.volume_unit &&
      hsn_code == o.hsn_code &&
      image == o.image &&
      markup_list_percentage == o.markup_list_percentage &&
      markup_net_percentage == o.markup_net_percentage
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



596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
# File 'lib/tripletex_ruby_client/models/product.rb', line 596

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

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



662
663
664
665
666
667
668
669
670
671
672
673
674
# File 'lib/tripletex_ruby_client/models/product.rb', line 662

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



575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
# File 'lib/tripletex_ruby_client/models/product.rb', line 575

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

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


562
563
564
# File 'lib/tripletex_ruby_client/models/product.rb', line 562

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



568
569
570
# File 'lib/tripletex_ruby_client/models/product.rb', line 568

def hash
  [id, version, changes, url, name, number, description, ean, el_number, nrf_number, cost_excluding_vat_currency, expenses, expenses_in_percent, cost_price, profit, profit_in_percent, price_excluding_vat_currency, price_including_vat_currency, is_inactive, discount_group, product_unit, is_stock_item, stock_of_goods, vat_type, currency, department, , discount_price, supplier, resale_product, is_deletable, has_supplier_product_connected, weight, weight_unit, volume, volume_unit, hsn_code, image, markup_list_percentage, markup_net_percentage].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
# File 'lib/tripletex_ruby_client/models/product.rb', line 388

def list_invalid_properties
  invalid_properties = Array.new
  if !@name.nil? && @name.to_s.length > 255
    invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 255.')
  end

  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 !@ean.nil? && @ean.to_s.length > 14
    invalid_properties.push('invalid value for "ean", the character length must be smaller than or equal to 14.')
  end

  if !@el_number.nil? && @el_number.to_s.length > 14
    invalid_properties.push('invalid value for "el_number", the character length must be smaller than or equal to 14.')
  end

  if !@nrf_number.nil? && @nrf_number.to_s.length > 14
    invalid_properties.push('invalid value for "nrf_number", the character length must be smaller than or equal to 14.')
  end

  if !@hsn_code.nil? && @hsn_code.to_s.length > 20
    invalid_properties.push('invalid value for "hsn_code", the character length must be smaller than or equal to 20.')
  end

  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



642
643
644
# File 'lib/tripletex_ruby_client/models/product.rb', line 642

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



648
649
650
651
652
653
654
655
656
# File 'lib/tripletex_ruby_client/models/product.rb', line 648

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_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



636
637
638
# File 'lib/tripletex_ruby_client/models/product.rb', line 636

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



419
420
421
422
423
424
425
426
427
428
429
430
431
# File 'lib/tripletex_ruby_client/models/product.rb', line 419

def valid?
  return false if !@name.nil? && @name.to_s.length > 255
  return false if !@number.nil? && @number.to_s.length > 100
  return false if !@ean.nil? && @ean.to_s.length > 14
  return false if !@el_number.nil? && @el_number.to_s.length > 14
  return false if !@nrf_number.nil? && @nrf_number.to_s.length > 14
  weight_unit_validator = EnumAttributeValidator.new('String', ['kg', 'g', 'hg'])
  return false unless weight_unit_validator.valid?(@weight_unit)
  volume_unit_validator = EnumAttributeValidator.new('String', ['cm3', 'dm3', 'm3'])
  return false unless volume_unit_validator.valid?(@volume_unit)
  return false if !@hsn_code.nil? && @hsn_code.to_s.length > 20
  true
end