hookercookerman-amee 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/amee.gemspec +1 -1
- data/lib/amee.rb +1 -1
- data/lib/amee/data_api/data_item.rb +10 -2
- data/lib/amee/parser.rb +1 -0
- metadata +1 -1
data/amee.gemspec
CHANGED
data/lib/amee.rb
CHANGED
@@ -8,11 +8,19 @@ module Amee
|
|
8
8
|
self.path_prefix = "/data"
|
9
9
|
|
10
10
|
|
11
|
-
attr_accessor :start_date, :end_date, :label, :choices, :kg_c_o2_per_k_wh, :source, :amount_per_month
|
11
|
+
attr_accessor :start_date, :end_date, :label, :choices, :kg_c_o2_per_k_wh, :source, :amount_per_month, :amount
|
12
12
|
list_populators :item_values => {:class => Amee::DataApi::DataItemValue}
|
13
13
|
item_populators :data_category => {:class => Amee::DataApi::DataCategory},
|
14
14
|
:item_definition => {:class => Amee::DataApi::ItemDefinition}
|
15
|
-
|
15
|
+
|
16
|
+
def co2_unit
|
17
|
+
amount["unit"] if amount
|
18
|
+
end
|
19
|
+
|
20
|
+
def co2_value
|
21
|
+
amount["value"] if amount
|
22
|
+
end
|
23
|
+
|
16
24
|
def populate!
|
17
25
|
session.api_call(:get, "data.item", self.full_path) do |response|
|
18
26
|
populate_from_hash!(response)
|
data/lib/amee/parser.rb
CHANGED
@@ -29,6 +29,7 @@ module Amee
|
|
29
29
|
item_values = {"item_values" => data["dataItem"].delete("itemValues")}
|
30
30
|
data_item.merge(item_values).
|
31
31
|
merge({"choices" => data["userValueChoices"]["choices"]}).
|
32
|
+
merge({"amount" => data["amount"]}).
|
32
33
|
merge({"resource_path" => data["path"]})
|
33
34
|
end
|
34
35
|
end
|