Class: GreenButtonClasses::MeterReading

Inherits:
GreenButtonEntry show all
Defined in:
lib/greenbutton/gb_classes.rb

Instance Attribute Summary collapse

Attributes inherited from GreenButtonEntry

#href, #id, #other_related, #parent_href, #published, #related_hrefs, #title, #updated

Instance Method Summary collapse

Methods inherited from GreenButtonEntry

#additional_rules, #assign_rules, #doc, #find_by_href, #find_related_entries, #initialize, #parse_related_entry

Constructor Details

This class inherits a constructor from GreenButtonClasses::GreenButtonEntry

Instance Attribute Details

#interval_blocksObject

Returns the value of attribute interval_blocks.



170
171
172
# File 'lib/greenbutton/gb_classes.rb', line 170

def interval_blocks
  @interval_blocks
end

#reading_typeObject

Returns the value of attribute reading_type.



170
171
172
# File 'lib/greenbutton/gb_classes.rb', line 170

def reading_type
  @reading_type
end

#usage_pointObject

Returns the value of attribute usage_point.



170
171
172
# File 'lib/greenbutton/gb_classes.rb', line 170

def usage_point
  @usage_point
end

Instance Method Details



177
178
179
180
181
182
183
184
185
186
# File 'lib/greenbutton/gb_classes.rb', line 177

def add_related(type, parser)
  case type
  when 'reading_type'
    self.reading_type = parser
  when 'interval_block'
    self.interval_blocks << parser
  else
    raise 'Not a recognized relation for MeterReading'
  end
end

#pre_rule_assignment(parent) ⇒ Object



172
173
174
175
# File 'lib/greenbutton/gb_classes.rb', line 172

def pre_rule_assignment(parent)
  self.usage_point = parent
  self.interval_blocks = []
end