lib/amee/data_api/data_item.rb in hookercookerman-amee-0.1.4 vs lib/amee/data_api/data_item.rb in hookercookerman-amee-0.1.5

- old
+ new

@@ -6,14 +6,22 @@ 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, :amount_per_month + attr_accessor :start_date, :end_date, :label, :choices, :kg_c_o2_per_k_wh, :source, :amount_per_month, :amount list_populators :item_values => {:class => Amee::DataApi::DataItemValue} item_populators :data_category => {:class => Amee::DataApi::DataCategory}, :item_definition => {:class => Amee::DataApi::ItemDefinition} - + + def co2_unit + amount["unit"] if amount + end + + def co2_value + amount["value"] if amount + end + def populate! session.api_call(:get, "data.item", self.full_path) do |response| populate_from_hash!(response) self end \ No newline at end of file