purchase 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/purchase/carbon_model.rb +5 -0
  2. metadata +6 -6
@@ -6,6 +6,7 @@ module BrighterPlanet
6
6
  module CarbonModel
7
7
  class MissingSectorForProductLineSector < Exception; end
8
8
  class MissingEmissionFactor < Exception; end
9
+ class MissingSectorForIndustrySector < Exception; end
9
10
 
10
11
  def self.included(base)
11
12
  base.extend ::Leap::Subject
@@ -134,6 +135,10 @@ module BrighterPlanet
134
135
  industry_share = industry_shares.find_by_naics_code naics_code
135
136
  calculated_share = industry_share.ratio * industry_sector.ratio
136
137
  sector = industry_sector.sector
138
+ if sector.nil?
139
+ raise MissingSectorForIndustrySector,
140
+ "Missing a related sector for IndustrySector #{industry_sector.inspect}"
141
+ end
137
142
  hash[io_code] = {
138
143
  :share => calculated_share,
139
144
  :emission_factor => sector.emission_factor
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: purchase
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andy Rossmeissl
@@ -207,12 +207,12 @@ dependencies:
207
207
  requirements:
208
208
  - - ">="
209
209
  - !ruby/object:Gem::Version
210
- hash: 61
210
+ hash: 57
211
211
  segments:
212
212
  - 0
213
213
  - 0
214
- - 17
215
- version: 0.0.17
214
+ - 19
215
+ version: 0.0.19
216
216
  requirement: *id012
217
217
  - !ruby/object:Gem::Dependency
218
218
  type: :runtime