Class: GreenButtonData::Entry
- Inherits:
-
Object
- Object
- GreenButtonData::Entry
- Defined in:
- lib/green-button-data/entry.rb
Direct Known Subclasses
ApplicationInformation, Authorization, IntervalBlock, LocalTimeParameters, MeterReading, ReadingType, RetailCustomer, UsagePoint, UsageSummary
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#token ⇒ Object
Returns the value of attribute token.
-
#usage_point_id ⇒ Object
readonly
Returns the value of attribute usage_point_id.
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Entry
constructor
A new instance of Entry.
Methods included from Utilities
#attributes_to_hash, #class_from_name, #epoch_to_time, #first_sunday_of, #last_weekday_of, #normalize_epoch, #nth_weekday_of, #parse_datetime, #weekday_offset
Methods included from Fetchable
Constructor Details
#initialize(attributes) ⇒ Entry
Returns a new instance of Entry.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/green-button-data/entry.rb', line 9 def initialize(attributes) # Automagically sets instance variables from attribute hash parsed from # the GreenButtonData::Parser classes init_instance_vars attributes # Handle relations via related_urls @related_urls.is_a?(Hash) and @related_urls.each do |key, value| self.instance_variable_set :"@#{key}_url", value singleton_class.class_eval do attr_accessor "#{key}_url".to_sym end # Define accessor methods from pluralized resource names define_attr_accessors key end end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/green-button-data/entry.rb', line 6 def id @id end |
#token ⇒ Object
Returns the value of attribute token.
7 8 9 |
# File 'lib/green-button-data/entry.rb', line 7 def token @token end |
#usage_point_id ⇒ Object (readonly)
Returns the value of attribute usage_point_id.
6 7 8 |
# File 'lib/green-button-data/entry.rb', line 6 def usage_point_id @usage_point_id end |