hookercookerman-amee 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest.txt CHANGED
@@ -3,7 +3,7 @@ LICENSE.txt
3
3
  Manifest.txt
4
4
  README.rdoc
5
5
  Rakefile
6
- amee.gemspec
6
+ amee.gemspec.old
7
7
  features/config.feature
8
8
  features/data/data_category.feature
9
9
  features/data/data_item.feature
@@ -45,6 +45,7 @@ features/support/amee/profiles/155DD3C63646/transport/motorcycle/generic/D47C465
45
45
  features/support/amee/profiles/180D73DA5229/home.json
46
46
  features/support/amee/profiles/48B97680BCCF/home/energy/quantity/response.json
47
47
  features/support/amee/profiles/7C7D68C2A7CD/home.json
48
+ features/support/amee/profiles/BB1BDB4FDD77/home/energy/quantity/response.json
48
49
  features/support/amee/profiles/E0BCB3704D15.json
49
50
  features/support/amee/profiles/E0BCB3704D15/Business.json
50
51
  features/support/amee/profiles/F38ECBD56D59/home/energy/quantity/5891C88F29FA.json
data/amee.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{amee}
5
- s.version = '0.1.8'
5
+ s.version = '0.1.9'
6
6
 
7
7
  s.homepage = 'http://github.com/hookercookerman/amee/tree/master'
8
8
  s.description = %q{Its a gem to interact with the amee api}
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
14
14
 
15
15
  s.email = ["richard.hooker@dynamic50.com"]
