shipment 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,37 +13,34 @@ Feature: Shipment Committee Calculations
13
13
  Then the committee should have used quorum "default"
14
14
  And the conclusion of the committee should be "1"
15
15
 
16
- Scenario: Carrier from nothing
16
+ Scenario: Segment count from nothing
17
17
  Given a shipment emitter
18
- When the "carrier" committee is calculated
18
+ When the "segment_count" committee is calculated
19
19
  Then the committee should have used quorum "default"
20
- And the conclusion of the committee should be a fallback
21
-
22
- Scenario: Mode from nothing
23
- Given a shipment emitter
24
- When the "mode" committee is calculated
25
- Then the committee should have used quorum "default"
26
- And the conclusion of the committee should be a fallback
20
+ And the conclusion of the committee should be "5"
27
21
 
28
22
  Scenario Outline: Distance from same locality
29
23
  Given a shipment emitter
30
- And a characteristic "origin_zip_code.name" of "<origin>"
31
- And a characteristic "destination_zip_code.name" of "<destination>"
32
- When the "distance" committee is calculated
24
+ And a characteristic "origin" of "<origin>"
25
+ And a characteristic "destination" of "<destination>"
26
+ When the "origin_location" committee is calculated
27
+ And the "destination_location" committee is calculated
28
+ And the "distance" committee is calculated
33
29
  Then the conclusion of the committee should be "<distance>"
34
30
  Examples:
35
31
  | origin | destination | distance |
36
32
  | 05753 | 05753 | 0 |
37
- | 05753 | 05401 | |
38
33
 
39
34
  Scenario Outline: Distance from mapquest
40
35
  Given a shipment emitter
41
- And a characteristic "origin_zip_code.name" of "<origin>"
42
- And a characteristic "destination_zip_code.name" of "<destination>"
36
+ And a characteristic "origin" of "<origin>"
37
+ And a characteristic "destination" of "<destination>"
43
38
  And a characteristic "mode.name" of "ground"
44
39
  And a characteristic "mapquest_api_key" of "ABC123"
45
40
  And mapquest determines the distance to be "<mapquest_distance>"
46
- When the "distance" committee is calculated
41
+ When the "origin_location" committee is calculated
42
+ And the "destination_location" committee is calculated
43
+ And the "distance" committee is calculated
47
44
  Then the committee should have used quorum "from mapquest"
48
45
  And the conclusion of the committee should be "<distance>"
49
46
  Examples:
@@ -53,33 +50,82 @@ Feature: Shipment Committee Calculations
53
50
 
54
51
  Scenario Outline: Distance from direct path
55
52
  Given a shipment emitter
56
- And a characteristic "origin_zip_code.name" of "<origin>"
57
- And a characteristic "destination_zip_code.name" of "<destination>"
53
+ And a characteristic "origin" of "<origin>"
54
+ And a characteristic "destination" of "<destination>"
58
55
  And a characteristic "mode.name" of "air"
59
56
  And a characteristic "mapquest_api_key" of "ABC123"
60
- When the "distance" committee is calculated
57
+ When the "origin_location" committee is calculated
58
+ And the "destination_location" committee is calculated
59
+ And the "distance" committee is calculated
61
60
  Then the committee should have used quorum "from direct path"
62
61
  And the conclusion of the committee should be "<distance>"
63
62
  Examples:
