Class: Mityc::Geoportal::Fuel

Inherits:
Object
  • Object
show all
Includes:
HTTParty, HappyMapper
Defined in:
lib/mityc-geoportal/fuel.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.allObject



22
23
24
# File 'lib/mityc-geoportal/fuel.rb', line 22

def all
  @fuels ||= self.parse(fuels_xml)
end

.by_id(fuel_id) ⇒ Object



26
27
28
# File 'lib/mityc-geoportal/fuel.rb', line 26

def by_id(fuel_id)
  self.all.find { |fuel| fuel.id = fuel_id}
end

Instance Method Details

#measuresObject



11
12
13
# File 'lib/mityc-geoportal/fuel.rb', line 11

def measures
  @measures ||= Mityc::Geoportal::Measure.by_fuel(self.id)
end

#measures_by(field_name) ⇒ Object



15
16
17
18
19
# File 'lib/mityc-geoportal/fuel.rb', line 15

def measures_by(field_name)
  self.measures.by_attribute(field_name) { |field_value, measure_group|
    yield field_value, measure_group
  }
end