Class: MoloniApi::Models::Product

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

Overview

Model to map product

Instance Method Summary collapse

Constructor Details

#initialize(raw_result) ⇒ Product

company_id int Mandatory

category_id int Mandatory

type int Mandatory

name string Mandatory

summary string Facultativo

reference string Mandatory

ean string Facultativo

price float Mandatory

unit_id int Mandatory

has_stock int Mandatory

stock float Mandatory

minimum_stock float Facultativo

pos_favorite int Facultativo

at_product_category string Facultativo

exemption_reason string Facultativo

taxes array Facultativo

tax_id int Mandatory

value float Mandatory

order int Mandatory

cumulative int Mandatory

suppliers array Facultativo

supplier_id int Mandatory

cost_price float Mandatory

referenceint Facultativo

properties array Facultativo

property_id int Mandatory

value string Mandatory

warehouses array Facultativo

warehouse_id int Mandatory

stock float Mandatory



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/moloni_api/models/product.rb', line 97

def initialize(raw_result)
  @raw_result = raw_result

  @company_id = raw_result[:company_id]
  @product_id = raw_result[:product_id]
  @category = raw_result[:category]
  @type = raw_result[:type]
  @name = raw_result[:name]
  @summary = raw_result[:summary]
  @reference = raw_result[:reference]
  @ean = raw_result[:ean]
  @price = raw_result[:price]
  @unit_id = raw_result[:unit_id]
  @has_stock = raw_result[:has_stock]
  @stock = raw_result[:stock]
  @minimum_stock = raw_result[:minimum_stock]
  @pos_favorite = raw_result[:pos_favorite]
  @at_product_category = raw_result[:at_product_category]
  @exemption_reason = raw_result[:exemption_reason]
  @taxes = raw_result[:taxes] # array
  @suppliers = raw_result[:suppliers] # array
  @properties = raw_result[:properties] # array
  @warehouses = raw_result[:warehouses] # array
end