64
- | origin | destination | distance |
65
- | 05753 | 05401 | 53 |
63
+ | origin | destination | distance |
64
+ | 05753 | San Francisco, CA | 4140.39274 |
65
+ | Lansing, MI | Canterbury, Kent, UK | 6192.60039 |
66
+ | 05753 | Canterbury, Kent, UK | 5384.08989 |
67
+
68
+ Scenario Outline: Origin location from origin
69
+ Given a shipment emitter
70
+ And a characteristic "origin" of "<origin>"
71
+ When the "origin_location" committee is calculated
72
+ Then the committee should have used quorum "from origin"
73
+ And the conclusion of the committee should be "<location>"
74
+ Examples:
75
+ | origin | location |
76
+ | 05753 | 43.9968185,-73.1491165 |
77
+ | Address: San Francisco, CA | 37.7749295,-122.4194155 |
78
+ | Address: 488 Haight Street, San Francisco, CA | 37.7721568,-122.4302295 |
79
+ | Address: Canterbury, Kent, UK | 51.2772689,1.0805173 |
80
+
81
+ Scenario Outline: Origin location from origin_zip_code
82
+ Given a shipment emitter
83
+ And a characteristic "origin_zip_code" of "<origin>"
84
+ When the "origin" committee is calculated
85
+ And the "origin_location" committee is calculated
86
+ Then the conclusion of the committee should be "<location>"
87
+ Examples:
88
+ | origin | location |
89
+ | 05753 | 43.9968185,-73.1491165 |
90
+
91
+ Scenario Outline: Destination location from destination
92
+ Given a shipment emitter
93
+ And a characteristic "destination" of "<destination>"
94
+ When the "destination_location" committee is calculated
95
+ Then the committee should have used quorum "from destination"
96
+ And the conclusion of the committee should be "<location>"
97
+ Examples:
98
+ | destination | location |
99
+ | 05753 | 43.9968185,-73.1491165 |
100
+ | Address: 488 Haight Street, San Francisco, CA | 37.7721568,-122.4302295 |
101
+ | Address: Canterbury, Kent, UK | 51.2772689,1.0805173 |
102
+
103
+ Scenario Outline: Destination location from destination_zip_code
104
+ Given a shipment emitter
105
+ And a characteristic "destination_zip_code" of "<destination>"
106
+ When the "destination" committee is calculated
107
+ And the "destination_location" committee is calculated
108
+ Then the conclusion of the committee should be "<location>"
109
+ Examples:
110
+ | destination | location |
111
+ | 05753 | 43.9968185,-73.1491165 |
66
112
 
67
- Scenario Outline: Distance from zip codes not in database or missing lat/lng
113
+ Scenario: Origin committee from uncodable origin
68
114
  Given a shipment emitter
69
- And a characteristic "origin_zip_code.name" of "<origin>"
70
- And a characteristic "destination_zip_code.name" of "<destination>"
71
- When the "distance" committee is calculated
115
+ And a characteristic "origin" of "Bag End, Hobbiton, Westfarthing, The Shire, Eriador, Middle Earth"
116
+ When the "origin_location" committee is calculated
117
+ Then the conclusion of the committee should be nil
118
+
119
+ Scenario: Destination committee from uncodable destination
120
+ Given a shipment emitter
121
+ And a characteristic "destination" of "Bag End, Hobbiton, Westfarthing, The Shire, Eriador, Middle Earth"
122
+ When the "destination_location" committee is calculated
72
123
  Then the conclusion of the committee should be nil
73
- Examples:
74
- | origin | destination |
75
- | 05753 | 20860 |
76
- | 05753 | 99999 |
77
124
 
78
- Scenario: Route inefficiency factor from nothing
125
+ Scenario: Route inefficiency factor from default
79
126
  Given a shipment emitter
80
- When the "mode" committee is calculated
81
- And the "route_inefficiency_factor" committee is calculated
82
- Then the committee should have used quorum "from mode"
127
+ When the "route_inefficiency_factor" committee is calculated
128
+ Then the committee should have used quorum "default"
83
129
  And the conclusion of the committee should be "1.05"
84
130
 
85
131
  Scenario Outline: Route inefficiency factor from mode
@@ -94,11 +140,12 @@ Feature: Shipment Committee Calculations
94
140
  | ground | 1.0 |
95
141
  | air | 1.1 |
96
142
 
97
- Scenario: Dogleg factor from nothing
143
+ Scenario: Dogleg factor from default segment count
98
144
  Given a shipment emitter
99
- When the "dogleg_factor" committee is calculated
145
+ When the "segment_count" committee is calculated
146
+ And the "dogleg_factor" committee is calculated
100
147
  Then the committee should have used quorum "from segment count"
101
- And the conclusion of the committee should be "1.8"
148
+ And the conclusion of the committee should be "5.0625"
102
149
 
103
150
  Scenario Outline: Dogleg factor from segment count
104
151
  Given a shipment emitter
@@ -109,9 +156,7 @@ Feature: Shipment Committee Calculations
109
156
  Examples:
110
157
  | segments | factor |
111
158
  | 1 | 1.0 |
112
- | 2 | 1.8 |
113
- | 100 | 1.8 |
114
- | -20 | 1.8 |
159
+ | 2 | 1.5 |
115
160
 
116
161
  Scenario: Adjusted distance from default
117
162
  Given a shipment emitter
