amee 4.1.4 → 4.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/amee.gemspec +2 -2
- data/lib/amee/profile_item.rb +1 -0
- data/spec/profile_item_spec.rb +11 -3
- metadata +4 -4
data/amee.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{amee}
|
8
|
-
s.version = "4.1.
|
8
|
+
s.version = "4.1.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["James Smith", "James Hetherington", "Andrew Hill", "Andrew Berkeley"]
|
12
|
-
s.date = %q{2011-10-
|
12
|
+
s.date = %q{2011-10-11}
|
13
13
|
s.default_executable = %q{ameesh}
|
14
14
|
s.email = %q{james@floppy.org.uk}
|
15
15
|
s.executables = ["ameesh"]
|
data/lib/amee/profile_item.rb
CHANGED
@@ -390,6 +390,7 @@ module AMEE
|
|
390
390
|
if options[:duration] && connection.version >= 2
|
391
391
|
options[:duration] = "PT#{options[:duration] * 86400}S"
|
392
392
|
end
|
393
|
+
options.merge!(:representation => 'full') if (connection.version >= 2) && (get_item == true)
|
393
394
|
# Go
|
394
395
|
response = connection.put(path, options)
|
395
396
|
if get_item
|
data/spec/profile_item_spec.rb
CHANGED
@@ -438,17 +438,25 @@ describe AMEE::Profile::Item, "should be able to update profile items (v2 behavi
|
|
438
438
|
connection.should_receive(:version).and_return(2.0)
|
439
439
|
connection.should_receive(:get).with("/profiles/92C8DB30F46B/home/energy/quantity/6E9B1517D753", {}).and_return(flexmock(:body => '<?xml version="1.0" encoding="UTF-8"?><Resources><ProfileItemResource><ProfileItem created="2008-09-12 17:20:32.0" modified="2008-09-12 17:20:32.0" uid="6E9B1517D753"><Name>6E9B1517D753</Name><ItemValues><ItemValue uid="0A671BF3D593"><Path>kgPerMonth</Path><Name>kg Per Month</Name><Value>10</Value><ItemValueDefinition uid="51D072825D41"><Path>kgPerMonth</Path><Name>kg Per Month</Name><FromProfile>true</FromProfile><FromData>false</FromData><ValueDefinition uid="36A771FC1D1A"><Name>kg</Name><ValueType>DOUBLE</ValueType></ValueDefinition></ItemValueDefinition></ItemValue><ItemValue uid="0E4CF565A5AB"><Path>kWhPerMonth</Path><Name>kWh Per Month</Name><Value>0</Value><ItemValueDefinition uid="4DF458FD0E4D"><Path>kWhPerMonth</Path><Name>kWh Per Month</Name><FromProfile>true</FromProfile><FromData>false</FromData><ValueDefinition uid="26A5C97D3728"><Name>kWh</Name><ValueType>DOUBLE</ValueType></ValueDefinition></ItemValueDefinition></ItemValue><ItemValue uid="D58700708731"><Path>litresPerMonth</Path><Name>Litres Per Month</Name><Value>0</Value><ItemValueDefinition uid="C9B7E19269A5"><Path>litresPerMonth</Path><Name>Litres Per Month</Name><FromProfile>true</FromProfile><FromData>false</FromData><ValueDefinition uid="06B8CFC5A521"><Name>litre</Name><ValueType>DOUBLE</ValueType></ValueDefinition></ItemValueDefinition></ItemValue><ItemValue uid="BD1267F2D001"><Path>kWhReadingCurrent</Path><Name>kWh reading current</Name><Value>0</Value><ItemValueDefinition uid="8A468E75C8E8"><Path>kWhReadingCurrent</Path><Name>kWh reading current</Name><FromProfile>true</FromProfile><FromData>false</FromData><ValueDefinition uid="45433E48B39F"><Name>amount</Name><ValueType>DOUBLE</ValueType></ValueDefinition></ItemValueDefinition></ItemValue><ItemValue uid="B199A908A259"><Path>kWhReadingLast</Path><Name>kWh reading last</Name><Value>0</Value><ItemValueDefinition uid="2328DC7F23AE"><Path>kWhReadingLast</Path><Name>kWh reading last</Name><FromProfile>true</FromProfile><FromData>false</FromData><ValueDefinition uid="45433E48B39F"><Name>amount</Name><ValueType>DOUBLE</ValueType></ValueDefinition></ItemValueDefinition></ItemValue></ItemValues><Environment uid="5F5887BCF726"/><ItemDefinition uid="212C818D8F16"/><DataCategory uid="A92693A99BAD"><Name>Quantity</Name><Path>quantity</Path></DataCategory><AmountPerMonth>25.200</AmountPerMonth><ValidFrom>20080901</ValidFrom><End>false</End><DataItem uid="A70149AF0F26"/><Profile uid="92C8DB30F46B"/></ProfileItem><Path>/home/energy/quantity/6E9B1517D753</Path><Profile uid="92C8DB30F46B"/></ProfileItemResource></Resources>'))
|
440
440
|
connection.should_receive(:put).with("/profiles/92C8DB30F46B/home/energy/quantity/6E9B1517D753", {}).and_return(flexmock(:body => ''))
|
441
|
-
|
441
|
+
|
442
442
|
item = AMEE::Profile::Item.get(connection, "/profiles/92C8DB30F46B/home/energy/quantity/6E9B1517D753")
|
443
|
-
item.update()
|
443
|
+
item.update(:get_item => false)
|
444
444
|
end
|
445
445
|
|
446
446
|
it "without having an existing item" do
|
447
|
+
connection = flexmock "connection"
|
448
|
+
connection.should_receive(:version).and_return(2.0)
|
449
|
+
connection.should_receive(:put).with("/profiles/92C8DB30F46B/home/energy/quantity/6E9B1517D753", {:representation => "full"}).and_return(flexmock(:body => '<?xml version="1.0" encoding="UTF-8"?><Resources><ProfileItemResource><ProfileItem created="2008-09-12 17:20:32.0" modified="2008-09-12 17:20:32.0" uid="6E9B1517D753"><Name>6E9B1517D753</Name><ItemValues><ItemValue uid="0A671BF3D593"><Path>kgPerMonth</Path><Name>kg Per Month</Name><Value>10</Value><ItemValueDefinition uid="51D072825D41"><Path>kgPerMonth</Path><Name>kg Per Month</Name><FromProfile>true</FromProfile><FromData>false</FromData><ValueDefinition uid="36A771FC1D1A"><Name>kg</Name><ValueType>DOUBLE</ValueType></ValueDefinition></ItemValueDefinition></ItemValue><ItemValue uid="0E4CF565A5AB"><Path>kWhPerMonth</Path><Name>kWh Per Month</Name><Value>0</Value><ItemValueDefinition uid="4DF458FD0E4D"><Path>kWhPerMonth</Path><Name>kWh Per Month</Name><FromProfile>true</FromProfile><FromData>false</FromData><ValueDefinition uid="26A5C97D3728"><Name>kWh</Name><ValueType>DOUBLE</ValueType></ValueDefinition></ItemValueDefinition></ItemValue><ItemValue uid="D58700708731"><Path>litresPerMonth</Path><Name>Litres Per Month</Name><Value>0</Value><ItemValueDefinition uid="C9B7E19269A5"><Path>litresPerMonth</Path><Name>Litres Per Month</Name><FromProfile>true</FromProfile><FromData>false</FromData><ValueDefinition uid="06B8CFC5A521"><Name>litre</Name><ValueType>DOUBLE</ValueType></ValueDefinition></ItemValueDefinition></ItemValue><ItemValue uid="BD1267F2D001"><Path>kWhReadingCurrent</Path><Name>kWh reading current</Name><Value>0</Value><ItemValueDefinition uid="8A468E75C8E8"><Path>kWhReadingCurrent</Path><Name>kWh reading current</Name><FromProfile>true</FromProfile><FromData>false</FromData><ValueDefinition uid="45433E48B39F"><Name>amount</Name><ValueType>DOUBLE</ValueType></ValueDefinition></ItemValueDefinition></ItemValue><ItemValue uid="B199A908A259"><Path>kWhReadingLast</Path><Name>kWh reading last</Name><Value>0</Value><ItemValueDefinition uid="2328DC7F23AE"><Path>kWhReadingLast</Path><Name>kWh reading last</Name><FromProfile>true</FromProfile><FromData>false</FromData><ValueDefinition uid="45433E48B39F"><Name>amount</Name><ValueType>DOUBLE</ValueType></ValueDefinition></ItemValueDefinition></ItemValue></ItemValues><Environment uid="5F5887BCF726"/><ItemDefinition uid="212C818D8F16"/><DataCategory uid="A92693A99BAD"><Name>Quantity</Name><Path>quantity</Path></DataCategory><AmountPerMonth>25.200</AmountPerMonth><ValidFrom>20080901</ValidFrom><End>false</End><DataItem uid="A70149AF0F26"/><Profile uid="92C8DB30F46B"/></ProfileItem><Path>/home/energy/quantity/6E9B1517D753</Path><Profile uid="92C8DB30F46B"/></ProfileItemResource></Resources>'))
|
450
|
+
|
451
|
+
AMEE::Profile::Item.update(connection, "/profiles/92C8DB30F46B/home/energy/quantity/6E9B1517D753")
|
452
|
+
end
|
453
|
+
|
454
|
+
it "without having an existing item and without getting the result back" do
|
447
455
|
connection = flexmock "connection"
|
448
456
|
connection.should_receive(:version).and_return(2.0)
|
449
457
|
connection.should_receive(:put).with("/profiles/92C8DB30F46B/home/energy/quantity/6E9B1517D753", {}).and_return(flexmock(:body => ''))
|
450
458
|
connection.should_receive(:get).with("/profiles/92C8DB30F46B/home/energy/quantity/6E9B1517D753", {}).and_return(flexmock(:body => '<?xml version="1.0" encoding="UTF-8"?><Resources><ProfileItemResource><ProfileItem created="2008-09-12 17:20:32.0" modified="2008-09-12 17:20:32.0" uid="6E9B1517D753"><Name>6E9B1517D753</Name><ItemValues><ItemValue uid="0A671BF3D593"><Path>kgPerMonth</Path><Name>kg Per Month</Name><Value>10</Value><ItemValueDefinition uid="51D072825D41"><Path>kgPerMonth</Path><Name>kg Per Month</Name><FromProfile>true</FromProfile><FromData>false</FromData><ValueDefinition uid="36A771FC1D1A"><Name>kg</Name><ValueType>DOUBLE</ValueType></ValueDefinition></ItemValueDefinition></ItemValue><ItemValue uid="0E4CF565A5AB"><Path>kWhPerMonth</Path><Name>kWh Per Month</Name><Value>0</Value><ItemValueDefinition uid="4DF458FD0E4D"><Path>kWhPerMonth</Path><Name>kWh Per Month</Name><FromProfile>true</FromProfile><FromData>false</FromData><ValueDefinition uid="26A5C97D3728"><Name>kWh</Name><ValueType>DOUBLE</ValueType></ValueDefinition></ItemValueDefinition></ItemValue><ItemValue uid="D58700708731"><Path>litresPerMonth</Path><Name>Litres Per Month</Name><Value>0</Value><ItemValueDefinition uid="C9B7E19269A5"><Path>litresPerMonth</Path><Name>Litres Per Month</Name><FromProfile>true</FromProfile><FromData>false</FromData><ValueDefinition uid="06B8CFC5A521"><Name>litre</Name><ValueType>DOUBLE</ValueType></ValueDefinition></ItemValueDefinition></ItemValue><ItemValue uid="BD1267F2D001"><Path>kWhReadingCurrent</Path><Name>kWh reading current</Name><Value>0</Value><ItemValueDefinition uid="8A468E75C8E8"><Path>kWhReadingCurrent</Path><Name>kWh reading current</Name><FromProfile>true</FromProfile><FromData>false</FromData><ValueDefinition uid="45433E48B39F"><Name>amount</Name><ValueType>DOUBLE</ValueType></ValueDefinition></ItemValueDefinition></ItemValue><ItemValue uid="B199A908A259"><Path>kWhReadingLast</Path><Name>kWh reading last</Name><Value>0</Value><ItemValueDefinition uid="2328DC7F23AE"><Path>kWhReadingLast</Path><Name>kWh reading last</Name><FromProfile>true</FromProfile><FromData>false</FromData><ValueDefinition uid="45433E48B39F"><Name>amount</Name><ValueType>DOUBLE</ValueType></ValueDefinition></ItemValueDefinition></ItemValue></ItemValues><Environment uid="5F5887BCF726"/><ItemDefinition uid="212C818D8F16"/><DataCategory uid="A92693A99BAD"><Name>Quantity</Name><Path>quantity</Path></DataCategory><AmountPerMonth>25.200</AmountPerMonth><ValidFrom>20080901</ValidFrom><End>false</End><DataItem uid="A70149AF0F26"/><Profile uid="92C8DB30F46B"/></ProfileItem><Path>/home/energy/quantity/6E9B1517D753</Path><Profile uid="92C8DB30F46B"/></ProfileItemResource></Resources>'))
|
451
|
-
AMEE::Profile::Item.update(connection, "/profiles/92C8DB30F46B/home/energy/quantity/6E9B1517D753")
|
459
|
+
AMEE::Profile::Item.update(connection, "/profiles/92C8DB30F46B/home/energy/quantity/6E9B1517D753", :get_item => false)
|
452
460
|
end
|
453
461
|
|
454
462
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 49
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 4
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 4.1.
|
9
|
+
- 5
|
10
|
+
version: 4.1.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- James Smith
|
@@ -18,7 +18,7 @@ autorequire:
|
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
20
|
|
21
|
-
date: 2011-10-
|
21
|
+
date: 2011-10-11 00:00:00 +01:00
|
22
22
|
default_executable: ameesh
|
23
23
|
dependencies:
|
24
24
|
- !ruby/object:Gem::Dependency
|