Class: Nfe::Reader::Cane

Inherits:
Object
  • Object
show all
Includes:
AttributeHelper, CreatorHelper
Defined in:
lib/nfe_reader/product/cane.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from CreatorHelper

#create_resource, #create_resources, #to_array

Methods included from AttributeHelper

#attributes, #attributes_to_hash

Constructor Details

#initialize(attrs = {}) ⇒ Cane

Returns a new instance of Cane.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/nfe_reader/product/cane.rb', line 10

def initialize(attrs = {})
  @harvest = attrs[:safra]
  @month = attrs[:ref]
  @month_amount = attrs[:qTotMes]
  @previous_amount = attrs[:qTotAnt]
  @amount = attrs[:qTotGer]
  @value = attrs[:vFor]
  @deduction_value = attrs[:vTotDed]
  @net_value = attrs[:vLiqFor]

  @days = []
  
  if attrs[:forDia]
    @days = to_array(attrs[:forDia])
  end

  if attrs[:deduc]
    @deductions = to_array(attrs[:deduc])
  end
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



7
8
9
# File 'lib/nfe_reader/product/cane.rb', line 7

def amount
  @amount
end

#daysObject (readonly)

Returns the value of attribute days.



7
8
9
# File 'lib/nfe_reader/product/cane.rb', line 7

def days
  @days
end

#deduction_valueObject (readonly)

Returns the value of attribute deduction_value.



7
8
9
# File 'lib/nfe_reader/product/cane.rb', line 7

def deduction_value
  @deduction_value
end

#deductionsObject (readonly)

Returns the value of attribute deductions.



7
8
9
# File 'lib/nfe_reader/product/cane.rb', line 7

def deductions
  @deductions
end

#harvestObject (readonly)

Returns the value of attribute harvest.



7
8
9
# File 'lib/nfe_reader/product/cane.rb', line 7

def harvest
  @harvest
end

#monthObject (readonly)

Returns the value of attribute month.



7
8
9
# File 'lib/nfe_reader/product/cane.rb', line 7

def month
  @month
end

#month_amountObject (readonly)

Returns the value of attribute month_amount.



7
8
9
# File 'lib/nfe_reader/product/cane.rb', line 7

def month_amount
  @month_amount
end

#net_valueObject (readonly)

Returns the value of attribute net_value.



7
8
9
# File 'lib/nfe_reader/product/cane.rb', line 7

def net_value
  @net_value
end

#previous_amountObject (readonly)

Returns the value of attribute previous_amount.



7
8
9
# File 'lib/nfe_reader/product/cane.rb', line 7

def previous_amount
  @previous_amount
end

#valueObject (readonly)

Returns the value of attribute value.



7
8
9
# File 'lib/nfe_reader/product/cane.rb', line 7

def value
  @value
end