@@ -128,30 +173,30 @@ Feature: Shipment Committee Calculations
128
173
  Then the committee should have used quorum "from distance, route inefficiency factor, and dogleg factor"
129
174
  And the conclusion of the committee should be "400.0"
130
175
 
131
- Scenario: Transport emission factor from default mode
176
+ Scenario: Transport emission factor from default
132
177
  Given a shipment emitter
133
- When the "mode" committee is calculated
134
- And the "transport_emission_factor" committee is calculated
135
- Then the committee should have used quorum "from mode"
178
+ When the "transport_emission_factor" committee is calculated
179
+ Then the committee should have used quorum "default"
136
180
  And the conclusion of the committee should be "0.00076955"
137
181
 
138
- Scenario Outline: Transport emission factor from mode
182
+ Scenario Outline: Transport emission factor from mode, weight, and adjusted distance
139
183
  Given a shipment emitter
140
184
  And a characteristic "mode.name" of "<mode>"
185
+ And a characteristic "weight" of "<weight>"
186
+ And a characteristic "adjusted_distance" of "<adjusted_distance>"
141
187
  When the "transport_emission_factor" committee is calculated
142
- Then the committee should have used quorum "from mode"
188
+ Then the committee should have used quorum "from mode, weight, and adjusted distance"
143
189
  And the conclusion of the committee should be "<emission_factor>"
144
190
  Examples:
145
- | mode | emission_factor |
146
- | courier | 2.0 |
147
- | ground | 1.0 |
148
- | air | 5.0 |
191
+ | mode | weight | adjusted_distance | emission_factor |
192
+ | courier | 2.0 | 5.0 | 0.2 |
193
+ | ground | 2.0 | 50.0 | 1.0 |
194
+ | air | 2.0 | 50.0 | 5.0 |
149
195
 
150
- Scenario: Corporate emission factor from default carrier
196
+ Scenario: Corporate emission factor from default
151
197
  Given a shipment emitter
152
- When the "carrier" committee is calculated
153
- And the "corporate_emission_factor" committee is calculated
154
- Then the committee should have used quorum "from carrier"
198
+ When the "corporate_emission_factor" committee is calculated
199
+ Then the committee should have used quorum "default"
155
200
  And the conclusion of the committee should be "0.318"
156
201
 
157
202
  Scenario: Corporate emission factor from carrier
@@ -161,30 +206,14 @@ Feature: Shipment Committee Calculations
161
206
  Then the committee should have used quorum "from carrier"
162
207
  And the conclusion of the committee should be "2.0"
163
208
 
164
- Scenario: Transport emission from defaults
209
+ Scenario: Transport emission from weight, adjusted distance, and transport emission factor
165
210
  Given a shipment emitter
166
- When the "weight" committee is calculated
167
- And the "mode" committee is calculated
168
- And the "adjusted_distance" committee is calculated
169
- And the "transport_emission_factor" committee is calculated
170
- And the "transport_emission" committee is calculated
171
- Then the committee should have used quorum "from mode, weight, adjusted distance, and transport emission factor"
172
- And the conclusion of the committee should be "8.42296"
173
-
174
- Scenario Outline: Transport emission from mode, weight, adjusted distance, and transport emission factor
175
- Given a shipment emitter
176
- And a characteristic "mode.name" of "<mode>"
177
- And a characteristic "weight" of "<weight>"
178
- And a characteristic "adjusted_distance" of "<adjusted_distance>"
179
- And a characteristic "transport_emission_factor" of "<ef>"
211
+ And a characteristic "weight" of "2.0"
212
+ And a characteristic "adjusted_distance" of "100.0"
213
+ And a characteristic "transport_emission_factor" of "2.0"
180
214
  When the "transport_emission" committee is calculated
181
- Then the committee should have used quorum "from mode, weight, adjusted distance, and transport emission factor"
182
- And the conclusion of the committee should be "<emission>"
183
- Examples:
184
- | mode | weight | adjusted_distance | ef | emission |
185
- | courier | 2.0 | 100.0 | 2.0 | 2.0 |
186
- | ground | 2.0 | 100.0 | 1.0 | 200.0 |
187
- | air | 2.0 | 100.0 | 5.0 | 1000.0 |
215
+ Then the committee should have used quorum "from weight, adjusted distance, and transport emission factor"
216
+ And the conclusion of the committee should be "400.0"
188
217
 
