amee 3.2.1 → 4.0.0
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.
- data/CHANGELOG.txt +1 -24
- data/Gemfile +7 -8
- data/Gemfile.lock +33 -14
- data/README.txt +33 -15
- data/Rakefile +15 -29
- data/VERSION +1 -1
- data/amee.gemspec +21 -24
- data/lib/amee.rb +11 -0
- data/lib/amee/connection.rb +1 -1
- data/lib/amee/logger.rb +10 -5
- data/lib/amee/rails.rb +12 -16
- data/lib/amee/v3.rb +2 -0
- data/lib/amee/v3/collection.rb +4 -6
- data/lib/amee/v3/connection.rb +0 -5
- data/lib/amee/v3/item_definition.rb +12 -19
- data/lib/amee/v3/item_value_definition.rb +6 -7
- data/lib/amee/v3/item_value_definition_list.rb +3 -3
- data/lib/amee/v3/return_value_definition.rb +4 -4
- data/spec/amee_spec.rb +1 -1
- data/spec/cache_spec.rb +1 -1
- data/spec/connection_spec.rb +1 -1
- data/spec/data_category_spec.rb +4 -4
- data/spec/data_item_spec.rb +5 -5
- data/spec/data_item_value_history_spec.rb +1 -1
- data/spec/data_item_value_spec.rb +1 -1
- data/spec/data_object_spec.rb +1 -1
- data/spec/drill_down_spec.rb +1 -1
- data/spec/fixtures/itemdef.xml +1 -6
- data/spec/fixtures/itemdef_441BF4BEA15B.xml +12 -20
- data/spec/item_definition_spec.rb +7 -7
- data/spec/item_value_definition_spec.rb +9 -9
- data/spec/logger_spec.rb +1 -1
- data/spec/object_spec.rb +1 -1
- data/spec/parse_helper_spec.rb +1 -1
- data/spec/profile_category_spec.rb +19 -19
- data/spec/profile_item_spec.rb +16 -16
- data/spec/profile_item_value_spec.rb +1 -1
- data/spec/profile_object_spec.rb +1 -1
- data/spec/profile_spec.rb +1 -1
- data/spec/rails_spec.rb +1 -6
- data/spec/spec_helper.rb +3 -4
- data/spec/user_spec.rb +7 -7
- data/spec/v3/connection_spec.rb +11 -11
- data/spec/v3/item_definition_spec.rb +13 -15
- data/spec/v3/item_value_definition_spec.rb +6 -6
- data/spec/v3/return_value_definition_spec.rb +10 -9
- metadata +87 -79
- data/init.rb +0 -4
- data/lib/amee/config.rb +0 -37
- data/lib/amee/core-extensions/hash.rb +0 -43
- data/rails/init.rb +0 -18
- data/spec/fixtures/rails_config.yml +0 -13
- data/spec/spec_amee_config.rb +0 -46
data/spec/rails_spec.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Copyright (C) 2008-2011 AMEE UK Ltd. - http://www.amee.com
|
2
2
|
# Released as Open Source Software under the BSD 3-Clause license. See LICENSE.txt for details.
|
3
3
|
|
4
|
-
require
|
4
|
+
require 'spec_helper.rb'
|
5
5
|
require 'amee/rails'
|
6
6
|
require 'active_record'
|
7
7
|
|
@@ -33,11 +33,6 @@ describe AMEE::Rails do
|
|
33
33
|
@test.klass.method_defined?(:amee_create).should be_true
|
34
34
|
end
|
35
35
|
|
36
|
-
it "should have save_with_amee and save_without_amee functions" do
|
37
|
-
@test.klass.method_defined?(:save_with_amee).should be_true
|
38
|
-
@test.klass.method_defined?(:save_without_amee).should be_true
|
39
|
-
end
|
40
|
-
|
41
36
|
it "should have an amee_save function" do
|
42
37
|
@test.klass.method_defined?(:amee_save).should be_true
|
43
38
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -2,14 +2,13 @@
|
|
2
2
|
# Released as Open Source Software under the BSD 3-Clause license. See LICENSE.txt for details.
|
3
3
|
|
4
4
|
require 'rubygems'
|
5
|
-
require '
|
6
|
-
require '
|
7
|
-
require 'activesupport'
|
5
|
+
require 'rspec'
|
6
|
+
require 'logger'
|
8
7
|
|
9
8
|
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
10
9
|
require 'amee'
|
11
10
|
|
12
|
-
|
11
|
+
RSpec.configure do |config|
|
13
12
|
config.mock_with :flexmock
|
14
13
|
end
|
15
14
|
|
data/spec/user_spec.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Copyright (C) 2008-2011 AMEE UK Ltd. - http://www.amee.com
|
2
2
|
# Released as Open Source Software under the BSD 3-Clause license. See LICENSE.txt for details.
|
3
3
|
|
4
|
-
require
|
4
|
+
require 'spec_helper.rb'
|
5
5
|
|
6
6
|
describe AMEE::Admin::User do
|
7
7
|
|
@@ -89,7 +89,7 @@ describe AMEE::Admin::User, "with an authenticated connection with environment"
|
|
89
89
|
@data.username.should == @options[:username]
|
90
90
|
@data.name.should == @options[:name]
|
91
91
|
@data.email.should == @options[:email]
|
92
|
-
@data.api_version.should
|
92
|
+
@data.api_version.should be_within(1.0e-09).of(@options[:apiVersion])
|
93
93
|
@data.status.should == "ACTIVE"
|
94
94
|
end
|
95
95
|
|
@@ -103,7 +103,7 @@ describe AMEE::Admin::User, "with an authenticated connection with environment"
|
|
103
103
|
@data.username.should == @options[:username]
|
104
104
|
@data.name.should == @options[:name]
|
105
105
|
@data.email.should == @options[:email]
|
106
|
-
@data.api_version.should
|
106
|
+
@data.api_version.should be_within(1.0e-09).of(@options[:apiVersion])
|
107
107
|
@data.status.should == "ACTIVE"
|
108
108
|
end
|
109
109
|
|
@@ -138,7 +138,7 @@ describe AMEE::Admin::User, "with an authenticated connection with environment"
|
|
138
138
|
@new_data.username.should == @new_options[:username]
|
139
139
|
@new_data.name.should == @new_options[:name]
|
140
140
|
@new_data.email.should == @new_options[:email]
|
141
|
-
@new_data.api_version.should
|
141
|
+
@new_data.api_version.should be_within(1.0e-09).of(@new_options[:APIVersion])
|
142
142
|
end
|
143
143
|
|
144
144
|
it "can delete an existing user" do
|
@@ -189,7 +189,7 @@ describe AMEE::Admin::User, "with an authenticated connection without environmen
|
|
189
189
|
@data.username.should == @options[:username]
|
190
190
|
@data.name.should == @options[:name]
|
191
191
|
@data.email.should == @options[:email]
|
192
|
-
@data.api_version.should
|
192
|
+
@data.api_version.should be_within(1.0e-09).of(@options[:apiVersion])
|
193
193
|
@data.status.should == "ACTIVE"
|
194
194
|
end
|
195
195
|
|
@@ -203,7 +203,7 @@ describe AMEE::Admin::User, "with an authenticated connection without environmen
|
|
203
203
|
@data.username.should == @options[:username]
|
204
204
|
@data.name.should == @options[:name]
|
205
205
|
@data.email.should == @options[:email]
|
206
|
-
@data.api_version.should
|
206
|
+
@data.api_version.should be_within(1.0e-09).of(@options[:apiVersion])
|
207
207
|
@data.status.should == "ACTIVE"
|
208
208
|
end
|
209
209
|
|
@@ -238,7 +238,7 @@ describe AMEE::Admin::User, "with an authenticated connection without environmen
|
|
238
238
|
@new_data.username.should == @new_options[:username]
|
239
239
|
@new_data.name.should == @new_options[:name]
|
240
240
|
@new_data.email.should == @new_options[:email]
|
241
|
-
@new_data.api_version.should
|
241
|
+
@new_data.api_version.should be_within(1.0e-09).of(@new_options[:APIVersion])
|
242
242
|
end
|
243
243
|
|
244
244
|
it "can delete an existing user" do
|
data/spec/v3/connection_spec.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Copyright (C) 2008-2011 AMEE UK Ltd. - http://www.amee.com
|
2
2
|
# Released as Open Source Software under the BSD 3-Clause license. See LICENSE.txt for details.
|
3
3
|
|
4
|
-
require
|
4
|
+
require 'spec_helper.rb'
|
5
5
|
|
6
6
|
describe AMEE::Connection do
|
7
7
|
|
@@ -26,7 +26,7 @@ describe AMEE::Connection do
|
|
26
26
|
mock.should_receive(:finish => nil)
|
27
27
|
mock
|
28
28
|
}
|
29
|
-
@c.v3_get("/#{
|
29
|
+
@c.v3_get("/#{AMEE_API_VERSION}/categories/SomeCategory").should == "OK"
|
30
30
|
end
|
31
31
|
|
32
32
|
it "should be able to get from meta server" do
|
@@ -35,7 +35,7 @@ describe AMEE::Connection do
|
|
35
35
|
mock.should_receive(:request).and_return(flexmock(:code => '200', :body => "OK"))
|
36
36
|
mock.should_receive(:finish => nil)
|
37
37
|
end
|
38
|
-
@c.v3_get("/#{
|
38
|
+
@c.v3_get("/#{AMEE_API_VERSION}/categories/SomeCategory").should == "OK"
|
39
39
|
end
|
40
40
|
|
41
41
|
it "should be able to handle failed gets from meta server" do
|
@@ -45,8 +45,8 @@ describe AMEE::Connection do
|
|
45
45
|
mock.should_receive(:finish => nil)
|
46
46
|
end
|
47
47
|
lambda {
|
48
|
-
@c.v3_get("/#{
|
49
|
-
}.should raise_error(AMEE::NotFound, "The URL was not found on the server.\nRequest: GET /#{
|
48
|
+
@c.v3_get("/#{AMEE_API_VERSION}/categories/SomeCategory").should == nil
|
49
|
+
}.should raise_error(AMEE::NotFound, "The URL was not found on the server.\nRequest: GET /#{AMEE_API_VERSION}/categories/SomeCategory")
|
50
50
|
end
|
51
51
|
|
52
52
|
it "should be able to post to meta server" do
|
@@ -55,7 +55,7 @@ describe AMEE::Connection do
|
|
55
55
|
mock.should_receive(:request).and_return(flexmock(:code => '200', :body => "OK"))
|
56
56
|
mock.should_receive(:finish => nil)
|
57
57
|
end
|
58
|
-
@c.v3_put("/#{
|
58
|
+
@c.v3_put("/#{AMEE_API_VERSION}/categories/SomeCategory", {:arg => "test"}).should == "OK"
|
59
59
|
end
|
60
60
|
|
61
61
|
it "should be able to handle failed gets from meta server" do
|
@@ -65,7 +65,7 @@ describe AMEE::Connection do
|
|
65
65
|
mock.should_receive(:finish => nil)
|
66
66
|
end
|
67
67
|
lambda {
|
68
|
-
@c.v3_put("/#{
|
68
|
+
@c.v3_put("/#{AMEE_API_VERSION}/categories/SomeCategory", {:arg => "test"}).should == "OK"
|
69
69
|
}.should raise_error
|
70
70
|
end
|
71
71
|
|
@@ -120,7 +120,7 @@ describe AMEE::Connection, "with retry enabled" do
|
|
120
120
|
mock.should_receive(:finish => nil)
|
121
121
|
end
|
122
122
|
lambda {
|
123
|
-
@c.v3_get("/#{
|
123
|
+
@c.v3_get("/#{AMEE_API_VERSION}/categories/SomeCategory")
|
124
124
|
}.should_not raise_error
|
125
125
|
end
|
126
126
|
|
@@ -131,7 +131,7 @@ describe AMEE::Connection, "with retry enabled" do
|
|
131
131
|
mock.should_receive(:finish => nil)
|
132
132
|
end
|
133
133
|
lambda {
|
134
|
-
@c.v3_get("/#{
|
134
|
+
@c.v3_get("/#{AMEE_API_VERSION}/categories/SomeCategory")
|
135
135
|
}.should raise_error(e)
|
136
136
|
end
|
137
137
|
end
|
@@ -150,7 +150,7 @@ describe AMEE::Connection, "with retry enabled" do
|
|
150
150
|
mock.should_receive(:finish => nil)
|
151
151
|
end
|
152
152
|
lambda {
|
153
|
-
@c.v3_get("/#{
|
153
|
+
@c.v3_get("/#{AMEE_API_VERSION}/categories/SomeCategory")
|
154
154
|
}.should_not raise_error
|
155
155
|
end
|
156
156
|
|
@@ -161,7 +161,7 @@ describe AMEE::Connection, "with retry enabled" do
|
|
161
161
|
mock.should_receive(:finish => nil)
|
162
162
|
end
|
163
163
|
lambda {
|
164
|
-
@c.v3_get("/#{
|
164
|
+
@c.v3_get("/#{AMEE_API_VERSION}/categories/SomeCategory")
|
165
165
|
}.should raise_error(AMEE::ConnectionFailed)
|
166
166
|
end
|
167
167
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Copyright (C) 2008-2011 AMEE UK Ltd. - http://www.amee.com
|
2
2
|
# Released as Open Source Software under the BSD 3-Clause license. See LICENSE.txt for details.
|
3
3
|
|
4
|
-
require
|
4
|
+
require 'spec_helper.rb'
|
5
5
|
|
6
6
|
describe AMEE::Admin::ItemDefinition do
|
7
7
|
|
@@ -19,7 +19,7 @@ describe AMEE::Admin::ItemDefinition, "with an authenticated v3 connection" do
|
|
19
19
|
|
20
20
|
it "should parse XML correctly" do
|
21
21
|
connection = flexmock "connection"
|
22
|
-
connection.should_receive(:v3_get).with("/#{
|
22
|
+
connection.should_receive(:v3_get).with("/#{AMEE_API_VERSION}/definitions/472D78F6584E;full", {}).and_return(fixture('itemdef.xml'))
|
23
23
|
@data = AMEE::Admin::ItemDefinition.load(connection,"472D78F6584E")
|
24
24
|
@data.uid.should == "472D78F6584E"
|
25
25
|
@data.created.should == DateTime.new(2009,8,31,12,41,18)
|
@@ -27,29 +27,27 @@ describe AMEE::Admin::ItemDefinition, "with an authenticated v3 connection" do
|
|
27
27
|
@data.name.should == "Power Stations And Stuff"
|
28
28
|
@data.drill_downs.should == %w{state county metroArea city zipCode plantName powWowWow}
|
29
29
|
@data.usages.should == ['usageOne', 'usageThree', 'usageOther']
|
30
|
-
@data.algorithms['default'].should eql "D4E4779CA7AB"
|
31
30
|
end
|
32
31
|
|
33
|
-
it "should parse XML correctly if there are no usages
|
32
|
+
it "should parse XML correctly if there are no usages" do
|
34
33
|
connection = flexmock "connection"
|
35
|
-
connection.should_receive(:v3_get).with("/#{
|
34
|
+
connection.should_receive(:v3_get).with("/#{AMEE_API_VERSION}/definitions/472D78F6584E;full", {}).and_return(fixture('itemdef_no_usages.xml'))
|
36
35
|
@data = AMEE::Admin::ItemDefinition.load(connection,"472D78F6584E")
|
37
36
|
@data.usages.should == []
|
38
|
-
@data.algorithms.should == {}
|
39
37
|
end
|
40
38
|
|
41
39
|
it "should parse XML correctly if there is just one usage" do
|
42
40
|
connection = flexmock "connection"
|
43
|
-
connection.should_receive(:v3_get).with("/#{
|
41
|
+
connection.should_receive(:v3_get).with("/#{AMEE_API_VERSION}/definitions/472D78F6584E;full", {}).and_return(fixture('itemdef_one_usage.xml'))
|
44
42
|
@data = AMEE::Admin::ItemDefinition.load(connection,"472D78F6584E")
|
45
43
|
@data.usages.should == ['usageOne']
|
46
44
|
end
|
47
45
|
|
48
46
|
it "should be able to load an item value definition list" do
|
49
47
|
connection = flexmock "connection"
|
50
|
-
connection.should_receive(:v3_get).with("/#{
|
48
|
+
connection.should_receive(:v3_get).with("/#{AMEE_API_VERSION}/definitions/472D78F6584E;full", {}).and_return(fixture('itemdef.xml')).once
|
51
49
|
connection.should_receive(:retries).and_return(0).once
|
52
|
-
connection.should_receive(:v3_get).with("/#{
|
50
|
+
connection.should_receive(:v3_get).with("/#{AMEE_API_VERSION}/definitions/472D78F6584E/values;full", {:resultStart => 0, :resultLimit => 10}).and_return(fixture('ivdlist.xml')).once
|
53
51
|
@data = AMEE::Admin::ItemDefinition.load(connection,"472D78F6584E")
|
54
52
|
@data.uid.should == "472D78F6584E"
|
55
53
|
@list=@data.item_value_definition_list
|
@@ -79,20 +77,20 @@ describe AMEE::Admin::ItemDefinition, "with an authenticated v3 connection" do
|
|
79
77
|
it "should fail gracefully with incorrect data" do
|
80
78
|
connection = flexmock "connection"
|
81
79
|
xml = '<?xml version="1.0" encoding="UTF-8"?><Resources>'
|
82
|
-
connection.should_receive(:v3_get).with("/#{
|
80
|
+
connection.should_receive(:v3_get).with("/#{AMEE_API_VERSION}/definitions/472D78F6584E;full", {}).and_return(xml)
|
83
81
|
lambda{AMEE::Admin::ItemDefinition.load(connection, "472D78F6584E")}.should raise_error(AMEE::BadData)
|
84
82
|
end
|
85
83
|
|
86
84
|
it "should fail gracefully on other errors" do
|
87
85
|
connection = flexmock "connection"
|
88
|
-
connection.should_receive(:v3_get).with("/#{
|
86
|
+
connection.should_receive(:v3_get).with("/#{AMEE_API_VERSION}/definitions/472D78F6584E;full", {}).and_raise("unidentified error")
|
89
87
|
lambda{AMEE::Admin::ItemDefinition.load(connection, "472D78F6584E")}.should raise_error(AMEE::BadData)
|
90
88
|
end
|
91
89
|
|
92
90
|
it "should support updating" do
|
93
91
|
connection = flexmock "connection"
|
94
|
-
connection.should_receive(:v3_get).with("/#{
|
95
|
-
connection.should_receive(:v3_put).with("/#{
|
92
|
+
connection.should_receive(:v3_get).with("/#{AMEE_API_VERSION}/definitions/472D78F6584E;full", {}).and_return('<?xml version="1.0" encoding="UTF-8" standalone="no"?><Representation><ItemDefinition created="2009-08-31T12:41:18Z" modified="2010-08-13T14:54:33Z" status="ACTIVE" uid="472D78F6584E"><Name>Power Stations And Stuff</Name><DrillDown>state,county,metroArea,city,zipCode,plantName,powWowWow</DrillDown><Usages><Usage present="true"><Name>usageOne</Name></Usage><Usage present="true"><Name>usageThree</Name></Usage><Usage present="false"><Name>usageOther</Name></Usage></Usages></ItemDefinition><Status>OK</Status><Version>#{AMEE_API_VERSION}.0</Version></Representation>').once
|
93
|
+
connection.should_receive(:v3_put).with("/#{AMEE_API_VERSION}/definitions/472D78F6584E", :usages => 'usageOther,usageThree,usageOne', :name => 'Power Stations And Stuff').once
|
96
94
|
@data = AMEE::Admin::ItemDefinition.load(connection,"472D78F6584E")
|
97
95
|
@data.usages.should == ['usageOne', 'usageThree', 'usageOther']
|
98
96
|
@data.usages.reverse!
|
@@ -284,7 +282,7 @@ describe AMEE::Admin::ItemDefinitionList do
|
|
284
282
|
connection = flexmock "connection"
|
285
283
|
connection.should_receive(:retries).and_return(2).once
|
286
284
|
connection.should_receive(:get).with("/definitions/itemDefinitions",{}).twice.
|
287
|
-
and_return flexmock(:body =>DefinitionsListResponse
|
285
|
+
and_return flexmock(:body =>DefinitionsListResponse[0,12])
|
288
286
|
connection.should_receive(:expire).with("/definitions/itemDefinitions").twice
|
289
287
|
connection.should_receive(:get).with("/definitions/itemDefinitions",{}).once.
|
290
288
|
and_return flexmock(:body =>DefinitionsListResponse)
|
@@ -299,7 +297,7 @@ describe AMEE::Admin::ItemDefinitionList do
|
|
299
297
|
connection = flexmock "connection"
|
300
298
|
connection.should_receive(:retries).and_return(2).once
|
301
299
|
connection.should_receive(:get).with("/definitions/itemDefinitions",{}).times(3).
|
302
|
-
and_return flexmock(:body =>DefinitionsListResponse
|
300
|
+
and_return flexmock(:body =>DefinitionsListResponse[0,12])
|
303
301
|
connection.should_receive(:expire).with("/definitions/itemDefinitions").times(3)
|
304
302
|
lambda {
|
305
303
|
AMEE::Admin::ItemDefinitionList.new(connection)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Copyright (C) 2008-2011 AMEE UK Ltd. - http://www.amee.com
|
2
2
|
# Released as Open Source Software under the BSD 3-Clause license. See LICENSE.txt for details.
|
3
3
|
|
4
|
-
require
|
4
|
+
require 'spec_helper.rb'
|
5
5
|
|
6
6
|
describe AMEE::Admin::ItemValueDefinition, "with an authenticated XML connection" do
|
7
7
|
|
@@ -12,14 +12,14 @@ describe AMEE::Admin::ItemValueDefinition, "with an authenticated XML connection
|
|
12
12
|
end
|
13
13
|
|
14
14
|
it "should set metadata" do
|
15
|
-
@connection.should_receive(:v3_get).with("/#{
|
15
|
+
@connection.should_receive(:v3_get).with("/#{AMEE_API_VERSION}/definitions/PQR/values/ABC;wikiDoc;usages").
|
16
16
|
and_return(<<HERE
|
17
17
|
#{XMLPreamble}
|
18
18
|
<Representation>
|
19
19
|
</Representation>
|
20
20
|
HERE
|
21
21
|
).once
|
22
|
-
@connection.should_receive(:v3_put).with("/#{
|
22
|
+
@connection.should_receive(:v3_put).with("/#{AMEE_API_VERSION}/definitions/PQR/values/ABC;wikiDoc;usages",
|
23
23
|
:body => <<EOF
|
24
24
|
#{XMLPreamble}
|
25
25
|
<ItemValueDefinition>
|
@@ -37,7 +37,7 @@ HERE
|
|
37
37
|
</ItemValueDefinition>
|
38
38
|
EOF
|
39
39
|
).once
|
40
|
-
@connection.should_receive(:v3_get).with("/#{
|
40
|
+
@connection.should_receive(:v3_get).with("/#{AMEE_API_VERSION}/definitions/PQR/values/ABC;wikiDoc;usages").
|
41
41
|
and_return(<<HERE
|
42
42
|
#{XMLPreamble}
|
43
43
|
<Representation>
|
@@ -51,7 +51,7 @@ HERE
|
|
51
51
|
end
|
52
52
|
|
53
53
|
it "should get metadata" do
|
54
|
-
@connection.should_receive(:v3_get).with("/#{
|
54
|
+
@connection.should_receive(:v3_get).with("/#{AMEE_API_VERSION}/definitions/PQR/values/ABC;wikiDoc;usages").
|
55
55
|
and_return(<<HERE
|
56
56
|
#{XMLPreamble}
|
57
57
|
<Representation>
|
@@ -87,7 +87,7 @@ HERE
|
|
87
87
|
<FromProfile>false</FromProfile>
|
88
88
|
</ItemValueDefinition>
|
89
89
|
<Status>OK</Status>
|
90
|
-
<Version>#{
|
90
|
+
<Version>#{AMEE_API_VERSION}.0</Version>
|
91
91
|
</Representation>
|
92
92
|
HERE
|
93
93
|
).once
|
@@ -1,7 +1,8 @@
|
|
1
1
|
# Copyright (C) 2008-2011 AMEE UK Ltd. - http://www.amee.com
|
2
2
|
# Released as Open Source Software under the BSD 3-Clause license. See LICENSE.txt for details.
|
3
3
|
|
4
|
-
require
|
4
|
+
require 'spec_helper.rb'
|
5
|
+
|
5
6
|
Testcativduid="5648C049F599"
|
6
7
|
Testrvduid="C21026DD57C5"
|
7
8
|
describe AMEE::Admin::ReturnValueDefinition, "with an authenticated XML connection" do
|
@@ -31,7 +32,7 @@ describe AMEE::Admin::ReturnValueDefinition, "with an authenticated XML connecti
|
|
31
32
|
connection = flexmock "connection"
|
32
33
|
connection.should_receive(:retries).and_return(0).once
|
33
34
|
connection.should_receive(:v3_get).
|
34
|
-
with("/#{
|
35
|
+
with("/#{AMEE_API_VERSION}/definitions/#{Testcativduid}/returnvalues;full", {:resultLimit=>10, :resultStart=>0}).
|
35
36
|
and_return(fixture('return_value_definition_list.xml')).once
|
36
37
|
list=AMEE::Admin::ReturnValueDefinitionList.new(connection,Testcativduid)
|
37
38
|
list.should have(3).items
|
@@ -40,7 +41,7 @@ describe AMEE::Admin::ReturnValueDefinition, "with an authenticated XML connecti
|
|
40
41
|
connection = flexmock "connection"
|
41
42
|
connection.should_receive(:retries).and_return(0).once
|
42
43
|
connection.should_receive(:v3_get).
|
43
|
-
with("/#{
|
44
|
+
with("/#{AMEE_API_VERSION}/definitions/#{Testcativduid}/returnvalues;full", {:resultLimit=>10, :resultStart=>0}).
|
44
45
|
and_return(fixture('empty_return_value_definition_list.xml')).once
|
45
46
|
list=AMEE::Admin::ReturnValueDefinitionList.new(connection,Testcativduid)
|
46
47
|
list.should have(0).items
|
@@ -48,13 +49,13 @@ describe AMEE::Admin::ReturnValueDefinition, "with an authenticated XML connecti
|
|
48
49
|
it "should create a return value definition" do
|
49
50
|
connection = flexmock "connection"
|
50
51
|
connection.should_receive(:v3_get).
|
51
|
-
with("/#{
|
52
|
+
with("/#{AMEE_API_VERSION}/definitions/#{Testcativduid}/returnvalues/#{Testrvduid};full", {}).
|
52
53
|
and_return(fixture('return_value_definition.xml')).once
|
53
54
|
connection.should_receive(:v3_post).
|
54
|
-
with("/#{
|
55
|
+
with("/#{AMEE_API_VERSION}/definitions/#{Testcativduid}/returnvalues",
|
55
56
|
{:type=>"CO2", :valueDefinition=>"45433E48B39F",
|
56
57
|
:returnobj=>true, :unit=>"kg", :perUnit=>"month"}).
|
57
|
-
and_return({'Location'=>"///#{
|
58
|
+
and_return({'Location'=>"///#{AMEE_API_VERSION}/definitions/#{Testcativduid}/returnvalues/#{Testrvduid}"}).once
|
58
59
|
rvd=AMEE::Admin::ReturnValueDefinition.create(connection,Testcativduid,
|
59
60
|
:type=>'CO2',:unit=>'kg',:perUnit=>'month')
|
60
61
|
|
@@ -66,7 +67,7 @@ describe AMEE::Admin::ReturnValueDefinition, "with an authenticated XML connecti
|
|
66
67
|
it "should read a return value definition" do
|
67
68
|
connection = flexmock "connection"
|
68
69
|
connection.should_receive(:v3_get).
|
69
|
-
with("/#{
|
70
|
+
with("/#{AMEE_API_VERSION}/definitions/#{Testcativduid}/returnvalues/#{Testrvduid};full", {}).
|
70
71
|
and_return(fixture('return_value_definition.xml')).once
|
71
72
|
rvd=AMEE::Admin::ReturnValueDefinition.load(connection,Testcativduid,Testrvduid)
|
72
73
|
|
@@ -78,10 +79,10 @@ describe AMEE::Admin::ReturnValueDefinition, "with an authenticated XML connecti
|
|
78
79
|
it "should delete a return value definition" do
|
79
80
|
connection = flexmock "connection"
|
80
81
|
connection.should_receive(:v3_get).
|
81
|
-
with("/#{
|
82
|
+
with("/#{AMEE_API_VERSION}/definitions/#{Testcativduid}/returnvalues/#{Testrvduid};full", {}).
|
82
83
|
and_return(fixture('return_value_definition.xml')).once
|
83
84
|
connection.should_receive(:v3_delete).
|
84
|
-
with("/#{
|
85
|
+
with("/#{AMEE_API_VERSION}/definitions/#{Testcativduid}/returnvalues/#{Testrvduid}").once
|
85
86
|
connection.should_receive(:timeout=)
|
86
87
|
connection.should_receive(:timeout)
|
87
88
|
rvd=AMEE::Admin::ReturnValueDefinition.load(connection,Testcativduid,Testrvduid)
|
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: 63
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
|
-
-
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version:
|
7
|
+
- 4
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 4.0.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- James Smith
|
@@ -18,28 +18,30 @@ autorequire:
|
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
20
|
|
21
|
-
date: 2011-
|
21
|
+
date: 2011-09-28 00:00:00 +01:00
|
22
22
|
default_executable: ameesh
|
23
23
|
dependencies:
|
24
24
|
- !ruby/object:Gem::Dependency
|
25
25
|
prerelease: false
|
26
|
-
|
26
|
+
name: activesupport
|
27
|
+
type: :runtime
|
28
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
27
29
|
none: false
|
28
30
|
requirements:
|
29
31
|
- - ~>
|
30
32
|
- !ruby/object:Gem::Version
|
31
|
-
hash:
|
33
|
+
hash: 19
|
32
34
|
segments:
|
33
|
-
- 2
|
34
35
|
- 3
|
35
|
-
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
version_requirements: *id001
|
36
|
+
- 0
|
37
|
+
- 10
|
38
|
+
version: 3.0.10
|
39
|
+
requirement: *id001
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
prerelease: false
|
42
|
-
|
42
|
+
name: json
|
43
|
+
type: :runtime
|
44
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
43
45
|
none: false
|
44
46
|
requirements:
|
45
47
|
- - ">="
|
@@ -48,12 +50,12 @@ dependencies:
|
|
48
50
|
segments:
|
49
51
|
- 0
|
50
52
|
version: "0"
|
51
|
-
|
52
|
-
name: json
|
53
|
-
version_requirements: *id002
|
53
|
+
requirement: *id002
|
54
54
|
- !ruby/object:Gem::Dependency
|
55
55
|
prerelease: false
|
56
|
-
|
56
|
+
name: log4r
|
57
|
+
type: :runtime
|
58
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
57
59
|
none: false
|
58
60
|
requirements:
|
59
61
|
- - ">="
|
@@ -62,12 +64,12 @@ dependencies:
|
|
62
64
|
segments:
|
63
65
|
- 0
|
64
66
|
version: "0"
|
65
|
-
|
66
|
-
name: log4r
|
67
|
-
version_requirements: *id003
|
67
|
+
requirement: *id003
|
68
68
|
- !ruby/object:Gem::Dependency
|
69
69
|
prerelease: false
|
70
|
-
|
70
|
+
name: nokogiri
|
71
|
+
type: :runtime
|
72
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
71
73
|
none: false
|
72
74
|
requirements:
|
73
75
|
- - ~>
|
@@ -79,12 +81,12 @@ dependencies:
|
|
79
81
|
- 3
|
80
82
|
- 1
|
81
83
|
version: 1.4.3.1
|
82
|
-
|
83
|
-
name: nokogiri
|
84
|
-
version_requirements: *id004
|
84
|
+
requirement: *id004
|
85
85
|
- !ruby/object:Gem::Dependency
|
86
86
|
prerelease: false
|
87
|
-
|
87
|
+
name: bundler
|
88
|
+
type: :development
|
89
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
88
90
|
none: false
|
89
91
|
requirements:
|
90
92
|
- - ~>
|
@@ -95,12 +97,12 @@ dependencies:
|
|
95
97
|
- 0
|
96
98
|
- 0
|
97
99
|
version: 1.0.0
|
98
|
-
|
99
|
-
name: bundler
|
100
|
-
version_requirements: *id005
|
100
|
+
requirement: *id005
|
101
101
|
- !ruby/object:Gem::Dependency
|
102
102
|
prerelease: false
|
103
|
-
|
103
|
+
name: jeweler
|
104
|
+
type: :development
|
105
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
104
106
|
none: false
|
105
107
|
requirements:
|
106
108
|
- - ~>
|
@@ -111,74 +113,72 @@ dependencies:
|
|
111
113
|
- 6
|
112
114
|
- 4
|
113
115
|
version: 1.6.4
|
114
|
-
|
115
|
-
name: jeweler
|
116
|
-
version_requirements: *id006
|
116
|
+
requirement: *id006
|
117
117
|
- !ruby/object:Gem::Dependency
|
118
118
|
prerelease: false
|
119
|
-
|
119
|
+
name: rspec
|
120
|
+
type: :development
|
121
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
120
122
|
none: false
|
121
123
|
requirements:
|
122
124
|
- - "="
|
123
125
|
- !ruby/object:Gem::Version
|
124
|
-
hash:
|
126
|
+
hash: 23
|
125
127
|
segments:
|
126
|
-
-
|
127
|
-
-
|
128
|
+
- 2
|
129
|
+
- 6
|
128
130
|
- 0
|
129
|
-
version:
|
130
|
-
|
131
|
-
name: rspec
|
132
|
-
version_requirements: *id007
|
131
|
+
version: 2.6.0
|
132
|
+
requirement: *id007
|
133
133
|
- !ruby/object:Gem::Dependency
|
134
134
|
prerelease: false
|
135
|
-
|
135
|
+
name: flexmock
|
136
|
+
type: :development
|
137
|
+
version_requirements: &id008 !ruby/object:Gem::Requirement
|
136
138
|
none: false
|
137
139
|
requirements:
|
138
|
-
- - "
|
140
|
+
- - ">"
|
139
141
|
- !ruby/object:Gem::Version
|
140
|
-
hash:
|
142
|
+
hash: 51
|
141
143
|
segments:
|
142
144
|
- 0
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
145
|
+
- 8
|
146
|
+
- 6
|
147
|
+
version: 0.8.6
|
148
|
+
requirement: *id008
|
147
149
|
- !ruby/object:Gem::Dependency
|
148
150
|
prerelease: false
|
149
|
-
|
151
|
+
name: memcache-client
|
152
|
+
type: :development
|
153
|
+
version_requirements: &id009 !ruby/object:Gem::Requirement
|
150
154
|
none: false
|
151
155
|
requirements:
|
152
|
-
- - "
|
156
|
+
- - ">="
|
153
157
|
- !ruby/object:Gem::Version
|
154
|
-
hash:
|
158
|
+
hash: 3
|
155
159
|
segments:
|
156
|
-
-
|
157
|
-
|
158
|
-
|
159
|
-
version: 1.1.3
|
160
|
-
type: :development
|
161
|
-
name: rspec_spinner
|
162
|
-
version_requirements: *id009
|
160
|
+
- 0
|
161
|
+
version: "0"
|
162
|
+
requirement: *id009
|
163
163
|
- !ruby/object:Gem::Dependency
|
164
164
|
prerelease: false
|
165
|
-
|
165
|
+
name: rcov
|
166
|
+
type: :development
|
167
|
+
version_requirements: &id010 !ruby/object:Gem::Requirement
|
166
168
|
none: false
|
167
169
|
requirements:
|
168
|
-
- -
|
170
|
+
- - ">="
|
169
171
|
- !ruby/object:Gem::Version
|
170
|
-
hash:
|
172
|
+
hash: 3
|
171
173
|
segments:
|
172
|
-
-
|
173
|
-
|
174
|
-
|
175
|
-
version: 2.3.5
|
176
|
-
type: :development
|
177
|
-
name: activerecord
|
178
|
-
version_requirements: *id010
|
174
|
+
- 0
|
175
|
+
version: "0"
|
176
|
+
requirement: *id010
|
179
177
|
- !ruby/object:Gem::Dependency
|
180
178
|
prerelease: false
|
181
|
-
|
179
|
+
name: rdoc
|
180
|
+
type: :development
|
181
|
+
version_requirements: &id011 !ruby/object:Gem::Requirement
|
182
182
|
none: false
|
183
183
|
requirements:
|
184
184
|
- - ">="
|
@@ -187,9 +187,23 @@ dependencies:
|
|
187
187
|
segments:
|
188
188
|
- 0
|
189
189
|
version: "0"
|
190
|
+
requirement: *id011
|
191
|
+
- !ruby/object:Gem::Dependency
|
192
|
+
prerelease: false
|
193
|
+
name: activerecord
|
190
194
|
type: :development
|
191
|
-
|
192
|
-
|
195
|
+
version_requirements: &id012 !ruby/object:Gem::Requirement
|
196
|
+
none: false
|
197
|
+
requirements:
|
198
|
+
- - ~>
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
hash: 19
|
201
|
+
segments:
|
202
|
+
- 3
|
203
|
+
- 0
|
204
|
+
- 10
|
205
|
+
version: 3.0.10
|
206
|
+
requirement: *id012
|
193
207
|
description:
|
194
208
|
email: james@floppy.org.uk
|
195
209
|
executables:
|
@@ -218,12 +232,9 @@ files:
|
|
218
232
|
- examples/view_data_category.rb
|
219
233
|
- examples/view_data_item.rb
|
220
234
|
- examples/view_profile_item.rb
|
221
|
-
- init.rb
|
222
235
|
- lib/amee.rb
|
223
236
|
- lib/amee/collection.rb
|
224
|
-
- lib/amee/config.rb
|
225
237
|
- lib/amee/connection.rb
|
226
|
-
- lib/amee/core-extensions/hash.rb
|
227
238
|
- lib/amee/data_category.rb
|
228
239
|
- lib/amee/data_item.rb
|
229
240
|
- lib/amee/data_item_value.rb
|
@@ -253,7 +264,6 @@ files:
|
|
253
264
|
- lib/amee/v3/item_value_definition_list.rb
|
254
265
|
- lib/amee/v3/meta_helper.rb
|
255
266
|
- lib/amee/v3/return_value_definition.rb
|
256
|
-
- rails/init.rb
|
257
267
|
- spec/amee_spec.rb
|
258
268
|
- spec/cache_spec.rb
|
259
269
|
- spec/connection_spec.rb
|
@@ -283,7 +293,6 @@ files:
|
|
283
293
|
- spec/fixtures/ivdlist.xml
|
284
294
|
- spec/fixtures/ivdlist_BD88D30D1214.xml
|
285
295
|
- spec/fixtures/parse_test.xml
|
286
|
-
- spec/fixtures/rails_config.yml
|
287
296
|
- spec/fixtures/return_value_definition.xml
|
288
297
|
- spec/fixtures/return_value_definition_list.xml
|
289
298
|
- spec/fixtures/v0_data_transport_transport_drill_transportType_Car1.xml
|
@@ -299,7 +308,6 @@ files:
|
|
299
308
|
- spec/profile_spec.rb
|
300
309
|
- spec/rails_spec.rb
|
301
310
|
- spec/spec.opts
|
302
|
-
- spec/spec_amee_config.rb
|
303
311
|
- spec/spec_helper.rb
|
304
312
|
- spec/user_spec.rb
|
305
313
|
- spec/v3/connection_spec.rb
|
@@ -336,7 +344,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
336
344
|
requirements: []
|
337
345
|
|
338
346
|
rubyforge_project:
|
339
|
-
rubygems_version: 1.
|
347
|
+
rubygems_version: 1.4.2
|
340
348
|
signing_key:
|
341
349
|
specification_version: 3
|
342
350
|
summary: Ruby interface to the AMEE carbon calculator
|