Sha256: 7ec0a3fe9da7d1a7ed3f651e27c0bbbbe07e2e81b9ff098b54a50d805f4ef962

Contents?: true

Size: 882 Bytes

Versions: 3

Compression:

Stored size: 882 Bytes

Contents

require "amee/data_api/data_item_value"
require "amee/data_api/item_definition"
module Amee
  module DataApi
    class DataItem
      require "amee/data_api/data_category"
      include Amee::Model
      self.path_prefix  = "/data"

          
      attr_accessor :start_date, :end_date, :label, :choices, :kg_c_o2_per_k_wh, :source
      list_populators :item_values => {:class => Amee::DataApi::DataItemValue}      
      item_populators :data_category => {:class => Amee::DataApi::DataCategory},
                        :item_definition => {:class => Amee::DataApi::ItemDefinition}
        
      def populate!
        session.api_call(:get, "data.item", self.full_path) do |response|
          populate_from_hash!(response)
          self
        end
        @lazy_loaded = true
      end
      
      def kg_co2_per_kwh
        kg_c_o2_per_k_wh
      end
    
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hookercookerman-amee-0.1.1 lib/amee/data_api/data_item.rb
hookercookerman-amee-0.1.2 lib/amee/data_api/data_item.rb
hookercookerman-amee-0.1.3 lib/amee/data_api/data_item.rb