189
218
  Scenario: Corporate emission from package count and corporate emission factor
190
219
  Given a shipment emitter
@@ -201,18 +230,3 @@ Feature: Shipment Committee Calculations
201
230
  When the "emission" committee is calculated
202
231
  Then the committee should have used quorum "from transport emission and corporate emission"
203
232
  And the conclusion of the committee should be "420.0"
204
-
205
- # Scenario Outline: Duration from timestamps
206
- # Given a shipment emitter
207
- # And a characteristic "origin_timestamp" of "<origin>"
208
- # And a characteristic "destination_timestamp" of "<destination>"
209
- # When the "duration" committee is calculated
210
- # Then the committee should have used quorum "from timestamps"
211
- # And the conclusion of the committee should be "<duration>"
212
- # Examples:
213
- # | origin | destination | duration |
214
- # | 2010-01-01T00:00:00Z | 2010-01-02T01:30:00Z | 01:30:00 | same timezone
215
- # | 2010-01-01T00:00:00Z | 2010-01-02T09:30:00+08:00 | 01:30:00 | different timezones
216
- # | 2010-01-01T00:00:00Z | 2009-12-31T20:30:00-05:00 | 01:30:00 | timezone change causes different days
217
- # | 2010-01-01T12:00:00+12:00 | 2009-12-31T13:30:00-12:00 | 01:30:00 | cross intl date line eastwards
218
- # | 2010-01-01T12:00:00-12:00 | 2009-01-02T13:30:00+12:00 | 01:30:00 | cross intl date line westwards
@@ -6,7 +6,7 @@ Feature: Shipment Emissions Calculations
6
6
  When emissions are calculated
7
7
  Then the emission value should be within "0.1" kgs of "8.7"
8
8
 
9
- Scenario: Calculations from weight, package count and segment count
9
+ Scenario: Calculations from weight, package count, segment count
10
10
  Given a shipment has "weight" of "10"
11
11
  And it has "package_count" of "2"
12
12
  And it has "segment_count" of "1"
@@ -14,15 +14,14 @@ Feature: Shipment Emissions Calculations
14
14
  Then the emission value should be within "0.1" kgs of "25.4"
15
15
 
16
16
  Scenario Outline: Calculations from origin/destination
17
- Given a shipment has "origin_zip_code.name" of "<origin>"
18
- And it has "destination_zip_code.name" of "<destination>"
19
- And mapquest determines the distance to be "<distance>"
17
+ Given a shipment has "origin" of "<origin>"
18
+ And it has "destination" of "<destination>"
20
19
  When emissions are calculated
21
20
  Then the emission value should be within "0.1" kgs of "<emission>"
22
21
  Examples:
23
- | origin | destination | mapquest_distance | emission |
24
- | 05401 | 05401 | | 0.3 |
25
- | 05401 | 94128 | 30 | 20.8 |
22
+ | origin | destination | emission |
23
+ | 05401 | 488 Haight Street, San Francisco, CA | 57.74974 |
24
+ | 05401 | Canterbury, Kent, UK | 74.82651 |
26
25
 
27
26
  Scenario: Calculations from carrier
28
27
  Given a shipment has "carrier.name" of "FedEx"
@@ -41,15 +40,15 @@ Feature: Shipment Emissions Calculations
41
40
 
42
41
  Scenario Outline: Calculations from mode and origin/destination
43
42
  Given a shipment has "mode.name" of "<mode>"
44
- And it has "origin_zip_code.name" of "<origin>"
45
- And it has "destination_zip_code.name" of "<destination>"
43
+ And it has "origin" of "<origin>"
44
+ And it has "destination" of "<destination>"
46
45
  When emissions are calculated
47
46
  Then the emission value should be within "0.1" kgs of "<emission>"
48
47
  Examples:
49
- | mode | origin | destination | emission |
50
- | courier | 05401 | 05401 | 2.3 |
51
- | ground | 05401 | 05401 | 0.3 |
52
- | air | 05401 | 05401 | 0.3 |
53
- | courier | 05401 | 94128 | 2.3 |
54
- | ground | 05401 | 94128 | 25296.2 |
55
- | air | 05401 | 94128 | 139127.8 |
48
+ | mode | origin | destination | emission |
49
+ | courier | 05753 | Address: 488 Haight Street, San Francisco, CA | 2.318 |
50
+ | courier | 05753 | Address: Canterbury, Kent, UK | 2.318 |
51
+ | ground | 05753 | Address: 488 Haight Street, San Francisco, CA | 71283.88938 |
52
+ | ground | 05753 | Address: Canterbury, Kent, UK | 92673.96537 |
53
+ | air | 05753 | Address: 488 Haight Street, San Francisco, CA | 392059.96060 |
54
+ | air | 05753 | Address: Canterbury, Kent, UK | 509705.37857 |
@@ -8,4 +8,4 @@ require 'rspec/expectations'
8
8
  require 'cucumber/rspec/doubles'