16
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"]
17
+ s.files = ["History.txt", "LICENSE.txt", "Manifest.txt", "README.rdoc", "Rakefile", "amee.gemspec", "features/config.feature", "features/support/amee/profiles/BB1BDB4FDD77/home/energy/quantity/response.json", "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
18
  s.has_rdoc = true
19
19
  s.rdoc_options = ['--main', 'README.rdoc']
20
20
  s.rdoc_options << '--inline-source' << '--charset=UTF-8'
@@ -7,7 +7,11 @@ Feature: Create Amee Profile Item
7
7
  Given I have a valid amee session
8
8
 
9
9
  # representation=full&energyConsumption=10&energyConsumptionUnit=kWh&dataItemUid=66056991EE23&energyConsumptionPerUnit=month&name=representation
10
- When I create a profile item with uid: "48B97680BEGG" the path: "/profiles/48B97680BCCF/home/energy/quantity"
10
+ When I create a profile item with data_item_uid: "66056991EE23" the path: "/profiles/BB1BDB4FDD77/home/energy/quantity"
11
11
 
12
12
  # need to redo
13
- Then the profile item should have: "uid" with: "D47C465B8157"
13
+ Then the profile category should have: "total_co2_value" with: "24.660000"
14
+ And the profile category should have: "resource_path" with: "/home/energy/quantity"
15
+ And the profile category's profile_items should not be empty
16
+ And the profile category's profile_categories should be empty
17
+ And the profile category's data_category should not be nil
@@ -18,11 +18,11 @@ Then(/^the profile item's (\S+) should not (?:be|have) (?:an? )?(.*)/) do |metho
18
18
  @models["profile_item"].send(method).should_not send("be_#{predicate.gsub(' ', '_')}")
19
19
  end
20
20
 
21
- When(/^I create a profile item with uid: \"(\S+)\" the path: \"(.*)\"/) do |uid, path|
22
- FakeWeb.register_uri(:post, "http://stage.amee.com#{path}?type=dontmatter&dataItemUid=48B97680BEGG&representation=full",
23
- :file => File.join(AMEE_FIXTURE_PATH, "/profiles/155DD3C63646/transport/motorcycle/generic/D47C465B8157.json")
21
+ When(/^I create a profile item with data_item_uid: \"(\S+)\" the path: \"(.*)\"/) do |uid, path|
22
+ FakeWeb.register_uri(:post, "http://stage.amee.com#{path}?kWhPerMonth=10&dataItemUid=66056991EE23&representation=full",
23
+ :file => File.join(AMEE_FIXTURE_PATH, "/profiles/BB1BDB4FDD77/home/energy/quantity/response.json")
24
24
  )
25
- @models["profile_item"] = @amee_session.create_profile_item(path, uid, :fields => {:type => "dontmatter"})
25
+ @models["profile_category"] = @amee_session.create_profile_item(path, uid, :fields => {:kWhPerMonth => "10"})
26
26
  end
27
27
 
28
28
  When(/^I update the profile item with: distance=400$/) do
@@ -0,0 +1,361 @@
1
+ {
2
+ "apiVersion":"2.0",
3
+ "profileCategories":[],
4
+ "dataCategory":{
5
+ "uid":"A92693A99BAD",
6
+ "dataCategory":{
7
+ "uid":"30BA55A0C472",
8
+ "name":"Energy",
9
+ "path":"energy"
10
+ },
11
+ "environment":{
12
+ "uid":"5F5887BCF726",
13
+ "itemsPerFeed":10,
14
+ "description":"",
15
+ "name":"AMEE",
16
+ "owner":"",
17
+ "path":"",
18
+ "itemsPerPage":10
19
+ },
20
+ "created":"2007-07-27 09:30:44.0",
21
+ "name":"Quantity",
22
+ "path":"quantity",
23
+ "itemDefinition":{
24
+ "uid":"212C818D8F16",
25
+ "environment":{
26
+ "uid":"5F5887BCF726"
27
+ },
28
+ "created":"2007-07-27 09:30:44.0",
29
+ "name":"Energy Quantity",
30
+ "drillDown":"type",
31
+ "modified":"2007-07-27 09:30:44.0"
32
+ },
33
+ "modified":"2007-07-27 09:30:44.0"
34
+ },
35
+ "environment":{
36
+ "uid":"5F5887BCF726",
37
+ "itemsPerFeed":10,
38
+ "created":"2007-07-27 09:30:44.0",
39
+ "description":"",
40
+ "name":"AMEE",
41
+ "owner":"",
42
+ "path":"",
43
+ "itemsPerPage":10,
44
+ "modified":"2007-07-27 09:30:44.0"
45
+ },
46
+ "totalAmount":{
47
+ "unit":"kg/year",
48
+ "value":"24.660000"
49
+ },
50
+ "path":"/home/energy/quantity",
51
+ "profileItemActions":{
52
+ "allowCreate":true,
53
+ "allowView":true,
54
+ "allowList":true,
55
+ "allowModify":true,
56
+ "allowDelete":true
57
+ },
58
+ "actions":{
59
+ "allowCreate":true,
60
+ "allowView":true,
61
+ "allowList":true,
62
+ "allowModify":true,
63
+ "allowDelete":true
64
+ },
65
+ "profileItems":[
66
+ {
67
+ "amount":{
68
+ "unit":"kg/year",
69
+ "value":24.66
70
+ },
71
+ "uid":"68582CECB4E3",
72
+ "startDate":"2009-03-19T17:22:00Z",
73
+ "itemValues":[
74
+ {
75
+ "itemValueDefinition":{
76
+ "uid":"E0EFED6FD7E6",
77
+ "name":"Payment frequency",
78
+ "path":"paymentFrequency",
79
+ "valueDefinition":{
80
+ "uid":"CCEB59CACE1B",
81
+ "environment":{
82
+ "uid":"5F5887BCF726"
83
+ },
84
+ "created":"2007-07-27 09:30:44.0",
85
+ "description":"",
86
+ "name":"text",
87
+ "valueType":"TEXT",
88
+ "modified":"2007-07-27 09:30:44.0"
89
+ }
90
+ },
91
+ "perUnit":"",
92
+ "uid":"BBA06ECA7254",
93
+ "unit":"",
94
+ "name":"Payment frequency",
95
+ "value":"",
96
+ "path":"paymentFrequency",
97
+ "displayPath":"paymentFrequency",
98
+ "displayName":"Payment frequency"
99
+ },
100
+ {
101
+ "itemValueDefinition":{
102
+ "uid":"63005554AE8A",
103
+ "name":"Green tariff",
104
+ "path":"greenTariff",
105
+ "valueDefinition":{
106
+ "uid":"CCEB59CACE1B",
107
+ "environment":{
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":"5CF0E5A0CDB7",
119
+ "unit":"",
120
+ "name":"Green tariff",
121
+ "value":"",
122
+ "path":"greenTariff",
123
+ "displayPath":"greenTariff",
124
+ "displayName":"Green tariff"
125
+ },
126
+ {
127
+ "itemValueDefinition":{
128
+ "uid":"527AADFB3B65",
129
+ "name":"Season",
130
+ "path":"season",
131
+ "valueDefinition":{
132
+ "uid":"CCEB59CACE1B",
133
+ "environment":{
134
+ "uid":"5F5887BCF726"
135
+ },
136
+ "created":"2007-07-27 09:30:44.0",
137
+ "description":"",
138
+ "name":"text",
139
+ "valueType":"TEXT",
140
+ "modified":"2007-07-27 09:30:44.0"
141
+ }
142
+ },
143
+ "perUnit":"",
144
+ "uid":"2C8532649037",
145
+ "unit":"",
146
+ "name":"Season",
147
+ "value":"",
148
+ "path":"season",
149
+ "displayPath":"season",
150
+ "displayName":"Season"
151
+ },
152
+ {
153
+ "itemValueDefinition":{
154
+ "uid":"1740E500BDAB",
155
+ "choices":"true=true,
156
+ false=false",
157
+ "name":"Includes Heating",
158
+ "path":"includesHeating",
159
+ "valueDefinition":{
160
+ "uid":"CCEB59CACE1B",
161
+ "environment":{
162
+ "uid":"5F5887BCF726"
163
+ },
164
+ "created":"2007-07-27 09:30:44.0",
165
+ "description":"",
166
+ "name":"text",
167
+ "valueType":"TEXT",
168
+ "modified":"2007-07-27 09:30:44.0"
169
+ }
170
+ },
171
+ "perUnit":"",
172
+ "uid":"E048B8558FB5",
173
+ "unit":"",
174
+ "name":"Includes Heating",
175
+ "value":"false",
176
+ "path":"includesHeating",
177
+ "displayPath":"includesHeating",
178
+ "displayName":"Includes Heating"
179
+ },
180
+ {
181
+ "itemValueDefinition":{
182
+ "perUnit":"year",
183
+ "uid":"666C77B224B3",
184
+ "unit":"kg",
185
+ "name":"Mass Per Time",
186
+ "path":"massPerTime",
187
+ "valueDefinition":{
188
+ "uid":"45433E48B39F",
189
+ "environment":{
190
+ "uid":"5F5887BCF726"
191
+ },
192
+ "created":"2007-07-27 09:30:44.0",
193
+ "description":"",
194
+ "name":"amount",
195
+ "valueType":"DECIMAL",
196
+ "modified":"2007-07-27 09:30:44.0"
197
+ }
198
+ },
199
+ "perUnit":"year",
200
+ "uid":"1FFABB35FFC8",
201
+ "unit":"kg",
202
+ "name":"Mass Per Time",
203
+ "value":"0",
204
+ "path":"massPerTime",
205
+ "displayPath":"massPerTime",
206
+ "displayName":"Mass Per Time"
207
+ },
208
+ {
209
+ "itemValueDefinition":{
210
+ "perUnit":"year",
211
+ "uid":"BFD215C4CAB1",
212
+ "unit":"kWh",
213
+ "name":"Energy Consumption",
214
+ "path":"energyConsumption",
215
+ "valueDefinition":{
216
+ "uid":"45433E48B39F",
217
+ "environment":{
218
+ "uid":"5F5887BCF726"
219
+ },
220
+ "created":"2007-07-27 09:30:44.0",
221
+ "description":"",
222
+ "name":"amount",
223
+ "valueType":"DECIMAL",
224
+ "modified":"2007-07-27 09:30:44.0"
225
+ }
226
+ },
227
+ "perUnit":"month",
228
+ "uid":"E821A09B7FE4",
229
+ "unit":"kWh",
230
+ "name":"Energy Consumption",
231
+ "value":"10",
232
+ "path":"energyConsumption",
233
+ "displayPath":"energyConsumption",
234
+ "displayName":"Energy Consumption"
235
+ },
236
+ {
237
+ "itemValueDefinition":{
238
+ "perUnit":"year",
239
+ "uid":"A9B493A4A1A6",
240
+ "unit":"kWh",
241
+ "name":"Current Reading",
242
+ "path":"currentReading",
243
+ "valueDefinition":{
244
+ "uid":"45433E48B39F",
245
+ "environment":{
246
+ "uid":"5F5887BCF726"
247
+ },
248
+ "created":"2007-07-27 09:30:44.0",
249
+ "description":"",
250
+ "name":"amount",
251
+ "valueType":"DECIMAL",
252
+ "modified":"2007-07-27 09:30:44.0"
253
+ }
254
+ },
255
+ "perUnit":"year",
256
+ "uid":"8A9F0C4199BC",
257
+ "unit":"kWh",
258
+ "name":"Current Reading",
259
+ "value":"0",
260
+ "path":"currentReading",
261
+ "displayPath":"currentReading",
262
+ "displayName":"Current Reading"
263
+ },
264
+ {
265
+ "itemValueDefinition":{
266
+ "perUnit":"year",
267
+ "uid":"4C689DEF0A41",
268
+ "unit":"kWh",
269
+ "name":"Last Reading",
270
+ "path":"lastReading",
271
+ "valueDefinition":{
272
+ "uid":"45433E48B39F",
273
+ "environment":{
274
+ "uid":"5F5887BCF726"
275
+ },
276
+ "created":"2007-07-27 09:30:44.0",
277
+ "description":"",
278
+ "name":"amount",
279
+ "valueType":"DECIMAL",
280
+ "modified":"2007-07-27 09:30:44.0"
281
+ }
282
+ },
283
+ "perUnit":"year",
284
+ "uid":"72C4C271906B",
285
+ "unit":"kWh",
286
+ "name":"Last Reading",
287
+ "value":"0",
288
+ "path":"lastReading",
289
+ "displayPath":"lastReading",
290
+ "displayName":"Last Reading"
291
+ },
292
+ {
293
+ "itemValueDefinition":{
294
+ "perUnit":"year",
295
+ "uid":"7BBABF4C2E9E",
296
+ "unit":"L",
297
+ "name":"Volume Per Time",
298
+ "path":"volumePerTime",
299
+ "valueDefinition":{
300
+ "uid":"45433E48B39F",
301
+ "environment":{
302
+ "uid":"5F5887BCF726"
303
+ },
304
+ "created":"2007-07-27 09:30:44.0",
305
+ "description":"",
306
+ "name":"amount",
307
+ "valueType":"DECIMAL",
308
+ "modified":"2007-07-27 09:30:44.0"
309
+ }
310
+ },
311
+ "perUnit":"year",
312
+ "uid":"0B32AB913D31",
313
+ "unit":"L",
314
+ "name":"Volume Per Time",
315
+ "value":"0",
316
+ "path":"volumePerTime",
317
+ "displayPath":"volumePerTime",
318
+ "displayName":"Volume Per Time"
319
+ },
320
+ {
321
+ "itemValueDefinition":{
322
+ "perUnit":"year",
323
+ "uid":"F0ED40C7EF8F",
324
+ "name":"Number of deliveries",
325
+ "path":"deliveries",
326
+ "valueDefinition":{
327
+ "uid":"45433E48B39F",
328
+ "environment":{
329
+ "uid":"5F5887BCF726"
330
+ },
331
+ "created":"2007-07-27 09:30:44.0",
332
+ "description":"",
333
+ "name":"amount",
334
+ "valueType":"DECIMAL",
335
+ "modified":"2007-07-27 09:30:44.0"
336
+ }
337
+ },
338
+ "perUnit":"year",
339
+ "uid":"67F41DBE5315",
340
+ "unit":"",
341
+ "name":"Number of deliveries",
342
+ "value":"",
343
+ "path":"deliveries",
344
+ "displayPath":"deliveries",
345
+ "displayName":"Number of deliveries"
346
+ }
347
+ ],
348
+ "created":"2009-03-19T17:22:09Z",
349
+ "name":"representation",
350
+ "endDate":"",
351
+ "dataItem":{
352
+ "uid":"66056991EE23",
353
+ "Label":"gas"
354
+ },
355
+ "modified":"2009-03-19T17:22:09Z"
356
+ }
357
+ ],
358
+ "profile":{
359
+ "uid":"48B97680BCCF"
360
+ }
361
+ }
data/lib/amee/parser.rb CHANGED
@@ -99,7 +99,7 @@ module Amee
99
99
 
100
100
  class CreateProfileItem < Parser
101
101
  def self.process(data)
102
- data["profileItem"].merge({"resource_path" => data["path"]})
102
+ data.merge({"resource_path" => data["path"]})
103
103
  end
104
104
  end
105
105
 
@@ -16,7 +16,7 @@ module Amee
16
16
 
17
17
  def create_profile_item(path_or_category, data_item_uid, params = {})
18
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)
19
+ session.create_profile_item(path, data_item_uid, params)
20
20
  end
21
21
 
22
22
  def get_profile_item(path, options = {})
@@ -14,6 +14,8 @@ module Amee
14
14
  :item_definition => {:class => Amee::DataApi::ItemDefinition}
15
15
 
16
16
 
17
+ # @todo This currently will not work as profile data_item brings back a profile_category
18
+ # How stupid is that!
17
19
  def self.create(session, path, data_item_uid, fields ={})
18
20
  hash = session.create_profile_item(path, data_item_uid, {:fields => fields, :hash_response => true})
19
21
  self.from_hash(hash, session)
data/lib/amee/session.rb CHANGED
@@ -155,13 +155,15 @@ module Amee
155
155
  end
156
156
  end
157
157
 
158
- # @return [String] locaion of the new resource
158
+ # @return [Amee::ProfileApi::ProfileCategory]
159
159
  def create_profile_item(path, uid, options = {})
160
160
  @cache.clear
161
- api_call(:post, "profile_item", path,
161
+ api_call(:post, "create.profile_item", path,
162
162
  :query => {:dataItemUid => uid, :representation => "full"}.merge(options[:fields])) do |response|
163
163
  return response if options[:hash_response]
164
- Amee::ProfileApi::ProfileItem.from_hash(response, self)
164
+ Amee::ProfileApi::ProfileCategory.from_hash(response, self) do |profile_category|
165
+ profile_category.lazy_loaded = true
166
+ end
165
167
  end
166
168
  end
167
169
 
data/lib/amee.rb CHANGED
@@ -36,5 +36,5 @@ require "amee/profile_api/profile_category"
36
36
  require "amee/profile_api/profile"
37
37
 
38
38
  module Amee
39
- VERSION = '0.1.8'
39
+ VERSION = '0.1.9'
40
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.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Hooker
@@ -92,6 +92,7 @@ files:
92
92
  - Rakefile
93
93
  - amee.gemspec
94
94
  - features/config.feature
95
+ - features/support/amee/profiles/BB1BDB4FDD77/home/energy/quantity/response.json
95
96
  - features/data/data_category.feature
96
97
  - features/data/data_item.feature
97
98
  - features/data/data_item_value.feature