amee_rails_layer 0.4.0 → 0.5.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/Rakefile +4 -4
- data/VERSION +1 -1
- data/amee_rails_layer.gemspec +6 -6
- data/lib/amee_rails_layer/amee_category.rb +6 -3
- data/lib/amee_rails_layer/unit.rb +8 -2
- metadata +7 -6
data/Rakefile
CHANGED
@@ -6,10 +6,10 @@ begin
|
|
6
6
|
Jeweler::Tasks.new do |gem|
|
7
7
|
gem.name = "amee_rails_layer"
|
8
8
|
gem.summary = %Q{An abstraction layer for building applications around the AMEE API}
|
9
|
-
gem.description = %Q{
|
10
|
-
gem.email = "
|
11
|
-
gem.homepage = "http://github.com/
|
12
|
-
gem.authors = ["George Palmer"]
|
9
|
+
gem.description = %Q{An abstraction layer for building applications around the AMEE API}
|
10
|
+
gem.email = "help@amee.com"
|
11
|
+
gem.homepage = "http://github.com/AMEE/amee_rails_layer"
|
12
|
+
gem.authors = ["George Palmer", "James Smith"]
|
13
13
|
gem.add_development_dependency "amee-ruby", ">= 0"
|
14
14
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
15
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.5.0
|
data/amee_rails_layer.gemspec
CHANGED
@@ -5,13 +5,13 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{amee_rails_layer}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.5.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["George Palmer"]
|
12
|
-
s.date = %q{2010-
|
13
|
-
s.description = %q{
|
14
|
-
s.email = %q{
|
11
|
+
s.authors = ["George Palmer", "James Smith"]
|
12
|
+
s.date = %q{2010-10-18}
|
13
|
+
s.description = %q{An abstraction layer for building applications around the AMEE API}
|
14
|
+
s.email = %q{help@amee.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
17
|
"README.rdoc"
|
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
|
|
32
32
|
"test/helper.rb",
|
33
33
|
"test/test_amee-abstraction-layer-gem.rb"
|
34
34
|
]
|
35
|
-
s.homepage = %q{http://github.com/
|
35
|
+
s.homepage = %q{http://github.com/AMEE/amee_rails_layer}
|
36
36
|
s.rdoc_options = ["--charset=UTF-8"]
|
37
37
|
s.require_paths = ["lib"]
|
38
38
|
s.rubygems_version = %q{1.3.6}
|
@@ -15,6 +15,7 @@ require 'amee_rails_layer/unit'
|
|
15
15
|
# * :energy - the energy consumed (units available are kWh)
|
16
16
|
# * :volumable_energy - the energy consumed specified either as a volume of fuel or energy unit
|
17
17
|
# (units available are litres or kWh)
|
18
|
+
# * :flights - the number of one-way flights
|
18
19
|
#
|
19
20
|
# The CATEGORY_TYPES constant maps these symbols to the corresponding field names used in amee to
|
20
21
|
# store the amount of whatever is being specified. So for a given data item path you must ensure
|
@@ -41,7 +42,8 @@ class AmeeCategory
|
|
41
42
|
:energy => [:energyConsumption],
|
42
43
|
:volumable_energy => [:volumePerTime, :energyConsumption],
|
43
44
|
:volume => [:volumePerTime],
|
44
|
-
:weight_or_volume => [:massPerTime, :volumePerTime]
|
45
|
+
:weight_or_volume => [:massPerTime, :volumePerTime],
|
46
|
+
:journeys => [:journeys]
|
45
47
|
}
|
46
48
|
|
47
49
|
CATEGORY_TYPES_TO_UNITS = {
|
@@ -51,14 +53,15 @@ class AmeeCategory
|
|
51
53
|
:massPerTime => [Unit.kg, Unit.tonnes],
|
52
54
|
:energyConsumption => [Unit.kwh],
|
53
55
|
:volumePerTime => [Unit.litres],
|
56
|
+
:journeys => [Unit.journeys]
|
54
57
|
}
|
55
58
|
|
56
59
|
# Create an AmeeCategory. The initializer takes the following parameters:
|
57
60
|
# * name - a human readable name to refer to the category by. This is not used in the storing or
|
58
61
|
# retrieving of data in amee but is useful for exposing in the view where a user chooses the
|
59
62
|
# type they would like for the model
|
60
|
-
# * category_type - either :distance, :journey_distance, :weight, :energy
|
61
|
-
# notes in class header for more on this
|
63
|
+
# * category_type - either :distance, :journey_distance, :weight, :energy, :volumable_energy or
|
64
|
+
# :flights. See notes in class header for more on this.
|
62
65
|
# * profile_category_path - the path to the amee category - eg "/transport/car/generic/defra/bysize"
|
63
66
|
# * options - any additional options required with the profile_category_path to make the path
|
64
67
|
# refer to just one amee categorgy (typically these are passed in as a query string URL in amee
|
@@ -10,7 +10,8 @@ class Unit
|
|
10
10
|
:tonnes => "tonnes",
|
11
11
|
:kwh => "kWh",
|
12
12
|
:litres => "litres",
|
13
|
-
:uk_gallons => "UK Gallons"
|
13
|
+
:uk_gallons => "UK Gallons",
|
14
|
+
:journeys => "return flights"
|
14
15
|
}
|
15
16
|
|
16
17
|
AMEE_API_UNITS = {
|
@@ -20,7 +21,8 @@ class Unit
|
|
20
21
|
:tonnes => "t",
|
21
22
|
:kwh => "kWh",
|
22
23
|
:litres => "L",
|
23
|
-
:uk_gallons => "gal_uk"
|
24
|
+
:uk_gallons => "gal_uk",
|
25
|
+
:journeys => "nil"
|
24
26
|
}
|
25
27
|
|
26
28
|
# Creates a new Unit object from the symbol representing the unit (see class doc)
|
@@ -74,4 +76,8 @@ class Unit
|
|
74
76
|
def self.uk_gallons
|
75
77
|
new(:uk_gallons)
|
76
78
|
end
|
79
|
+
|
80
|
+
def self.journeys
|
81
|
+
new(:journeys)
|
82
|
+
end
|
77
83
|
end
|
metadata
CHANGED
@@ -4,17 +4,18 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
7
|
+
- 5
|
8
8
|
- 0
|
9
|
-
version: 0.
|
9
|
+
version: 0.5.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- George Palmer
|
13
|
+
- James Smith
|
13
14
|
autorequire:
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-10-18 00:00:00 +01:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
@@ -29,8 +30,8 @@ dependencies:
|
|
29
30
|
version: "0"
|
30
31
|
type: :development
|
31
32
|
version_requirements: *id001
|
32
|
-
description:
|
33
|
-
email:
|
33
|
+
description: An abstraction layer for building applications around the AMEE API
|
34
|
+
email: help@amee.com
|
34
35
|
executables: []
|
35
36
|
|
36
37
|
extensions: []
|
@@ -54,7 +55,7 @@ files:
|
|
54
55
|
- test/helper.rb
|
55
56
|
- test/test_amee-abstraction-layer-gem.rb
|
56
57
|
has_rdoc: true
|
57
|
-
homepage: http://github.com/
|
58
|
+
homepage: http://github.com/AMEE/amee_rails_layer
|
58
59
|
licenses: []
|
59
60
|
|
60
61
|
post_install_message:
|