9
9
 
10
10
  require 'sniff'
11
- Sniff.init File.join(File.dirname(__FILE__), '..', '..'), :cucumber => true, :earth => [:locality, :shipping]
11
+ Sniff.init File.join(File.dirname(__FILE__), '..', '..'), :cucumber => true, :earth => [:shipping]
@@ -3,6 +3,7 @@
3
3
  # Contact Brighter Planet for dual-license arrangements.
4
4
 
5
5
  require File.expand_path('../../vendor/plugin/mapquest/lib/mapquest_directions', File.dirname(__FILE__))
6
+ require 'geokit'
6
7
 
7
8
  ## Shipment carbon model
8
9
  # This model is used by [Brighter Planet](http://brighterplanet.com)'s carbon emission [web service](http://carbon.brighterplanet.com) to estimate the **greenhouse gas emissions of a shipment** (e.g. a FedEx package).
@@ -44,14 +45,12 @@ module BrighterPlanet
44
45
  end
45
46
 
46
47
  committee :transport_emission do
47
- quorum 'from mode, weight, adjusted distance, and transport emission factor', :needs => [:mode, :weight, :adjusted_distance, :transport_emission_factor] do |characteristics|
48
+ quorum 'from weight, adjusted distance, and transport emission factor', :needs => [:weight, :adjusted_distance, :transport_emission_factor] do |characteristics|
48
49
  # we're assuming here that the number of stops, rather than number of packages carried, is limiting factor on local delivery routes
49
- if characteristics[:mode].name == "courier"
50
- characteristics[:transport_emission_factor]
51
- elsif characteristics[:weight] > 0
50
+ if characteristics[:weight] > 0
52
51
  characteristics[:weight] * characteristics[:adjusted_distance] * characteristics[:transport_emission_factor]
53
52
  else
54
- raise "Invalid weight: #{:weight} (must be > 0)"
53
+ raise "Invalid weight: :weight (must be > 0)"
55
54
  end
56
55
  end
57
56
  end
@@ -60,11 +59,23 @@ module BrighterPlanet
60
59
  quorum 'from carrier', :needs => :carrier, do |characteristics|
61
60
  characteristics[:carrier].corporate_emission_factor
62
61
  end
62
+
63
+ quorum 'default' do
64
+ Carrier.fallback.corporate_emission_factor
65
+ end
63
66
  end
64
67
 
65
68
  committee :transport_emission_factor do
66
- quorum 'from mode', :needs => :mode do |characteristics|
67
- characteristics[:mode].transport_emission_factor
69
+ quorum 'from mode, weight, and adjusted distance', :needs => [:mode, :weight, :adjusted_distance] do |characteristics|
70
+ if characteristics[:mode].name == "courier"
71
+ characteristics[:mode].transport_emission_factor / (characteristics[:weight] * characteristics[:adjusted_distance])
72
+ else
73
+ characteristics[:mode].transport_emission_factor
74
+ end
75
+ end
76
+
77
+ quorum 'default' do
78
+ ShipmentMode.fallback.transport_emission_factor
68
79
  end
69
80
  end
70
81
 
@@ -74,18 +85,17 @@ module BrighterPlanet
74
85
  end
75
86
 
76
87
  quorum 'default' do
77
- # ASSUMED: arbitrary
78
- 3219
88
+ 3219 # ASSUMED: arbitrary
79
89
  end
80
90
  end
81
-
91
+
82
92
  committee :dogleg_factor do
83
- quorum 'from segment count', :appreciates => :segment_count do |characteristics|
84
- if characteristics[:segment_count] == 1
85
- 1.0
93
+ quorum 'from segment count', :needs => :segment_count do |characteristics|
94
+ if characteristics[:segment_count] > 0
95
+ # ASSUMED arbitrary
96
+ 1.5 ** (characteristics[:segment_count] - 1)
86
97
  else
