Class: WebmaniabrNfeRuby::Models::Product

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Product

Returns a new instance of Product.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/models/product.rb', line 7

def initialize(options = {})
  @name       = options[:name]
  @sku        = options[:sku]
  @ean        = options[:ean]
  @ncm        = options[:ncm]
  @cest       = options[:cest]
  @cnpj_maker = options[:cnpj_maker]
  @quantity   = options[:quantity]
  @unit       = options[:unit]
  @weight     = options[:weight]
  @origin     = options[:origin]
  @subtotal   = options[:subtotal]
  @total      = options[:total]
  @tax_class  = options[:tax_class]
end

Instance Attribute Details

#cestObject

Returns the value of attribute cest.



4
5
6
# File 'lib/models/product.rb', line 4

def cest
  @cest
end

#cnpj_productObject

Returns the value of attribute cnpj_product.



4
5
6
# File 'lib/models/product.rb', line 4

def cnpj_product
  @cnpj_product
end

#eanObject

Returns the value of attribute ean.



4
5
6
# File 'lib/models/product.rb', line 4

def ean
  @ean
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/models/product.rb', line 4

def name
  @name
end

#ncmObject

Returns the value of attribute ncm.



4
5
6
# File 'lib/models/product.rb', line 4

def ncm
  @ncm
end

#originObject

Returns the value of attribute origin.



4
5
6
# File 'lib/models/product.rb', line 4

def origin
  @origin
end

#quantityObject

Returns the value of attribute quantity.



4
5
6
# File 'lib/models/product.rb', line 4

def quantity
  @quantity
end

#skuObject

Returns the value of attribute sku.



4
5
6
# File 'lib/models/product.rb', line 4

def sku
  @sku
end

#subtotalObject

Returns the value of attribute subtotal.



4
5
6
# File 'lib/models/product.rb', line 4

def subtotal
  @subtotal
end

#tax_classObject

Returns the value of attribute tax_class.



4
5
6
# File 'lib/models/product.rb', line 4

def tax_class
  @tax_class
end

#totalObject

Returns the value of attribute total.



4
5
6
# File 'lib/models/product.rb', line 4

def total
  @total
end

#unitObject

Returns the value of attribute unit.



4
5
6
# File 'lib/models/product.rb', line 4

def unit
  @unit
end

#weightObject

Returns the value of attribute weight.



4
5
6
# File 'lib/models/product.rb', line 4

def weight
  @weight
end

Instance Method Details

#to_hashObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/models/product.rb', line 23

def to_hash
  {
    nome: @name,
    sku: @sku,
    ncm: @ncm,
    cest: @cest,
    cnpj_produtor: @cnpj_produtor,
    quantidade: @quantity,
    unidade: @unit,
    peso: @weight,
    origem: @origin,
    subtotal: @subtotal,
    total: @total,
    classe_imposto: @tax_class
  }
end