hookercookerman-amee 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +5 -2
- data/README.rdoc +1 -0
- data/amee.gemspec +54 -0
- data/features/data/data_item.feature +6 -6
- data/features/profile/get.profile.feature +1 -0
- data/features/profile/profile_category.feature +4 -4
- data/features/profile/profile_item.feature +9 -7
- data/features/support/amee/data/transport/car/generic/E57D6E2828EB.json +317 -0
- data/features/support/amee/profiles/180D73DA5229/home.json +88 -0
- data/features/support/amee/profiles/E0BCB3704D15.json +18 -19
- data/features/support/amee/profiles/F38ECBD56D59/home/energy/quantity/5891C88F29FA.json +326 -0
- data/lib/amee/data_api/data_item.rb +1 -1
- data/lib/amee/parser.rb +4 -8
- data/lib/amee/profile_api/profile.rb +4 -4
- data/lib/amee/profile_api/profile_category.rb +1 -1
- data/lib/amee/profile_api/profile_item.rb +2 -2
- data/lib/amee/session.rb +1 -0
- data/lib/amee.rb +4 -1
- metadata +5 -2
- data/features/support/amee/profiles/BB1BDB4FDD77/home/energy/quantity/920B54ED665B.json +0 -201
data/Manifest.txt
CHANGED
@@ -3,6 +3,7 @@ LICENSE.txt
|
|
3
3
|
Manifest.txt
|
4
4
|
README.rdoc
|
5
5
|
Rakefile
|
6
|
+
amee.gemspec
|
6
7
|
features/config.feature
|
7
8
|
features/data/data_category.feature
|
8
9
|
features/data/data_item.feature
|
@@ -29,6 +30,7 @@ features/step_definitions/profile_steps.rb
|
|
29
30
|
features/support/amee/auth/response.json
|
30
31
|
features/support/amee/data.json
|
31
32
|
features/support/amee/data/transport/car/generic.json
|
33
|
+
features/support/amee/data/transport/car/generic/E57D6E2828EB.json
|
32
34
|
features/support/amee/data/transport/car/generic/drill.json
|
33
35
|
features/support/amee/data/transport/car/generic/drill?fuel=diesel&size=large.json
|
34
36
|
features/support/amee/data/transport/car/generic/drill?fuel=diesel.json
|
@@ -40,11 +42,12 @@ features/support/amee/data_category_with_data_items.json
|
|
40
42
|
features/support/amee/profiles.json
|
41
43
|
features/support/amee/profiles/155DD3C63646/transport/motorcycle/generic/D47C465B8157.json
|
42
44
|
features/support/amee/profiles/155DD3C63646/transport/motorcycle/generic/D47C465B8157?distance=400&representation=true.json
|
45
|
+
features/support/amee/profiles/180D73DA5229/home.json
|
43
46
|
features/support/amee/profiles/48B97680BCCF/home/energy/quantity/response.json
|
44
47
|
features/support/amee/profiles/7C7D68C2A7CD/home.json
|
45
|
-
features/support/amee/profiles/BB1BDB4FDD77/home/energy/quantity/920B54ED665B.json
|
46
48
|
features/support/amee/profiles/E0BCB3704D15.json
|
47
49
|
features/support/amee/profiles/E0BCB3704D15/Business.json
|
50
|
+
features/support/amee/profiles/F38ECBD56D59/home/energy/quantity/5891C88F29FA.json
|
48
51
|
features/support/amee/profiles/profile.json
|
49
52
|
features/support/env.rb
|
50
53
|
init.rb
|
@@ -76,4 +79,4 @@ spec/session_spec.rb
|
|
76
79
|
spec/spec.opts
|
77
80
|
spec/spec_helper.rb
|
78
81
|
tasks/rspec.rake
|
79
|
-
tasks/yard.rake
|
82
|
+
tasks/yard.rake
|
data/README.rdoc
CHANGED
@@ -7,6 +7,7 @@ Amee is a Ruby wrapper over the "AMEE carbon calculator"[http://www.amee.com]
|
|
7
7
|
* Idiomatic Ruby
|
8
8
|
* Concrete classes and methods modeling Amee data, so it's easy for a Rubyist to understand what's available
|
9
9
|
* Cucumber Features and specs
|
10
|
+
* AMEE API 2.0 Support
|
10
11
|
|
11
12
|
== DOCUMENTATION
|
12
13
|
|
data/amee.gemspec
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{amee}
|
5
|
+
s.version = '0.1.4'
|
6
|
+
|
7
|
+
s.homepage = 'http://github.com/hookercookerman/amee/tree/master'
|
8
|
+
s.description = %q{Its a gem to interact with the amee api}
|
9
|
+
s.summary = %q{Amee}
|
10
|
+
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.authors = ["Richard Hooker"]
|
13
|
+
s.date = %q{2009-04-24}
|
14
|
+
|
15
|
+
s.email = ["richard.hooker@dynamic50.com"]
|
16
|
+
s.extra_rdoc_files = ["History.txt", "LICENSE.txt", "Manifest.txt", "README.rdoc"]
|
17
|
+
s.files = ["History.txt", "LICENSE.txt", "Manifest.txt", "README.rdoc", "Rakefile", "amee.gemspec", "features/config.feature", "features/data/data_category.feature", "features/data/data_item.feature", "features/data/data_item_value.feature", "features/data/drill_down.feature", "features/development.feature", "features/profile/create.profile.feature", "features/profile/create.profile_item.feature", "features/profile/delete.profile.feature", "features/profile/delete.profile_item.feature", "features/profile/get.profile.feature", "features/profile/profile_category.feature", "features/profile/profile_item.feature", "features/profile/profiles.feature", "features/profile/update.profile_item.feature", "features/session/reauthenticate.feature", "features/step_definitions/amee_steps.rb", "features/step_definitions/common_steps.rb", "features/step_definitions/config_steps.rb", "features/step_definitions/data_steps.rb", "features/step_definitions/profile_category_steps.rb", "features/step_definitions/profile_item_steps.rb", "features/step_definitions/profile_steps.rb", "features/support/amee/auth/response.json", "features/support/amee/data.json", "features/support/amee/data/transport/car/generic.json", "features/support/amee/data/transport/car/generic/E57D6E2828EB.json", "features/support/amee/data/transport/car/generic/drill.json", "features/support/amee/data/transport/car/generic/drill?fuel=diesel&size=large.json", "features/support/amee/data/transport/car/generic/drill?fuel=diesel.json", "features/support/amee/data/transport/plane/generic.json", "features/support/amee/data/transport/plane/generic/FFC7A05D54AD.json", "features/support/amee/data/transport/plane/generic/FFC7A05D54AD/kgCO2PerPassengerJourney.json", "features/support/amee/data_category.json", "features/support/amee/data_category_with_data_items.json", "features/support/amee/profiles.json", "features/support/amee/profiles/155DD3C63646/transport/motorcycle/generic/D47C465B8157.json", "features/support/amee/profiles/155DD3C63646/transport/motorcycle/generic/D47C465B8157?distance=400&representation=true.json", "features/support/amee/profiles/180D73DA5229/home.json", "features/support/amee/profiles/48B97680BCCF/home/energy/quantity/response.json", "features/support/amee/profiles/7C7D68C2A7CD/home.json", "features/support/amee/profiles/E0BCB3704D15.json", "features/support/amee/profiles/E0BCB3704D15/Business.json", "features/support/amee/profiles/F38ECBD56D59/home/energy/quantity/5891C88F29FA.json", "features/support/amee/profiles/profile.json", "features/support/env.rb", "init.rb", "lib/amee.rb", "lib/amee/config.rb", "lib/amee/data_api/data_category.rb", "lib/amee/data_api/data_item.rb", "lib/amee/data_api/data_item_value.rb", "lib/amee/data_api/drill_down.rb", "lib/amee/data_api/item_definition.rb", "lib/amee/data_api/item_value_definition.rb", "lib/amee/data_api/value_definition.rb", "lib/amee/logging.rb", "lib/amee/model.rb", "lib/amee/parser.rb", "lib/amee/profile_api/profile.rb", "lib/amee/profile_api/profile_category.rb", "lib/amee/profile_api/profile_item.rb", "lib/amee/service.rb", "lib/amee/session.rb", "lib/amee/utils/string.rb", "script/console", "script/destroy", "script/generate", "script/txt2html", "spec/amee_spec.rb", "spec/service_spec.rb", "spec/session_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/rspec.rake", "tasks/yard.rake"]
|
18
|
+
s.has_rdoc = true
|
19
|
+
s.rdoc_options = ['--main', 'README.rdoc']
|
20
|
+
s.rdoc_options << '--inline-source' << '--charset=UTF-8'
|
21
|
+
|
22
|
+
s.require_paths = ["lib"]
|
23
|
+
s.rubyforge_project = %q{amee}
|
24
|
+
s.rubygems_version = %q{1.3.2}
|
25
|
+
|
26
|
+
|
27
|
+
if s.respond_to? :specification_version then
|
28
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
29
|
+
s.specification_version = 3
|
30
|
+
|
31
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
32
|
+
s.add_development_dependency(%q<newgem>, [">= 1.3.0"])
|
33
|
+
s.add_development_dependency(%q<hoe>, [">= 1.8.0"])
|
34
|
+
s.add_development_dependency(%q<fakeweb>, [">= 0"])
|
35
|
+
s.add_runtime_dependency(%q<httparty>, ["= 0.4.3"])
|
36
|
+
s.add_runtime_dependency(%q<wycats-moneta>, [">= 0"])
|
37
|
+
s.add_runtime_dependency(%q<mislav-will_paginate>, [">= 2.2.3"])
|
38
|
+
else
|
39
|
+
s.add_dependency(%q<fakeweb>, [">= 0"])
|
40
|
+
s.add_dependency(%q<newgem>, [">= 1.3.0"])
|
41
|
+
s.add_dependency(%q<hoe>, [">= 1.8.0"])
|
42
|
+
s.add_dependency(%q<httparty>, ["= 0.4.3"])
|
43
|
+
s.add_dependency(%q<wycats-moneta>, [">= 0"])
|
44
|
+
s.add_dependency(%q<mislav-will_paginate>, [">= 2.2.3"])
|
45
|
+
end
|
46
|
+
else
|
47
|
+
s.add_dependency(%q<mislav-will_paginate>, [">= 2.2.3"])
|
48
|
+
s.add_dependency(%q<fakeweb>, [">= 0"])
|
49
|
+
s.add_dependency(%q<httparty>, ["= 0.4.3"])
|
50
|
+
s.add_dependency(%q<wycats-moneta>, [">= 0"])
|
51
|
+
s.add_dependency(%q<newgem>, [">= 1.3.0"])
|
52
|
+
s.add_dependency(%q<hoe>, [">= 1.8.0"])
|
53
|
+
end
|
54
|
+
end
|
@@ -5,15 +5,15 @@ Feature: Get Amee DataItem
|
|
5
5
|
I want to be able to get amee data items
|
6
6
|
|
7
7
|
|
8
|
-
Scenario: Get Amee Date Item with path /data/transport/
|
8
|
+
Scenario: Get Amee Date Item with path /data/transport/car/generic/E57D6E2828EB
|
9
9
|
Given I have a valid amee session
|
10
|
-
When I ask the session for: get_data_item with path: "/data/transport/
|
10
|
+
When I ask the session for: get_data_item with path: "/data/transport/car/generic/E57D6E2828EB"
|
11
11
|
|
12
12
|
Then the data item should have: "path" with: ""
|
13
|
-
And the data item should have: "name" with: "
|
14
|
-
And the data item should have: "uid" with: "
|
13
|
+
And the data item should have: "name" with: "E57D6E2828EB"
|
14
|
+
And the data item should have: "uid" with: "E57D6E2828EB"
|
15
15
|
And the data item's item_values should not be nil
|
16
16
|
And the data item's choices should not be nil
|
17
17
|
|
18
|
-
And the data item's item_definition: drill_down should be "
|
19
|
-
And the data item's item_definition: name should be "
|
18
|
+
And the data item's item_definition: drill_down should be "fuel, size"
|
19
|
+
And the data item's item_definition: name should be "Car Generic"
|
@@ -10,4 +10,5 @@ Feature: Get Amee Profiles
|
|
10
10
|
Then the amee profile should have: "uid" with: "E0BCB3704D15"
|
11
11
|
And the amee profile should have: "name" with: "E0BCB3704D15"
|
12
12
|
And the amee profile should have: "path" with: "E0BCB3704D15"
|
13
|
+
And the amee profile should have: "total_amount" with: "10"
|
13
14
|
And the amee profile profile_categories should not be empty
|
@@ -3,12 +3,12 @@ Feature: Get Amee Profile Category
|
|
3
3
|
As a amee developer
|
4
4
|
I want to be able to get profile data categories
|
5
5
|
|
6
|
-
Scenario: Get Amee profile category with path /profiles/
|
6
|
+
Scenario: Get Amee profile category with path /profiles/180D73DA5229/Home
|
7
7
|
Given I have a valid amee session
|
8
|
-
When I ask the session for: get_profile_category with path: "/profiles/
|
8
|
+
When I ask the session for: get_profile_category with path: "/profiles/180D73DA5229/home"
|
9
9
|
|
10
|
-
Then the profile category should have: "
|
11
|
-
And the profile category should have: "resource_path" with: "/
|
10
|
+
Then the profile category should have: "total_amount" with: "0"
|
11
|
+
And the profile category should have: "resource_path" with: "/home"
|
12
12
|
And the profile category's profile_items should be empty
|
13
13
|
And the profile category's profile_categories should not be empty
|
14
14
|
And the profile category's data_category should not be nil
|
@@ -4,12 +4,14 @@ Feature: Getting Amee Profile Item
|
|
4
4
|
As a amee developer
|
5
5
|
I want to be able to get profile items
|
6
6
|
|
7
|
-
Scenario: Get Amee profile item with path /profiles/
|
7
|
+
Scenario: Get Amee profile item with path /profiles/F38ECBD56D59/home/energy/quantity/5891C88F29FA
|
8
8
|
Given I have a valid amee session
|
9
|
-
When I ask the session for: get_profile_item with path: "/profiles/
|
9
|
+
When I ask the session for: get_profile_item with path: "/profiles/F38ECBD56D59/home/energy/quantity/5891C88F29FA"
|
10
10
|
|
11
|
-
Then the profile item should have: "
|
12
|
-
And the profile item should have: "
|
13
|
-
And the profile item should have: "
|
14
|
-
And the profile item should have: "
|
15
|
-
And the profile item
|
11
|
+
Then the profile item should have: "co2_value" with: "24.66"
|
12
|
+
And the profile item should have: "co2_unit" with: "kg/year"
|
13
|
+
And the profile item should have: "resource_path" with: "/home/energy/quantity/5891C88F29FA"
|
14
|
+
And the profile item should have: "start_date" with: "Thu Mar 19 16:51:00 UTC 2009"
|
15
|
+
And the profile item should have: "end_date" with: ""
|
16
|
+
And the profile item's item_values should not be nil
|
17
|
+
And the profile item's item_definition should not be nil
|
@@ -0,0 +1,317 @@
|
|
1
|
+
|
2
|
+
{
|
3
|
+
"apiVersion":"2.0",
|
4
|
+
"path":"/transport/car/generic/E57D6E2828EB",
|
5
|
+
|
6
|
+
"userValueChoices":
|
7
|
+
|
8
|
+
{
|
9
|
+
"choices":
|
10
|
+
[
|
11
|
+
{
|
12
|
+
"name":"airconFull",
|
13
|
+
"value":"false"
|
14
|
+
},
|
15
|
+
|
16
|
+
|
17
|
+
{
|
18
|
+
"name":"tyresUnderinflated",
|
19
|
+
"value":"false"
|
20
|
+
},
|
21
|
+
|
22
|
+
|
23
|
+
{
|
24
|
+
"name":"country",
|
25
|
+
"value":""
|
26
|
+
},
|
27
|
+
|
28
|
+
|
29
|
+
{
|
30
|
+
"name":"regularlyServiced",
|
31
|
+
"value":"true"
|
32
|
+
},
|
33
|
+
|
34
|
+
|
35
|
+
{
|
36
|
+
"name":"useTypicalDistance",
|
37
|
+
"value":"false"
|
38
|
+
},
|
39
|
+
|
40
|
+
|
41
|
+
{
|
42
|
+
"name":"ownFuelConsumption",
|
43
|
+
"value":"0"
|
44
|
+
},
|
45
|
+
|
46
|
+
|
47
|
+
{
|
48
|
+
"name":"occupants",
|
49
|
+
"value":"-1"
|
50
|
+
},
|
51
|
+
|
52
|
+
|
53
|
+
{
|
54
|
+
"name":"distance",
|
55
|
+
"value":""
|
56
|
+
},
|
57
|
+
|
58
|
+
|
59
|
+
{
|
60
|
+
"name":"ecoDriving",
|
61
|
+
"value":"false"
|
62
|
+
},
|
63
|
+
|
64
|
+
|
65
|
+
{
|
66
|
+
"name":"airconTypical",
|
67
|
+
"value":"true"
|
68
|
+
},
|
69
|
+
|
70
|
+
|
71
|
+
{
|
72
|
+
"name":"fuelConsumption",
|
73
|
+
"value":"0"
|
74
|
+
}
|
75
|
+
],
|
76
|
+
|
77
|
+
"name":"userValueChoices"
|
78
|
+
},
|
79
|
+
|
80
|
+
"dataItem":
|
81
|
+
{
|
82
|
+
"uid":"E57D6E2828EB",
|
83
|
+
"startDate":"2009-04-25T11:19:00+01:00",
|
84
|
+
|
85
|
+
"dataCategory":
|
86
|
+
{
|
87
|
+
"uid":"87E55DA88017",
|
88
|
+
"name":"Generic",
|
89
|
+
"path":"generic"
|
90
|
+
},
|
91
|
+
|
92
|
+
"itemValues":
|
93
|
+
|
94
|
+
[
|
95
|
+
{
|
96
|
+
"itemValueDefinition":
|
97
|
+
|
98
|
+
{
|
99
|
+
"uid":"42ACBD690E88",
|
100
|
+
"name":"Fuel",
|
101
|
+
"path":"fuel",
|
102
|
+
"valueDefinition":
|
103
|
+
|
104
|
+
{
|
105
|
+
"uid":"CCEB59CACE1B",
|
106
|
+
"environment":
|
107
|
+
{
|
108
|
+
"uid":"5F5887BCF726"
|
109
|
+
},
|
110
|
+
"created":"2007-07-27 09:30:44.0",
|
111
|
+
"description":"",
|
112
|
+
"name":"text",
|
113
|
+
"valueType":"TEXT",
|
114
|
+
"modified":"2007-07-27 09:30:44.0"
|
115
|
+
}
|
116
|
+
},
|
117
|
+
"perUnit":"",
|
118
|
+
"uid":"DBA7380574E2",
|
119
|
+
"startDate":"2009-03-17T18:37:16Z",
|
120
|
+
"unit":"",
|
121
|
+
"name":"Fuel",
|
122
|
+
"value":"average",
|
123
|
+
"path":"fuel",
|
124
|
+
"displayPath":"fuel",
|
125
|
+
"displayName":"Fuel"
|
126
|
+
},
|
127
|
+
{
|
128
|
+
"itemValueDefinition":
|
129
|
+
{
|
130
|
+
"uid":"6C4B0FA03C9A",
|
131
|
+
"name":"Source",
|
132
|
+
"path":"source",
|
133
|
+
"valueDefinition":
|
134
|
+
{
|
135
|
+
"uid":"CCEB59CACE1B",
|
136
|
+
"environment":
|
137
|
+
{
|
138
|
+
"uid":"5F5887BCF726"
|
139
|
+
},
|
140
|
+
"created":"2007-07-27 09:30:44.0",
|
141
|
+
"description":"",
|
142
|
+
"name":"text",
|
143
|
+
"valueType":"TEXT",
|
144
|
+
"modified":"2007-07-27 09:30:44.0"
|
145
|
+
}
|
146
|
+
},
|
147
|
+
"perUnit":"",
|
148
|
+
"uid":"D61A0F06129F",
|
149
|
+
"startDate":"2009-03-17T18:37:16Z",
|
150
|
+
"unit":"",
|
151
|
+
"name":"Source",
|
152
|
+
"value":"defra/amee 2008",
|
153
|
+
"path":"source",
|
154
|
+
"displayPath":"source",
|
155
|
+
"displayName":"Source"
|
156
|
+
},
|
157
|
+
{
|
158
|
+
"itemValueDefinition":
|
159
|
+
{
|
160
|
+
"uid":"B6B71F9F4E94",
|
161
|
+
"name":"kgCO2 Per Km",
|
162
|
+
"path":"kgCO2PerKm",
|
163
|
+
"valueDefinition":
|
164
|
+
{
|
165
|
+
"uid":"996AE5477B3F",
|
166
|
+
"environment":
|
167
|
+
{
|
168
|
+
"uid":"5F5887BCF726"
|
169
|
+
},
|
170
|
+
"created":"2007-07-27 09:30:44.0",
|
171
|
+
"description":"",
|
172
|
+
"name":"kgCO2PerKm",
|
173
|
+
"valueType":"DECIMAL",
|
174
|
+
"modified":"2007-07-27 09:30:44.0"
|
175
|
+
}
|
176
|
+
|
177
|
+
|
178
|
+
},
|
179
|
+
|
180
|
+
"perUnit":"",
|
181
|
+
"uid":"17AB08B56256",
|
182
|
+
"startDate":"2009-03-17T18:37:16Z",
|
183
|
+
"unit":"",
|
184
|
+
"name":"kgCO2 Per Km",
|
185
|
+
"value":"0.2042",
|
186
|
+
"path":"kgCO2PerKm",
|
187
|
+
"displayPath":"kgCO2PerKm",
|
188
|
+
"displayName":"kgCO2 Per Km"
|
189
|
+
},
|
190
|
+
{
|
191
|
+
"itemValueDefinition":
|
192
|
+
{
|
193
|
+
"uid":"C6AA71697CCF",
|
194
|
+
"name":"Size",
|
195
|
+
"path":"size",
|
196
|
+
"valueDefinition":
|
197
|
+
{
|
198
|
+
"uid":"CCEB59CACE1B",
|
199
|
+
"environment":
|
200
|
+
{
|
201
|
+
"uid":"5F5887BCF726"
|
202
|
+
},
|
203
|
+
"created":"2007-07-27 09:30:44.0",
|
204
|
+
"description":"",
|
205
|
+
"name":"text",
|
206
|
+
"valueType":"TEXT",
|
207
|
+
"modified":"2007-07-27 09:30:44.0"
|
208
|
+
}
|
209
|
+
},
|
210
|
+
"perUnit":"",
|
211
|
+
"uid":"A2EA5A78A1E5",
|
212
|
+
"startDate":"2009-03-17T18:37:16Z",
|
213
|
+
"unit":"",
|
214
|
+
"name":"Size",
|
215
|
+
"value":"average",
|
216
|
+
"path":"size",
|
217
|
+
"displayPath":"size",
|
218
|
+
"displayName":"Size"
|
219
|
+
},
|
220
|
+
{
|
221
|
+
"itemValueDefinition":
|
222
|
+
{
|
223
|
+
"uid":"3F29C69329AF",
|
224
|
+
"name":"kgCO2 Per Km US",
|
225
|
+
"path":"kgCO2PerKmUS",
|
226
|
+
"valueDefinition":
|
227
|
+
{
|
228
|
+
"uid":"996AE5477B3F",
|
229
|
+
"environment":
|
230
|
+
{
|
231
|
+
"uid":"5F5887BCF726"
|
232
|
+
},
|
233
|
+
"created":"2007-07-27 09:30:44.0",
|
234
|
+
"description":"",
|
235
|
+
"name":"kgCO2PerKm",
|
236
|
+
"valueType":"DECIMAL",
|
237
|
+
"modified":"2007-07-27 09:30:44.0"
|
238
|
+
}
|
239
|
+
},
|
240
|
+
"perUnit":"",
|
241
|
+
"uid":"F473DC8D9F34",
|
242
|
+
"startDate":"2009-03-17T18:37:16Z",
|
243
|
+
"unit":"",
|
244
|
+
"name":"kgCO2 Per Km US",
|
245
|
+
"value":"0.2700",
|
246
|
+
"path":"kgCO2PerKmUS",
|
247
|
+
"displayPath":"kgCO2PerKmUS",
|
248
|
+
"displayName":"kgCO2 Per Km US"
|
249
|
+
},
|
250
|
+
{
|
251
|
+
"itemValueDefinition":
|
252
|
+
{
|
253
|
+
"perUnit":"year",
|
254
|
+
"uid":"C6B80EC6B6A4",
|
255
|
+
"unit":"km",
|
256
|
+
"name":"Typical distance",
|
257
|
+
"path":"typicalDistance",
|
258
|
+
"valueDefinition":
|
259
|
+
{
|
260
|
+
"uid":"45433E48B39F",
|
261
|
+
"environment":
|
262
|
+
{
|
263
|
+
"uid":"5F5887BCF726"
|
264
|
+
},
|
265
|
+
"created":"2007-07-27 09:30:44.0",
|
266
|
+
"description":"",
|
267
|
+
"name":"amount",
|
268
|
+
"valueType":"DECIMAL",
|
269
|
+
"modified":"2007-07-27 09:30:44.0"
|
270
|
+
}
|
271
|
+
},
|
272
|
+
"perUnit":"year",
|
273
|
+
"uid":"1AB167FFFD51",
|
274
|
+
"startDate":"2009-03-17T18:37:16Z",
|
275
|
+
"unit":"km",
|
276
|
+
"name":"Typical distance",
|
277
|
+
"value":"14481",
|
278
|
+
"path":"typicalDistance",
|
279
|
+
"displayPath":"typicalDistance",
|
280
|
+
"displayName":"Typical distance"
|
281
|
+
}
|
282
|
+
],
|
283
|
+
"environment":
|
284
|
+
{
|
285
|
+
"uid":"5F5887BCF726",
|
286
|
+
"itemsPerFeed":10,
|
287
|
+
"created":"2007-07-27 09:30:44.0",
|
288
|
+
"description":"",
|
289
|
+
"name":"AMEE",
|
290
|
+
"owner":"",
|
291
|
+
"path":"",
|
292
|
+
"itemsPerPage":10,
|
293
|
+
"modified":"2007-07-27 09:30:44.0"
|
294
|
+
},
|
295
|
+
"created":"2009-03-17 18:37:16.0",
|
296
|
+
"name":"E57D6E2828EB",
|
297
|
+
"path":"",
|
298
|
+
"itemDefinition":
|
299
|
+
{
|
300
|
+
"uid":"123C4A18B5D6",
|
301
|
+
"environment":
|
302
|
+
{
|
303
|
+
"uid":"5F5887BCF726"
|
304
|
+
},
|
305
|
+
"created":"2007-07-27 09:30:44.0",
|
306
|
+
"name":"Car Generic",
|
307
|
+
"drillDown":"fuel,
|
308
|
+
size",
|
309
|
+
"modified":"2007-07-27 09:30:44.0"
|
310
|
+
},
|
311
|
+
"endDate":"",
|
312
|
+
"label":"average,
|
313
|
+
average",
|
314
|
+
"modified":"2009-04-25 11:19:18.0"
|
315
|
+
},
|
316
|
+
"amountPerMonth":0
|
317
|
+
}
|
@@ -0,0 +1,88 @@
|
|
1
|
+
{
|
2
|
+
"apiVersion":"2.0",
|
3
|
+
"pager":{},
|
4
|
+
"profileCategories":[
|
5
|
+
{
|
6
|
+
"uid":"427DFCC65E52",
|
7
|
+
"name":"Appliances",
|
8
|
+
"path":"appliances"
|
9
|
+
},
|
10
|
+
{
|
11
|
+
"uid":"30BA55A0C472",
|
12
|
+
"name":"Energy",
|
13
|
+
"path":"energy"
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"uid":"A46ECFA19333",
|
17
|
+
"name":"Heating",
|
18
|
+
"path":"heating"
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"uid":"150266DD4434",
|
22
|
+
"name":"Lighting",
|
23
|
+
"path":"lighting"
|
24
|
+
},
|
25
|
+
{
|
26
|
+
"uid":"6553150F96CE",
|
27
|
+
"name":"Waste",
|
28
|
+
"path":"waste"
|
29
|
+
},
|
30
|
+
{
|
31
|
+
"uid":"07362DCC9E7B",
|
32
|
+
"name":"Water",
|
33
|
+
"path":"water"
|
34
|
+
}
|
35
|
+
],
|
36
|
+
"dataCategory":{
|
37
|
+
"uid":"BBA3AC3E795E",
|
38
|
+
"dataCategory":{
|
39
|
+
"uid":"CD310BEBAC52",
|
40
|
+
"name":"Root",
|
41
|
+
"path":""
|
42
|
+
},
|
43
|
+
"environment":{
|
44
|
+
"uid":"5F5887BCF726",
|
45
|
+
"itemsPerFeed":10,
|
46
|
+
"description":"",
|
47
|
+
"name":"AMEE",
|
48
|
+
"owner":"",
|
49
|
+
"path":"",
|
50
|
+
"itemsPerPage":10
|
51
|
+
},
|
52
|
+
"created":"2007-07-27 09:30:44.0",
|
53
|
+
"name":"Home",
|
54
|
+
"path":"home",
|
55
|
+
"modified":"2007-07-27 09:30:44.0"
|
56
|
+
},
|
57
|
+
"environment":{
|
58
|
+
"uid":"5F5887BCF726",
|
59
|
+
"itemsPerFeed":10,
|
60
|
+
"created":"2007-07-27 09:30:44.0",
|
61
|
+
"description":"",
|
62
|
+
"name":"AMEE",
|
63
|
+
"owner":"",
|
64
|
+
"path":"",
|
65
|
+
"itemsPerPage":10,
|
66
|
+
"modified":"2007-07-27 09:30:44.0"
|
67
|
+
},
|
68
|
+
"totalAmount":"0",
|
69
|
+
"path":"/home",
|
70
|
+
"profileItemActions":{
|
71
|
+
"allowCreate":true,
|
72
|
+
"allowView":true,
|
73
|
+
"allowList":true,
|
74
|
+
"allowModify":true,
|
75
|
+
"allowDelete":true
|
76
|
+
},
|
77
|
+
"actions":{
|
78
|
+
"allowCreate":true,
|
79
|
+
"allowView":true,
|
80
|
+
"allowList":true,
|
81
|
+
"allowModify":true,
|
82
|
+
"allowDelete":true
|
83
|
+
},
|
84
|
+
"profileItems":{},
|
85
|
+
"profile":{
|
86
|
+
"uid":"180D73DA5229"
|
87
|
+
}
|
88
|
+
}
|
@@ -1,19 +1,18 @@
|
|
1
|
-
{"
|
2
|
-
"
|
3
|
-
"
|
4
|
-
"
|
5
|
-
"
|
6
|
-
"uid":"
|
7
|
-
"
|
8
|
-
"
|
9
|
-
"
|
10
|
-
"
|
11
|
-
"
|
12
|
-
|
13
|
-
{"name":"
|
14
|
-
|
15
|
-
|
16
|
-
{"name":"
|
17
|
-
|
18
|
-
|
19
|
-
{"name":"User","uid":"2957AE9B6E6B","path":"user"}]}}
|
1
|
+
{"apiVersion":"2.0","pager":{},
|
2
|
+
"profileCategories":[
|
3
|
+
{"uid":"99B121BB416C","name":"Business","path":"business"},
|
4
|
+
{"uid":"BBA3AC3E795E","name":"Home","path":"home"},
|
5
|
+
{"uid":"85A9172C31AF","name":"Import","path":"import"},
|
6
|
+
{"uid":"9E5362EAB0E7","name":"Metadata","path":"metadata"},
|
7
|
+
{"uid":"A0CF90F6C0B9","name":"Personal","path":"personal"},
|
8
|
+
{"uid":"6FF29F7DACDA","name":"Planet","path":"planet"},
|
9
|
+
{"uid":"6153F468BE05","name":"Test","path":"test"},
|
10
|
+
{"uid":"263FC0186834","name":"Transport","path":"transport"},
|
11
|
+
{"uid":"2957AE9B6E6B","name":"User","path":"user"}],"dataCategory":
|
12
|
+
{"uid":"CD310BEBAC52",
|
13
|
+
"environment":{"uid":"5F5887BCF726","itemsPerFeed":10,"description":"","name":"AMEE","owner":"","path":"","itemsPerPage":10},"created":"2007-07-27 09:30:44.0","name":"Root","path":"","modified":"2007-07-27 09:30:44.0"},"environment":{"uid":"5F5887BCF726","itemsPerFeed":10,"created":"2007-07-27 09:30:44.0","description":"","name":"AMEE","owner":"","path":"","itemsPerPage":10,"modified":"2007-07-27 09:30:44.0"},
|
14
|
+
"totalAmount":"10","path":"","profileItems":{},
|
15
|
+
"profile":{"uid":"E0BCB3704D15",
|
16
|
+
"environment":{"uid":"5F5887BCF726"},"created":"2009-04-27 13:02:49.0","name":"E0BCB3704D15","path":"E0BCB3704D15","permission":{"uid":"F197E63C4046","created":"2009-04-27 13:02:49.0","group":{"uid":"AC65FFA5F9D9","name":"amee"},"environmentUid":"5F5887BCF726",
|
17
|
+
"auth":{"uid":"5861D2B0ABBD","username":"hookercookerman"},
|
18
|
+
"modified":"2009-04-27 13:02:49.0"},"modified":"2009-04-27 13:02:49.0"}}
|
@@ -0,0 +1,326 @@
|
|
1
|
+
{
|
2
|
+
"apiVersion":"2.0",
|
3
|
+
"profileItem":{
|
4
|
+
"uid":"5891C88F29FA",
|
5
|
+
"itemValues":[
|
6
|
+
{
|
7
|
+
"itemValueDefinition":{
|
8
|
+
"uid":"E0EFED6FD7E6",
|
9
|
+
"name":"Payment frequency",
|
10
|
+
"path":"paymentFrequency",
|
11
|
+
"valueDefinition":{
|
12
|
+
"uid":"CCEB59CACE1B",
|
13
|
+
"environment":{
|
14
|
+
"uid":"5F5887BCF726"
|
15
|
+
},
|
16
|
+
"created":"2007-07-27 09:30:44.0",
|
17
|
+
"description":"",
|
18
|
+
"name":"text",
|
19
|
+
"valueType":"TEXT",
|
20
|
+
"modified":"2007-07-27 09:30:44.0"
|
21
|
+
}
|
22
|
+
},
|
23
|
+
"perUnit":"",
|
24
|
+
"uid":"920C22CBEDAD",
|
25
|
+
"unit":"",
|
26
|
+
"name":"Payment frequency",
|
27
|
+
"value":"",
|
28
|
+
"path":"paymentFrequency",
|
29
|
+
"displayPath":"paymentFrequency",
|
30
|
+
"displayName":"Payment frequency"
|
31
|
+
},
|
32
|
+
{
|
33
|
+
"itemValueDefinition":{
|
34
|
+
"uid":"63005554AE8A",
|
35
|
+
"name":"Green tariff",
|
36
|
+
"path":"greenTariff",
|
37
|
+
"valueDefinition":{
|
38
|
+
"uid":"CCEB59CACE1B",
|
39
|
+
"environment":{
|
40
|
+
"uid":"5F5887BCF726"
|
41
|
+
},
|
42
|
+
"created":"2007-07-27 09:30:44.0",
|
43
|
+
"description":"",
|
44
|
+
"name":"text",
|
45
|
+
"valueType":"TEXT",
|
46
|
+
"modified":"2007-07-27 09:30:44.0"
|
47
|
+
}
|
48
|
+
},
|
49
|
+
"perUnit":"",
|
50
|
+
"uid":"DEFDAC177202",
|
51
|
+
"unit":"",
|
52
|
+
"name":"Green tariff",
|
53
|
+
"value":"",
|
54
|
+
"path":"greenTariff",
|
55
|
+
"displayPath":"greenTariff",
|
56
|
+
"displayName":"Green tariff"
|
57
|
+
},
|
58
|
+
{
|
59
|
+
"itemValueDefinition":{
|
60
|
+
"uid":"527AADFB3B65",
|
61
|
+
"name":"Season",
|
62
|
+
"path":"season",
|
63
|
+
"valueDefinition":{
|
64
|
+
"uid":"CCEB59CACE1B",
|
65
|
+
"environment":{
|
66
|
+
"uid":"5F5887BCF726"
|
67
|
+
},
|
68
|
+
"created":"2007-07-27 09:30:44.0",
|
69
|
+
"description":"",
|
70
|
+
"name":"text",
|
71
|
+
"valueType":"TEXT",
|
72
|
+
"modified":"2007-07-27 09:30:44.0"
|
73
|
+
}
|
74
|
+
},
|
75
|
+
"perUnit":"",
|
76
|
+
"uid":"F4BB17BC1D5E",
|
77
|
+
"unit":"",
|
78
|
+
"name":"Season",
|
79
|
+
"value":"",
|
80
|
+
"path":"season",
|
81
|
+
"displayPath":"season",
|
82
|
+
"displayName":"Season"
|
83
|
+
},
|
84
|
+
{
|
85
|
+
"itemValueDefinition":{
|
86
|
+
"uid":"1740E500BDAB",
|
87
|
+
"choices":"true=true, false=false",
|
88
|
+
"name":"Includes Heating",
|
89
|
+
"path":"includesHeating",
|
90
|
+
"valueDefinition":{
|
91
|
+
"uid":"CCEB59CACE1B",
|
92
|
+
"environment":{
|
93
|
+
"uid":"5F5887BCF726"
|
94
|
+
},
|
95
|
+
"created":"2007-07-27 09:30:44.0",
|
96
|
+
"description":"",
|
97
|
+
"name":"text",
|
98
|
+
"valueType":"TEXT",
|
99
|
+
"modified":"2007-07-27 09:30:44.0"
|
100
|
+
}
|
101
|
+
},
|
102
|
+
"perUnit":"",
|
103
|
+
"uid":"7381C23DE6CD",
|
104
|
+
"unit":"",
|
105
|
+
"name":"Includes Heating",
|
106
|
+
"value":"false",
|
107
|
+
"path":"includesHeating",
|
108
|
+
"displayPath":"includesHeating",
|
109
|
+
"displayName":"Includes Heating"
|
110
|
+
},
|
111
|
+
{
|
112
|
+
"itemValueDefinition":{
|
113
|
+
"perUnit":"year",
|
114
|
+
"uid":"666C77B224B3",
|
115
|
+
"unit":"kg",
|
116
|
+
"name":"Mass Per Time",
|
117
|
+
"path":"massPerTime",
|
118
|
+
"valueDefinition":{
|
119
|
+
"uid":"45433E48B39F",
|
120
|
+
"environment":{
|
121
|
+
"uid":"5F5887BCF726"
|
122
|
+
},
|
123
|
+
"created":"2007-07-27 09:30:44.0",
|
124
|
+
"description":"",
|
125
|
+
"name":"amount",
|
126
|
+
"valueType":"DECIMAL",
|
127
|
+
"modified":"2007-07-27 09:30:44.0"
|
128
|
+
}
|
129
|
+
},
|
130
|
+
"perUnit":"year",
|
131
|
+
"uid":"DE2A903C5340",
|
132
|
+
"unit":"kg",
|
133
|
+
"name":"Mass Per Time",
|
134
|
+
"value":"0",
|
135
|
+
"path":"massPerTime",
|
136
|
+
"displayPath":"massPerTime",
|
137
|
+
"displayName":"Mass Per Time"
|
138
|
+
},
|
139
|
+
{
|
140
|
+
"itemValueDefinition":{
|
141
|
+
"perUnit":"year",
|
142
|
+
"uid":"BFD215C4CAB1",
|
143
|
+
"unit":"kWh",
|
144
|
+
"name":"Energy Consumption",
|
145
|
+
"path":"energyConsumption",
|
146
|
+
"valueDefinition":{
|
147
|
+
"uid":"45433E48B39F",
|
148
|
+
"environment":{
|
149
|
+
"uid":"5F5887BCF726"
|
150
|
+
},
|
151
|
+
"created":"2007-07-27 09:30:44.0",
|
152
|
+
"description":"",
|
153
|
+
"name":"amount",
|
154
|
+
"valueType":"DECIMAL",
|
155
|
+
"modified":"2007-07-27 09:30:44.0"
|
156
|
+
}
|
157
|
+
},
|
158
|
+
"perUnit":"month",
|
159
|
+
"uid":"BF3EF6F0E1F4",
|
160
|
+
"unit":"kWh",
|
161
|
+
"name":"Energy Consumption",
|
162
|
+
"value":"10",
|
163
|
+
"path":"energyConsumption",
|
164
|
+
"displayPath":"energyConsumption",
|
165
|
+
"displayName":"Energy Consumption"
|
166
|
+
},
|
167
|
+
{
|
168
|
+
"itemValueDefinition":{
|
169
|
+
"perUnit":"year",
|
170
|
+
"uid":"A9B493A4A1A6",
|
171
|
+
"unit":"kWh",
|
172
|
+
"name":"Current Reading",
|
173
|
+
"path":"currentReading",
|
174
|
+
"valueDefinition":{
|
175
|
+
"uid":"45433E48B39F",
|
176
|
+
"environment":{
|
177
|
+
"uid":"5F5887BCF726"
|
178
|
+
},
|
179
|
+
"created":"2007-07-27 09:30:44.0",
|
180
|
+
"description":"",
|
181
|
+
"name":"amount",
|
182
|
+
"valueType":"DECIMAL",
|
183
|
+
"modified":"2007-07-27 09:30:44.0"
|
184
|
+
}
|
185
|
+
},
|
186
|
+
"perUnit":"year",
|
187
|
+
"uid":"FA5A119E335C",
|
188
|
+
"unit":"kWh",
|
189
|
+
"name":"Current Reading",
|
190
|
+
"value":"0",
|
191
|
+
"path":"currentReading",
|
192
|
+
"displayPath":"currentReading",
|
193
|
+
"displayName":"Current Reading"
|
194
|
+
},
|
195
|
+
{
|
196
|
+
"itemValueDefinition":{
|
197
|
+
"perUnit":"year",
|
198
|
+
"uid":"4C689DEF0A41",
|
199
|
+
"unit":"kWh",
|
200
|
+
"name":"Last Reading",
|
201
|
+
"path":"lastReading",
|
202
|
+
"valueDefinition":{
|
203
|
+
"uid":"45433E48B39F",
|
204
|
+
"environment":{
|
205
|
+
"uid":"5F5887BCF726"
|
206
|
+
},
|
207
|
+
"created":"2007-07-27 09:30:44.0",
|
208
|
+
"description":"",
|
209
|
+
"name":"amount",
|
210
|
+
"valueType":"DECIMAL",
|
211
|
+
"modified":"2007-07-27 09:30:44.0"
|
212
|
+
}
|
213
|
+
},
|
214
|
+
"perUnit":"year",
|
215
|
+
"uid":"8CC9C901561B",
|
216
|
+
"unit":"kWh",
|
217
|
+
"name":"Last Reading",
|
218
|
+
"value":"0",
|
219
|
+
"path":"lastReading",
|
220
|
+
"displayPath":"lastReading",
|
221
|
+
"displayName":"Last Reading"
|
222
|
+
},
|
223
|
+
{
|
224
|
+
"itemValueDefinition":{
|
225
|
+
"perUnit":"year",
|
226
|
+
"uid":"7BBABF4C2E9E",
|
227
|
+
"unit":"L",
|
228
|
+
"name":"Volume Per Time",
|
229
|
+
"path":"volumePerTime",
|
230
|
+
"valueDefinition":{
|
231
|
+
"uid":"45433E48B39F",
|
232
|
+
"environment":{
|
233
|
+
"uid":"5F5887BCF726"
|
234
|
+
},
|
235
|
+
"created":"2007-07-27 09:30:44.0",
|
236
|
+
"description":"",
|
237
|
+
"name":"amount",
|
238
|
+
"valueType":"DECIMAL",
|
239
|
+
"modified":"2007-07-27 09:30:44.0"
|
240
|
+
}
|
241
|
+
},
|
242
|
+
"perUnit":"year",
|
243
|
+
"uid":"933C7A656B8D",
|
244
|
+
"unit":"L",
|
245
|
+
"name":"Volume Per Time",
|
246
|
+
"value":"0",
|
247
|
+
"path":"volumePerTime",
|
248
|
+
"displayPath":"volumePerTime",
|
249
|
+
"displayName":"Volume Per Time"
|
250
|
+
},
|
251
|
+
{
|
252
|
+
"itemValueDefinition":{
|
253
|
+
"perUnit":"year",
|
254
|
+
"uid":"F0ED40C7EF8F",
|
255
|
+
"name":"Number of deliveries",
|
256
|
+
"path":"deliveries",
|
257
|
+
"valueDefinition":{
|
258
|
+
"uid":"45433E48B39F",
|
259
|
+
"environment":{
|
260
|
+
"uid":"5F5887BCF726"
|
261
|
+
},
|
262
|
+
"created":"2007-07-27 09:30:44.0",
|
263
|
+
"description":"",
|
264
|
+
"name":"amount",
|
265
|
+
"valueType":"DECIMAL",
|
266
|
+
"modified":"2007-07-27 09:30:44.0"
|
267
|
+
}
|
268
|
+
},
|
269
|
+
"perUnit":"year",
|
270
|
+
"uid":"3D9CE047FE24",
|
271
|
+
"unit":"",
|
272
|
+
"name":"Number of deliveries",
|
273
|
+
"value":"",
|
274
|
+
"path":"deliveries",
|
275
|
+
"displayPath":"deliveries",
|
276
|
+
"displayName":"Number of deliveries"
|
277
|
+
}
|
278
|
+
],
|
279
|
+
"dataCategory":{
|
280
|
+
"uid":"A92693A99BAD",
|
281
|
+
"name":"Quantity",
|
282
|
+
"path":"quantity"
|
283
|
+
},
|
284
|
+
"startDate":"2009-03-19T16:51:00Z",
|
285
|
+
"itemDefinition":{
|
286
|
+
"uid":"212C818D8F16",
|
287
|
+
"name":"Energy Quantity",
|
288
|
+
"drillDown":"type"
|
289
|
+
},
|
290
|
+
"endDate":"",
|
291
|
+
"dataItem":{
|
292
|
+
"uid":"66056991EE23",
|
293
|
+
"Label":"gas"
|
294
|
+
},
|
295
|
+
"modified":"2009-03-19T16:51:33Z",
|
296
|
+
"amount":{
|
297
|
+
"unit":"kg/year",
|
298
|
+
"value":24.66
|
299
|
+
},
|
300
|
+
"environment":{
|
301
|
+
"uid":"5F5887BCF726",
|
302
|
+
"itemsPerFeed":10,
|
303
|
+
"description":"",
|
304
|
+
"name":"AMEE",
|
305
|
+
"owner":"",
|
306
|
+
"path":"",
|
307
|
+
"itemsPerPage":10
|
308
|
+
},
|
309
|
+
"created":"2009-03-19T16:51:33Z",
|
310
|
+
"name":null,
|
311
|
+
"profile":{
|
312
|
+
"uid":"F38ECBD56D59"
|
313
|
+
}
|
314
|
+
},
|
315
|
+
"path":"/home/energy/quantity/5891C88F29FA",
|
316
|
+
"actions":{
|
317
|
+
"allowCreate":true,
|
318
|
+
"allowView":true,
|
319
|
+
"allowList":true,
|
320
|
+
"allowModify":true,
|
321
|
+
"allowDelete":true
|
322
|
+
},
|
323
|
+
"profile":{
|
324
|
+
"uid":"F38ECBD56D59"
|
325
|
+
}
|
326
|
+
}
|
@@ -8,7 +8,7 @@ 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
|
11
|
+
attr_accessor :start_date, :end_date, :label, :choices, :kg_c_o2_per_k_wh, :source, :amount_per_month
|
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}
|
data/lib/amee/parser.rb
CHANGED
@@ -55,11 +55,7 @@ module Amee
|
|
55
55
|
|
56
56
|
class ProfileCategory < Parser
|
57
57
|
def self.process(data)
|
58
|
-
|
59
|
-
profile_items = {"profile_items" => data["children"]["profileItems"].delete("rows")} if data["children"]["profileItems"]
|
60
|
-
profile_items["profile_items"].each{ |profile_item| profile_item.merge!({"profile" => data["profile"]})} if profile_items && profile_items["profile_items"]
|
61
|
-
data.merge(profile_items).merge(profile_categories).
|
62
|
-
merge({"resource_path" => data["path"]})
|
58
|
+
data.merge({"resource_path" => data["path"]})
|
63
59
|
end
|
64
60
|
end
|
65
61
|
|
@@ -93,9 +89,9 @@ module Amee
|
|
93
89
|
|
94
90
|
class GetProfile < Parser
|
95
91
|
def self.process(data)
|
96
|
-
|
97
|
-
|
98
|
-
data["
|
92
|
+
data["profile"].merge({"profile_categories" => data["profileCategories"]}).
|
93
|
+
merge({"profile_items" => data["profileItems"]}).
|
94
|
+
merge({"total_amount" => data["totalAmount"]}).
|
99
95
|
merge({"resource_path" => data["path"]})
|
100
96
|
end
|
101
97
|
end
|
@@ -6,7 +6,7 @@ module Amee
|
|
6
6
|
include ::Amee::Model
|
7
7
|
self.path_prefix = "/profiles"
|
8
8
|
|
9
|
-
attr_accessor :
|
9
|
+
attr_accessor :total_amount
|
10
10
|
list_populators :profile_categories => {:class => Amee::ProfileApi::ProfileCategory}
|
11
11
|
item_populators :data_category => {:class => Amee::DataApi::DataCategory}
|
12
12
|
|
@@ -14,9 +14,9 @@ module Amee
|
|
14
14
|
self.from_hash(session.new_profile, session)
|
15
15
|
end
|
16
16
|
|
17
|
-
def
|
18
|
-
path = full_path + path_or_category.is_a?(String) ? "
|
19
|
-
Amee::ProfileApi::
|
17
|
+
def create_profile_item(path_or_category, data_item_uid, params = {})
|
18
|
+
path = full_path + (path_or_category.is_a?(String) ? "#{path_or_category}" : "#{path_or_category.full_path}")
|
19
|
+
Amee::ProfileApi::ProfileItem.create(session, path, data_item_uid, params)
|
20
20
|
end
|
21
21
|
|
22
22
|
def get_profile_item(path, options = {})
|
@@ -7,7 +7,7 @@ module Amee
|
|
7
7
|
self.path_prefix = "/profiles"
|
8
8
|
|
9
9
|
|
10
|
-
attr_accessor :profile, :
|
10
|
+
attr_accessor :profile, :total_amount, :pager
|
11
11
|
|
12
12
|
list_populators :profile_items => {:class => Amee::ProfileApi::ProfileItem},
|
13
13
|
:profile_categories => {:class => Amee::ProfileApi::ProfileCategory}
|
@@ -7,7 +7,7 @@ module Amee
|
|
7
7
|
self.path_prefix = "/profiles"
|
8
8
|
|
9
9
|
attr_accessor :end, :amount, :data_item, :profile, :valid_from, :start_date, :end_date
|
10
|
-
attr_accessor :data_item_label, :data_item_uid, :
|
10
|
+
attr_accessor :data_item_label, :data_item_uid, :total_amount
|
11
11
|
|
12
12
|
list_populators :item_values => {:class => Amee::DataApi::DataItemValue}
|
13
13
|
item_populators :data_category => {:class => Amee::DataApi::DataCategory},
|
@@ -15,7 +15,7 @@ module Amee
|
|
15
15
|
|
16
16
|
|
17
17
|
def self.create(session, path, data_item_uid, fields ={})
|
18
|
-
hash = session.
|
18
|
+
hash = session.create_profile_item(path, data_item_uid, {:fields => fields, :hash_response => true})
|
19
19
|
self.from_hash(hash, session)
|
20
20
|
end
|
21
21
|
|
data/lib/amee/session.rb
CHANGED
@@ -159,6 +159,7 @@ module Amee
|
|
159
159
|
@cache.clear
|
160
160
|
api_call(:post, "profile_item", path,
|
161
161
|
:query => {:dataItemUid => uid, :representation => "full"}.merge(options[:fields])) do |response|
|
162
|
+
return response if options[:hash_response]
|
162
163
|
Amee::ProfileApi::ProfileItem.from_hash(response, self)
|
163
164
|
end
|
164
165
|
end
|
data/lib/amee.rb
CHANGED
@@ -10,7 +10,10 @@ rescue LoadError
|
|
10
10
|
require "json/pure"
|
11
11
|
end
|
12
12
|
|
13
|
+
gem "httparty", "~>0.4.3"
|
13
14
|
require "httparty"
|
15
|
+
|
16
|
+
gem "wycats-moneta", "~>0.5.0"
|
14
17
|
require "moneta"
|
15
18
|
require "moneta/memory"
|
16
19
|
|
@@ -33,5 +36,5 @@ require "amee/profile_api/profile_category"
|
|
33
36
|
require "amee/profile_api/profile"
|
34
37
|
|
35
38
|
module Amee
|
36
|
-
VERSION = '0.1.
|
39
|
+
VERSION = '0.1.4'
|
37
40
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hookercookerman-amee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Hooker
|
@@ -90,6 +90,7 @@ files:
|
|
90
90
|
- Manifest.txt
|
91
91
|
- README.rdoc
|
92
92
|
- Rakefile
|
93
|
+
- amee.gemspec
|
93
94
|
- features/config.feature
|
94
95
|
- features/data/data_category.feature
|
95
96
|
- features/data/data_item.feature
|
@@ -116,6 +117,7 @@ files:
|
|
116
117
|
- features/support/amee/auth/response.json
|
117
118
|
- features/support/amee/data.json
|
118
119
|
- features/support/amee/data/transport/car/generic.json
|
120
|
+
- features/support/amee/data/transport/car/generic/E57D6E2828EB.json
|
119
121
|
- features/support/amee/data/transport/car/generic/drill.json
|
120
122
|
- features/support/amee/data/transport/car/generic/drill?fuel=diesel&size=large.json
|
121
123
|
- features/support/amee/data/transport/car/generic/drill?fuel=diesel.json
|
@@ -127,11 +129,12 @@ files:
|
|
127
129
|
- features/support/amee/profiles.json
|
128
130
|
- features/support/amee/profiles/155DD3C63646/transport/motorcycle/generic/D47C465B8157.json
|
129
131
|
- features/support/amee/profiles/155DD3C63646/transport/motorcycle/generic/D47C465B8157?distance=400&representation=true.json
|
132
|
+
- features/support/amee/profiles/180D73DA5229/home.json
|
130
133
|
- features/support/amee/profiles/48B97680BCCF/home/energy/quantity/response.json
|
131
134
|
- features/support/amee/profiles/7C7D68C2A7CD/home.json
|
132
|
-
- features/support/amee/profiles/BB1BDB4FDD77/home/energy/quantity/920B54ED665B.json
|
133
135
|
- features/support/amee/profiles/E0BCB3704D15.json
|
134
136
|
- features/support/amee/profiles/E0BCB3704D15/Business.json
|
137
|
+
- features/support/amee/profiles/F38ECBD56D59/home/energy/quantity/5891C88F29FA.json
|
135
138
|
- features/support/amee/profiles/profile.json
|
136
139
|
- features/support/env.rb
|
137
140
|
- init.rb
|
@@ -1,201 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"profileItem":{
|
3
|
-
"uid":"920B54ED665B",
|
4
|
-
"itemValues":[
|
5
|
-
{
|
6
|
-
"itemValueDefinition":{
|
7
|
-
"uid":"51D072825D41",
|
8
|
-
"name":"kg Per Month",
|
9
|
-
"path":"kgPerMonth",
|
10
|
-
"valueDefinition":{
|
11
|
-
"uid":"36A771FC1D1A",
|
12
|
-
"name":"kg",
|
13
|
-
"valueType":"DECIMAL"
|
14
|
-
}
|
15
|
-
},
|
16
|
-
"uid":"869D6084EB9C",
|
17
|
-
"name":"kg Per Month",
|
18
|
-
"value":"0",
|
19
|
-
"path":"kgPerMonth"
|
20
|
-
},
|
21
|
-
{
|
22
|
-
"itemValueDefinition":{
|
23
|
-
"uid":"4DF458FD0E4D",
|
24
|
-
"name":"kWh Per Month",
|
25
|
-
"path":"kWhPerMonth",
|
26
|
-
"valueDefinition":{
|
27
|
-
"uid":"26A5C97D3728",
|
28
|
-
"name":"kWh",
|
29
|
-
"valueType":"DECIMAL"
|
30
|
-
}
|
31
|
-
},
|
32
|
-
"uid":"CFA69C6E4D3F",
|
33
|
-
"name":"kWh Per Month",
|
34
|
-
"value":"10",
|
35
|
-
"path":"kWhPerMonth"
|
36
|
-
},
|
37
|
-
{
|
38
|
-
"itemValueDefinition":{
|
39
|
-
"uid":"C9B7E19269A5",
|
40
|
-
"name":"Litres Per Month",
|
41
|
-
"path":"litresPerMonth",
|
42
|
-
"valueDefinition":{
|
43
|
-
"uid":"06B8CFC5A521",
|
44
|
-
"name":"litre",
|
45
|
-
"valueType":"DECIMAL"
|
46
|
-
}
|
47
|
-
},
|
48
|
-
"uid":"A5E88E093F9F",
|
49
|
-
"name":"Litres Per Month",
|
50
|
-
"value":"0",
|
51
|
-
"path":"litresPerMonth"
|
52
|
-
},
|
53
|
-
{
|
54
|
-
"itemValueDefinition":{
|
55
|
-
"uid":"8A468E75C8E8",
|
56
|
-
"name":"kWh reading current",
|
57
|
-
"path":"kWhReadingCurrent",
|
58
|
-
"valueDefinition":{
|
59
|
-
"uid":"45433E48B39F",
|
60
|
-
"name":"amount",
|
61
|
-
"valueType":"DECIMAL"
|
62
|
-
}
|
63
|
-
},
|
64
|
-
"uid":"335A93429B77",
|
65
|
-
"name":"kWh reading current",
|
66
|
-
"value":"0",
|
67
|
-
"path":"kWhReadingCurrent"
|
68
|
-
},
|
69
|
-
{
|
70
|
-
"itemValueDefinition":{
|
71
|
-
"uid":"2328DC7F23AE",
|
72
|
-
"name":"kWh reading last",
|
73
|
-
"path":"kWhReadingLast",
|
74
|
-
"valueDefinition":{
|
75
|
-
"uid":"45433E48B39F",
|
76
|
-
"name":"amount",
|
77
|
-
"valueType":"DECIMAL"
|
78
|
-
}
|
79
|
-
},
|
80
|
-
"uid":"38FAFEE33F01",
|
81
|
-
"name":"kWh reading last",
|
82
|
-
"value":"0",
|
83
|
-
"path":"kWhReadingLast"
|
84
|
-
},
|
85
|
-
{
|
86
|
-
"itemValueDefinition":{
|
87
|
-
"uid":"E0EFED6FD7E6",
|
88
|
-
"name":"Payment frequency",
|
89
|
-
"path":"paymentFrequency",
|
90
|
-
"valueDefinition":{
|
91
|
-
"uid":"CCEB59CACE1B",
|
92
|
-
"name":"text",
|
93
|
-
"valueType":"TEXT"
|
94
|
-
}
|
95
|
-
},
|
96
|
-
"uid":"EBC261EDC5D2",
|
97
|
-
"name":"Payment frequency",
|
98
|
-
"value":"",
|
99
|
-
"path":"paymentFrequency"
|
100
|
-
},
|
101
|
-
{
|
102
|
-
"itemValueDefinition":{
|
103
|
-
"uid":"63005554AE8A",
|
104
|
-
"name":"Green tariff",
|
105
|
-
"path":"greenTariff",
|
106
|
-
"valueDefinition":{
|
107
|
-
"uid":"CCEB59CACE1B",
|
108
|
-
"name":"text",
|
109
|
-
"valueType":"TEXT"
|
110
|
-
}
|
111
|
-
},
|
112
|
-
"uid":"3D90D411DC4B",
|
113
|
-
"name":"Green tariff",
|
114
|
-
"value":"",
|
115
|
-
"path":"greenTariff"
|
116
|
-
},
|
117
|
-
{
|
118
|
-
"itemValueDefinition":{
|
119
|
-
"uid":"527AADFB3B65",
|
120
|
-
"name":"Season",
|
121
|
-
"path":"season",
|
122
|
-
"valueDefinition":{
|
123
|
-
"uid":"CCEB59CACE1B",
|
124
|
-
"name":"text",
|
125
|
-
"valueType":"TEXT"
|
126
|
-
}
|
127
|
-
},
|
128
|
-
"uid":"67D489724500",
|
129
|
-
"name":"Season",
|
130
|
-
"value":"",
|
131
|
-
"path":"season"
|
132
|
-
},
|
133
|
-
{
|
134
|
-
"itemValueDefinition":{
|
135
|
-
"uid":"1740E500BDAB",
|
136
|
-
"name":"Includes Heating",
|
137
|
-
"path":"includesHeating",
|
138
|
-
"valueDefinition":{
|
139
|
-
"uid":"CCEB59CACE1B",
|
140
|
-
"name":"text",
|
141
|
-
"valueType":"TEXT"
|
142
|
-
}
|
143
|
-
},
|
144
|
-
"uid":"A0C15D226883",
|
145
|
-
"name":"Includes Heating",
|
146
|
-
"value":"false",
|
147
|
-
"path":"includesHeating"
|
148
|
-
},
|
149
|
-
{
|
150
|
-
"itemValueDefinition":{
|
151
|
-
"uid":"AA1D1C349119",
|
152
|
-
"name":"Number of deliveries",
|
153
|
-
"path":"numberOfDeliveries",
|
154
|
-
"valueDefinition":{
|
155
|
-
"uid":"45433E48B39F",
|
156
|
-
"name":"amount",
|
157
|
-
"valueType":"DECIMAL"
|
158
|
-
}
|
159
|
-
},
|
160
|
-
"uid":"FCABCD89A8D8",
|
161
|
-
"name":"Number of deliveries",
|
162
|
-
"value":"",
|
163
|
-
"path":"numberOfDeliveries"
|
164
|
-
}
|
165
|
-
],
|
166
|
-
"dataCategory":{
|
167
|
-
"uid":"A92693A99BAD",
|
168
|
-
"name":"Quantity",
|
169
|
-
"path":"quantity"
|
170
|
-
},
|
171
|
-
"itemDefinition":{
|
172
|
-
"uid":"212C818D8F16"
|
173
|
-
},
|
174
|
-
"dataItem":{
|
175
|
-
"uid":"66056991EE23"
|
176
|
-
},
|
177
|
-
"modified":"2009-03-19 15:25:40.0",
|
178
|
-
"environment":{
|
179
|
-
"uid":"5F5887BCF726"
|
180
|
-
},
|
181
|
-
"created":"2009-03-19 15:25:40.0",
|
182
|
-
"name":"920B54ED665B",
|
183
|
-
"validFrom":"20090301",
|
184
|
-
"end":"false",
|
185
|
-
"amountPerMonth":2.055,
|
186
|
-
"profile":{
|
187
|
-
"uid":"BB1BDB4FDD77"
|
188
|
-
}
|
189
|
-
},
|
190
|
-
"path":"/home/energy/quantity/920B54ED665B",
|
191
|
-
"actions":{
|
192
|
-
"allowCreate":true,
|
193
|
-
"allowView":true,
|
194
|
-
"allowList":true,
|
195
|
-
"allowModify":true,
|
196
|
-
"allowDelete":true
|
197
|
-
},
|
198
|
-
"profile":{
|
199
|
-
"uid":"BB1BDB4FDD77"
|
200
|
-
}
|
201
|
-
}
|