87
- # based on our sample FedEx tracking numbers
88
- 1.8
98
+ 1.8 # based on our sample FedEx tracking numbers
89
99
  end
90
100
  end
91
101
  end
@@ -94,52 +104,76 @@ module BrighterPlanet
94
104
  quorum 'from mode', :needs => :mode do |characteristics|
95
105
  characteristics[:mode].route_inefficiency_factor
96
106
  end
107
+
108
+ quorum 'default' do
109
+ ShipmentMode.fallback.route_inefficiency_factor
110
+ end
97
111
  end
98
112
 
99
113
  committee :distance do
100
- quorum 'from same locality', :needs => [:origin_zip_code, :destination_zip_code] do |characteristics|
101
- if characteristics[:origin_zip_code] == characteristics[:destination_zip_code]
114
+ quorum 'from same locality', :needs => [:origin_location, :destination_location] do |characteristics|
115
+ if characteristics[:origin_location] == characteristics[:destination_location]
102
116
  0
103
- else
104
- nil
105
117
  end
106
118
  end
107
- quorum 'from mapquest', :needs => [:origin_zip_code, :destination_zip_code, :mode, :mapquest_api_key] do |characteristics|
119
+ quorum 'from mapquest', :needs => [:origin_location, :destination_location, :mode, :mapquest_api_key] do |characteristics|
108
120
  unless characteristics[:mode].name == 'air'
109
- mapquest = MapQuestDirections.new characteristics[:origin_zip_code].name,
110
- characteristics[:destination_zip_code].name,
121
+ mapquest = MapQuestDirections.new characteristics[:origin_location],
122
+ characteristics[:destination_location],
111
123
  characteristics[:mapquest_api_key]
112
124
  mapquest.distance_in_miles
113
125
  end
114
126
  end
115
- quorum 'from direct path', :needs => [:origin_zip_code, :destination_zip_code, :mode] do |characteristics|
116
- characteristics[:origin_zip_code].distance_to(characteristics[:destination_zip_code], :units => :kms)
127
+ quorum 'from direct path', :needs => [:origin_location, :destination_location] do |characteristics|
128
+ Mapper.distance_between(
129
+ characteristics[:origin_location],
130
+ characteristics[:destination_location],
131
+ :units => :kms)
117
132
  end
118
133
  end
119
-
120
- committee :mode do
134
+
135
+ committee :segment_count do
121
136
  quorum 'default' do
122
- ShipmentMode.fallback
137
+ # ASSUMED based on the fact that FedEx has a hub-spoke system with central and regional distribution centers so seems reasonable for average package to go through four FedEx facilities
138
+ 5
123
139
  end
124
140
  end
125
141
 
126
- committee :carrier do
127
- quorum 'default' do
128
- Carrier.fallback
142
+ committee :destination_location do
143
+ quorum 'from destination', :needs => :destination do |characteristics|
144
+ code = Geokit::Geocoders::MultiGeocoder.geocode characteristics[:destination].to_s
145
+ code.ll == ',' ? nil : code.ll
146
+ end
147
+ end
148
+
149
+ committee :destination do
150
+ quorum 'from destination_zip_code', :needs => :destination_zip_code do |characteristics|
151
+ characteristics[:destination_zip_code]
152
+ end
153
+ end
154
+
155
+ committee :origin_location do
156
+ quorum 'from origin', :needs => :origin do |characteristics|
157
+ code = Geokit::Geocoders::MultiGeocoder.geocode characteristics[:origin].to_s
158
+ code.ll == ',' ? nil : code.ll
159
+ end
160
+ end
161
+
162
+ committee :origin do
163
+ quorum 'from origin_zip_code', :needs => :origin_zip_code do |characteristics|
164
+ characteristics[:origin_zip_code]
129
165
  end
130
166
  end
131
167
 
132
168
  committee :package_count do
133
169
  quorum 'default' do
134
- # ASSUMED arbitrary
135
- 1
170
+ 1 # ASSUMED arbitrary
136
171
  end
137
172
  end
138
173
 
139
174
  committee :weight do
140
175
  quorum 'default' do
141
- # ASSUMED based on average FedEx air package weight of 7.5 lbs
142
- 3.4
176
+ 3.4 # ASSUMED based on average FedEx air package weight of 7.5 lbs
143
177
  end
