Class: EfoNelfo::V40::VL

Inherits:
PostType show all
Defined in:
lib/efo_nelfo/v40/vl.rb

Instance Method Summary collapse

Methods inherited from PostType

for, from, #initialize, parse, #post_type, post_type, #to_csv, version, #version, version_from_class, version_to_namespace

Methods included from HasMany

#add, #associations, #find_association, #has_association?, included, #to_a

Methods included from Properties

#has_property?, included, #initialize_attributes, #properties, #to_a

Constructor Details

This class inherits a constructor from EfoNelfo::PostType

Instance Method Details

#gross_priceObject



36
37
38
# File 'lib/efo_nelfo/v40/vl.rb', line 36

def gross_price
  gross_price? ? properties[:price].to_f : nil
end

#gross_price?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/efo_nelfo/v40/vl.rb', line 32

def gross_price?
  price_type.nil? || price_type == 'B'
end

#imagesObject



48
49
50
# File 'lib/efo_nelfo/v40/vl.rb', line 48

def images
  info.map(&:image).compact
end

#net_priceObject



40
41
42
# File 'lib/efo_nelfo/v40/vl.rb', line 40

def net_price
  net_price? ? properties[:price].to_f : nil
end

#net_price?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/efo_nelfo/v40/vl.rb', line 44

def net_price?
  price_type == 'N'
end

#nrf_idObject



28
29
30
# File 'lib/efo_nelfo/v40/vl.rb', line 28

def nrf_id
  product_type == 4 ? product_number : nil
end

#urlsObject

Returns array of urls extracted from VX lines



59
60
61
# File 'lib/efo_nelfo/v40/vl.rb', line 59

def urls
  info.map(&:value).select { |u| u.match %r{\Ahttps?://} }
end