hookercookerman-amee 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. data/History.txt +1 -0
  2. data/LICENSE.txt +20 -0
  3. data/Manifest.txt +79 -0
  4. data/README.rdoc +33 -0
  5. data/Rakefile +29 -0
  6. data/features/config.feature +22 -0
  7. data/features/data/data_category.feature +26 -0
  8. data/features/data/data_item.feature +19 -0
  9. data/features/data/data_item_value.feature +17 -0
  10. data/features/data/drill_down.feature +48 -0
  11. data/features/development.feature +13 -0
  12. data/features/profile/create.profile.feature +15 -0
  13. data/features/profile/create.profile_item.feature +12 -0
  14. data/features/profile/delete.profile.feature +12 -0
  15. data/features/profile/delete.profile_item.feature +13 -0
  16. data/features/profile/get.profile.feature +13 -0
  17. data/features/profile/profile_category.feature +14 -0
  18. data/features/profile/profile_item.feature +15 -0
  19. data/features/profile/profiles.feature +15 -0
  20. data/features/profile/update.profile_item.feature +14 -0
  21. data/features/session/reauthenticate.feature +16 -0
  22. data/features/step_definitions/amee_steps.rb +67 -0
  23. data/features/step_definitions/common_steps.rb +194 -0
  24. data/features/step_definitions/config_steps.rb +13 -0
  25. data/features/step_definitions/data_steps.rb +142 -0
  26. data/features/step_definitions/profile_category_steps.rb +23 -0
  27. data/features/step_definitions/profile_item_steps.rb +62 -0
  28. data/features/step_definitions/profile_steps.rb +41 -0
  29. data/features/support/amee/auth/response.json +11 -0
  30. data/features/support/amee/data.json +84 -0
  31. data/features/support/amee/data/transport/car/generic.json +3 -0
  32. data/features/support/amee/data/transport/car/generic/drill.json +66 -0
  33. data/features/support/amee/data/transport/car/generic/drill?fuel=diesel&size=large.json +55 -0
  34. data/features/support/amee/data/transport/car/generic/drill?fuel=diesel.json +59 -0
  35. data/features/support/amee/data/transport/plane/generic.json +225 -0
  36. data/features/support/amee/data/transport/plane/generic/FFC7A05D54AD.json +224 -0
  37. data/features/support/amee/data/transport/plane/generic/FFC7A05D54AD/kgCO2PerPassengerJourney.json +42 -0
  38. data/features/support/amee/data_category.json +84 -0
  39. data/features/support/amee/data_category_with_data_items.json +225 -0
  40. data/features/support/amee/profiles.json +73 -0
  41. data/features/support/amee/profiles/155DD3C63646/transport/motorcycle/generic/D47C465B8157.json +190 -0
  42. data/features/support/amee/profiles/155DD3C63646/transport/motorcycle/generic/D47C465B8157?distance=400&representation=true.json +190 -0
  43. data/features/support/amee/profiles/48B97680BCCF/home/energy/quantity/response.json +9 -0
  44. data/features/support/amee/profiles/7C7D68C2A7CD/home.json +65 -0
  45. data/features/support/amee/profiles/BB1BDB4FDD77/home/energy/quantity/920B54ED665B.json +201 -0
  46. data/features/support/amee/profiles/E0BCB3704D15.json +19 -0
  47. data/features/support/amee/profiles/E0BCB3704D15/Business.json +6 -0
  48. data/features/support/amee/profiles/profile.json +27 -0
  49. data/features/support/env.rb +24 -0
  50. data/init.rb +4 -0
  51. data/lib/amee.rb +37 -0
  52. data/lib/amee/config.rb +59 -0
  53. data/lib/amee/data_api/data_category.rb +50 -0
  54. data/lib/amee/data_api/data_item.rb +28 -0
  55. data/lib/amee/data_api/data_item_value.rb +13 -0
  56. data/lib/amee/data_api/drill_down.rb +23 -0
  57. data/lib/amee/data_api/item_definition.rb +11 -0
  58. data/lib/amee/data_api/item_value_definition.rb +13 -0
  59. data/lib/amee/data_api/value_definition.rb +10 -0
  60. data/lib/amee/logging.rb +43 -0
  61. data/lib/amee/model.rb +128 -0
  62. data/lib/amee/parser.rb +137 -0
  63. data/lib/amee/profile_api/profile.rb +39 -0
  64. data/lib/amee/profile_api/profile_category.rb +42 -0
  65. data/lib/amee/profile_api/profile_item.rb +47 -0
  66. data/lib/amee/service.rb +78 -0
  67. data/lib/amee/session.rb +222 -0
  68. data/lib/amee/utils/string.rb +11 -0
  69. data/script/console +10 -0
  70. data/script/destroy +14 -0
  71. data/script/generate +14 -0
  72. data/script/txt2html +71 -0
  73. data/spec/amee_spec.rb +1 -0
  74. data/spec/service_spec.rb +53 -0
  75. data/spec/session_spec.rb +45 -0
  76. data/spec/spec.opts +1 -0
  77. data/spec/spec_helper.rb +19 -0
  78. data/tasks/rspec.rake +21 -0
  79. data/tasks/yard.rake +4 -0
  80. metadata +184 -0