144
178
  end
145
179
 
@@ -150,6 +184,10 @@ module BrighterPlanet
150
184
  end
151
185
  end
152
186
  end
187
+
188
+ class Mapper
189
+ include Geokit::Mappable
190
+ end
153
191
  end
154
192
  end
155
193
  end
@@ -8,6 +8,8 @@ module BrighterPlanet
8
8
  has :carrier
9
9
  has :mode
10
10
  has :segment_count
11
+ has :origin
12
+ has :destination
11
13
  has :origin_zip_code
12
14
  has :destination_zip_code
13
15
  has :mapquest_api_key, :display => lambda { |key| "secret key" }
data/lib/shipment/data.rb CHANGED
@@ -9,8 +9,10 @@ module BrighterPlanet
9
9
  string 'carrier_name'
10
10
  string 'mode_name'
11
11
  integer 'segment_count'
12
- string 'origin_zip_code_name'
13
- string 'destination_zip_code_name'
12
+ string 'origin'
13
+ string 'destination'
14
+ string 'origin_zip_code'
15
+ string 'destination_zip_code'
14
16
  string 'mapquest_api_key'
15
17
  end
16
18
 
@@ -2,10 +2,8 @@ module BrighterPlanet
2
2
  module Shipment
3
3
  module Relationships
4
4
  def self.included(base)
5
- base.belongs_to :carrier, :foreign_key => 'carrier_name', :primary_key => 'name'
6
- base.belongs_to :origin_zip_code, :foreign_key => 'zip_code_name', :primary_key => 'name', :class_name => 'ZipCode'
7
- base.belongs_to :destination_zip_code, :foreign_key => 'zip_code_name', :primary_key => 'name', :class_name => 'ZipCode'
8
- base.belongs_to :mode, :foreign_key => 'mode_name', :primary_key => 'name', :class_name => 'ShipmentMode'
5
+ base.belongs_to :carrier, :foreign_key => 'carrier_name', :primary_key => 'name'
6
+ base.belongs_to :mode, :foreign_key => 'mode_name', :primary_key => 'name', :class_name => 'ShipmentMode'
9
7
  end
10
8
  end
11
9
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 5
9
- version: 0.0.5
8
+ - 6
9
+ version: 0.0.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - Andy Rossmeissl
@@ -65,7 +65,7 @@ dependencies:
65
65
  prerelease: false
66
66
  version_requirements: *id003
67
67
  - !ruby/object:Gem::Dependency
68
- name: sniff
68
+ name: emitter
69
69
  requirement: &id004 !ruby/object:Gem::Requirement
70
70
  none: false
71
71
  requirements:
@@ -73,14 +73,14 @@ dependencies:
73
73
  - !ruby/object:Gem::Version
74
74
  segments:
75
75
  - 0
76
- - 4
77
76
  - 3
78
- version: 0.4.3
79
- type: :development
77
+ - 0
78
+ version: 0.3.0
79
+ type: :runtime
80
80
  prerelease: false
81
81
  version_requirements: *id004
82
82
  - !ruby/object:Gem::Dependency
83
- name: emitter
83
+ name: earth
84
84
  requirement: &id005 !ruby/object:Gem::Requirement
85
85
  none: false
86
86
  requirements:
@@ -89,23 +89,21 @@ dependencies:
89
89
  segments:
90
90
  - 0
91
91
  - 3
92
- - 0
93
- version: 0.3.0
92
+ - 8
93
+ version: 0.3.8
94
94
  type: :runtime
95
95
  prerelease: false
96
96
  version_requirements: *id005
97
97
  - !ruby/object:Gem::Dependency
98
- name: earth
98
+ name: geokit
99
99
  requirement: &id006 !ruby/object:Gem::Requirement
100
100
  none: false
101
101
  requirements:
102
- - - ~>
102
+ - - ">="
103
103
  - !ruby/object:Gem::Version
104
104
  segments:
105
105
  - 0
106
- - 3
107
- - 8
108
- version: 0.3.8
106
+ version: "0"
109
107
  type: :runtime
110
108
  prerelease: false
111
109
  version_requirements: *id006
@@ -151,7 +149,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
151
149
  requirements:
152
150
  - - ">="
153
151
  - !ruby/object:Gem::Version
154
- hash: 682105265
152
+ hash: -38437523
155
153
  segments:
156
154
  - 0
157
155
  version: "0"