@@ -0,0 +1,73 @@
1
+ {
2
+ "apiVersion":"2.0",
3
+ "pager":{
4
+ "to":10,
5
+ "lastPage":2,
6
+ "nextPage":2,
7
+ "items":16,
8
+ "start":0,
9
+ "itemsFound":10,
10
+ "requestedPage":1,
11
+ "currentPage":1,
12
+ "from":1,
13
+ "itemsPerPage":10,
14
+ "previousPage":-1
15
+ },
16
+ "profiles":[
17
+ {
18
+ "uid":"B28A58B0E243",
19
+ "environment":{
20
+ "uid":"5F5887BCF726"
21
+ },
22
+ "created":"2009-03-19 10:54:46.0",
23
+ "name":"B28A58B0E243",
24
+ "path":"B28A58B0E243",
25
+ "permission":{
26
+ "uid":"AEECFC02BF27",
27
+ "created":"2009-03-19 10:54:46.0",
28
+ "group":{
29
+ "uid":"AC65FFA5F9D9",
30
+ "name":"amee"
31
+ },
32
+ "environmentUid":"5F5887BCF726",
33
+ "auth":{
34
+ "uid":"BA6EB0039D69",
35
+ "username":"v2user"
36
+ },
37
+ "modified":"2009-03-19 10:54:46.0"
38
+ },
39
+ "modified":"2009-03-19 10:54:46.0"
40
+ },
41
+ {
42
+ "uid":"E0047238E5E0",
43
+ "environment":{
44
+ "uid":"5F5887BCF726"
45
+ },
46
+ "created":"2009-03-17 14:17:12.0",
47
+ "name":"E0047238E5E0",
48
+ "path":"E0047238E5E0",
49
+ "permission":{
50
+ "uid":"D24F947B27EA",
51
+ "created":"2009-03-17 14:17:12.0",
52
+ "group":{
53
+ "uid":"AC65FFA5F9D9",
54
+ "name":"amee"
55
+ },
56
+ "environmentUid":"5F5887BCF726",
57
+ "auth":{
58
+ "uid":"BA6EB0039D69",
59
+ "username":"v2user"
60
+ },
61
+ "modified":"2009-03-17 14:17:12.0"
62
+ },
63
+ "modified":"2009-03-17 14:17:12.0"
64
+ }
65
+ ],
66
+ "actions":{
67
+ "allowCreate":true,
68
+ "allowView":true,
69
+ "allowList":true,
70
+ "allowModify":true,
71
+ "allowDelete":true
72
+ }
73
+ }
@@ -0,0 +1,190 @@
1
+ {
2
+ "apiVersion":"2.0",
3
+ "profileItem":{
4
+ "uid":"D47C465B8157",
5
+ "itemValues":[
6
+ {
7
+ "itemValueDefinition":{
8
+ "uid":"F3900EDAB5EB",
9
+ "name":"Country",
10
+ "path":"country",
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":"01D8AD934852",
25
+ "unit":"",
26
+ "name":"Country",
27
+ "value":"",
28
+ "path":"country",
29
+ "displayPath":"country",
30
+ "displayName":"Country"
31
+ },
32
+ {
33
+ "itemValueDefinition":{
34
+ "uid":"85DAD143CD22",
35
+ "name":"Occupants",
36
+ "path":"occupants",
37
+ "valueDefinition":{
38
+ "uid":"45433E48B39F",
39
+ "environment":{
40
+ "uid":"5F5887BCF726"
41
+ },
42
+ "created":"2007-07-27 09:30:44.0",
43
+ "description":"",
44
+ "name":"amount",
45
+ "valueType":"DECIMAL",
46
+ "modified":"2007-07-27 09:30:44.0"
47
+ }
48
+ },
49
+ "perUnit":"",
50
+ "uid":"FB45DF9BC8FC",
51
+ "unit":"",
52
+ "name":"Occupants",
53
+ "value":"-1",
54
+ "path":"occupants",
55
+ "displayPath":"occupants",
56
+ "displayName":"Occupants"
57
+ },
58
+ {
59
+ "itemValueDefinition":{
60
+ "perUnit":"year",
61
+ "uid":"5898B35AE183",
62
+ "unit":"km",
63
+ "name":"Distance",
64
+ "path":"distance",
65
+ "valueDefinition":{
66
+ "uid":"45433E48B39F",
67
+ "environment":{
68
+ "uid":"5F5887BCF726"
69
+ },
70
+ "created":"2007-07-27 09:30:44.0",
71
+ "description":"",
72
+ "name":"amount",
73
+ "valueType":"DECIMAL",
74
+ "modified":"2007-07-27 09:30:44.0"
75
+ }
76
+ },
77
+ "perUnit":"month",
78
+ "uid":"557784471D55",
79
+ "unit":"km",
80
+ "name":"Distance",
81
+ "value":"200",
82
+ "path":"distance",
83
+ "displayPath":"distance",
84
+ "displayName":"Distance"
85
+ },
86
+ {
87
+ "itemValueDefinition":{
88
+ "perUnit":"L",
89
+ "uid":"2538ABD1FFE7",
90
+ "unit":"km",
91
+ "name":"Fuel Consumption",
92
+ "path":"fuelConsumption",
93
+ "valueDefinition":{
94
+ "uid":"45433E48B39F",
95
+ "environment":{
96
+ "uid":"5F5887BCF726"
97
+ },
98
+ "created":"2007-07-27 09:30:44.0",
99
+ "description":"",
100
+ "name":"amount",
101
+ "valueType":"DECIMAL",
102
+ "modified":"2007-07-27 09:30:44.0"
103
+ }
104
+ },
105
+ "perUnit":"L",
106
+ "uid":"905DAF5F5008",
107
+ "unit":"km",
108
+ "name":"Fuel Consumption",
109
+ "value":"0",
110
+ "path":"fuelConsumption",
111
+ "displayPath":"fuelConsumption",
112
+ "displayName":"Fuel Consumption"
113
+ },
114
+ {
115
+ "itemValueDefinition":{
116
+ "perUnit":"L",
117
+ "uid":"FBFB386F5FBB",
118
+ "unit":"km",
119
+ "name":"Own Fuel Consumption",
120
+ "path":"ownFuelConsumption",
121
+ "valueDefinition":{
122
+ "uid":"45433E48B39F",
123
+ "environment":{
124
+ "uid":"5F5887BCF726"
125
+ },
126
+ "created":"2007-07-27 09:30:44.0",
127
+ "description":"",
128
+ "name":"amount",
129
+ "valueType":"DECIMAL",
130
+ "modified":"2007-07-27 09:30:44.0"
131
+ }
132
+ },
133
+ "perUnit":"L",
134
+ "uid":"F3F38381BFD8",
135
+ "unit":"km",
136
+ "name":"Own Fuel Consumption",
137
+ "value":"0",
138
+ "path":"ownFuelConsumption",
139
+ "displayPath":"ownFuelConsumption",
140
+ "displayName":"Own Fuel Consumption"
141
+ }
142
+ ],
143
+ "dataCategory":{
144
+ "uid":"E13720699F84",
145
+ "name":"Generic",
146
+ "path":"generic"
147
+ },
148
+ "startDate":"2009-03-19T00:00:00Z",
149
+ "itemDefinition":{
150
+ "uid":"253122C933E1",
151
+ "name":"Motorcycle Generic",
152
+ "drillDown":"fuel, size"
153
+ },
154
+ "endDate":"",
155
+ "dataItem":{
156
+ "uid":"31449121F8B8",
157
+ "Label":"petrol, large"
158
+ },
159
+ "modified":"2009-03-19T17:38:50Z",
160
+ "amount":{
161
+ "unit":"kg/year",
162
+ "value":308.64
163
+ },
164
+ "environment":{
165
+ "uid":"5F5887BCF726",
166
+ "itemsPerFeed":10,
167
+ "description":"",
168
+ "name":"AMEE",
169
+ "owner":"",
170
+ "path":"",
171
+ "itemsPerPage":10
172
+ },
173
+ "created":"2009-03-19T17:38:50Z",
174
+ "name":"test1",
175
+ "profile":{
176
+ "uid":"155DD3C63646"
177
+ }
178
+ },
179
+ "path":"/transport/motorcycle/generic/D47C465B8157",
180
+ "actions":{
181
+ "allowCreate":true,
182
+ "allowView":true,
183
+ "allowList":true,
184
+ "allowModify":true,
185
+ "allowDelete":true
186
+ },
187
+ "profile":{
188
+ "uid":"155DD3C63646"
189
+ }
190
+ }
@@ -0,0 +1,190 @@
1
+ {
2
+ "apiVersion":"2.0",
3
+ "profileItem":{
4
+ "uid":"D47C465B8157",
5
+ "itemValues":[
6
+ {
7
+ "itemValueDefinition":{
8
+ "uid":"F3900EDAB5EB",
9
+ "name":"Country",
10
+ "path":"country",
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":"01D8AD934852",
25
+ "unit":"",
26
+ "name":"Country",
27
+ "value":"",
28
+ "path":"country",
29
+ "displayPath":"country",
30
+ "displayName":"Country"
31
+ },
32
+ {
33
+ "itemValueDefinition":{
34
+ "uid":"85DAD143CD22",
35
+ "name":"Occupants",
36
+ "path":"occupants",
37
+ "valueDefinition":{
38
+ "uid":"45433E48B39F",
39
+ "environment":{
40
+ "uid":"5F5887BCF726"
41
+ },
42
+ "created":"2007-07-27 09:30:44.0",
43
+ "description":"",
44
+ "name":"amount",
45
+ "valueType":"DECIMAL",
46
+ "modified":"2007-07-27 09:30:44.0"
47
+ }
48
+ },
49
+ "perUnit":"",
50
+ "uid":"FB45DF9BC8FC",
51
+ "unit":"",
52
+ "name":"Occupants",
53
+ "value":"-1",
54
+ "path":"occupants",
55
+ "displayPath":"occupants",
56
+ "displayName":"Occupants"
57
+ },
58
+ {
59
+ "itemValueDefinition":{
60
+ "perUnit":"year",
61
+ "uid":"5898B35AE183",
62
+ "unit":"km",
63
+ "name":"Distance",
64
+ "path":"distance",
65
+ "valueDefinition":{
66
+ "uid":"45433E48B39F",
67
+ "environment":{
68
+ "uid":"5F5887BCF726"
69
+ },
70
+ "created":"2007-07-27 09:30:44.0",
71
+ "description":"",
72
+ "name":"amount",
73
+ "valueType":"DECIMAL",
74
+ "modified":"2007-07-27 09:30:44.0"
75
+ }
76
+ },
77
+ "perUnit":"month",
78
+ "uid":"557784471D55",
79
+ "unit":"km",
80
+ "name":"Distance",
81
+ "value":"400",
82
+ "path":"distance",
83
+ "displayPath":"distance",
84
+ "displayName":"Distance"
85
+ },
86
+ {
87
+ "itemValueDefinition":{
88
+ "perUnit":"L",
89
+ "uid":"2538ABD1FFE7",
90
+ "unit":"km",
91
+ "name":"Fuel Consumption",
92
+ "path":"fuelConsumption",
93
+ "valueDefinition":{
94
+ "uid":"45433E48B39F",
95
+ "environment":{
96
+ "uid":"5F5887BCF726"
97
+ },
98
+ "created":"2007-07-27 09:30:44.0",
99
+ "description":"",
100
+ "name":"amount",
101
+ "valueType":"DECIMAL",
102
+ "modified":"2007-07-27 09:30:44.0"
103
+ }
104
+ },
105
+ "perUnit":"L",
106
+ "uid":"905DAF5F5008",
107
+ "unit":"km",
108
+ "name":"Fuel Consumption",
109
+ "value":"0",
110
+ "path":"fuelConsumption",
111
+ "displayPath":"fuelConsumption",
112
+ "displayName":"Fuel Consumption"
113
+ },
114
+ {
115
+ "itemValueDefinition":{
116
+ "perUnit":"L",
117
+ "uid":"FBFB386F5FBB",
118
+ "unit":"km",
119
+ "name":"Own Fuel Consumption",
120
+ "path":"ownFuelConsumption",
121
+ "valueDefinition":{
122
+ "uid":"45433E48B39F",
123
+ "environment":{
124
+ "uid":"5F5887BCF726"
125
+ },
126
+ "created":"2007-07-27 09:30:44.0",
127
+ "description":"",
128
+ "name":"amount",
129
+ "valueType":"DECIMAL",
130
+ "modified":"2007-07-27 09:30:44.0"
131
+ }
132
+ },
133
+ "perUnit":"L",
134
+ "uid":"F3F38381BFD8",
135
+ "unit":"km",
136
+ "name":"Own Fuel Consumption",
137
+ "value":"0",
138
+ "path":"ownFuelConsumption",
139
+ "displayPath":"ownFuelConsumption",
140
+ "displayName":"Own Fuel Consumption"
141
+ }
142
+ ],
143
+ "dataCategory":{
144
+ "uid":"E13720699F84",
145
+ "name":"Generic",
146
+ "path":"generic"
147
+ },
148
+ "startDate":"2009-03-19T00:00:00Z",
149
+ "itemDefinition":{
150
+ "uid":"253122C933E1",
151
+ "name":"Motorcycle Generic",
152
+ "drillDown":"fuel, size"
153
+ },
154
+ "endDate":"",
155
+ "dataItem":{
156
+ "uid":"31449121F8B8",
157
+ "Label":"petrol, large"
158
+ },
159
+ "modified":"2009-03-19T17:38:50Z",
160
+ "amount":{
161
+ "unit":"kg/year",
162
+ "value":308.64
163
+ },
164
+ "environment":{
165
+ "uid":"5F5887BCF726",
166
+ "itemsPerFeed":10,
167
+ "description":"",
168
+ "name":"AMEE",
169
+ "owner":"",
170
+ "path":"",
171
+ "itemsPerPage":10
172
+ },
173
+ "created":"2009-03-19T17:38:50Z",
174
+ "name":"test1",
175
+ "profile":{
176
+ "uid":"155DD3C63646"
177
+ }
178
+ },
179
+ "path":"/transport/motorcycle/generic/D47C465B8157",
180
+ "actions":{
181
+ "allowCreate":true,
182
+ "allowView":true,
183
+ "allowList":true,
184
+ "allowModify":true,
185
+ "allowDelete":true
186
+ },
187
+ "profile":{
188
+ "uid":"155DD3C63646"
189
+ }
190
+ }