carbon 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/bin/carbon CHANGED
File without changes
@@ -26,6 +26,7 @@ module Carbon
26
26
  attr_accessor :timeframe
27
27
  attr_accessor :certified
28
28
  attr_accessor :guid
29
+ attr_accessor :comply
29
30
  attr_reader :emitter
30
31
 
31
32
  def initialize(emitter, options = {})
@@ -33,7 +34,7 @@ module Carbon
33
34
  take_options options unless options.empty?
34
35
  end
35
36
 
36
- VALID_OPTIONS = [:callback_content_type, :key, :callback, :timeframe, :guid, :timeout, :defer, :certified]
37
+ VALID_OPTIONS = [:callback_content_type, :key, :callback, :timeframe, :guid, :timeout, :defer, :certified, :comply]
37
38
 
38
39
  def take_options(options) #:nodoc:
39
40
  return if options.blank?
@@ -72,6 +72,7 @@ module Carbon
72
72
  end
73
73
  hash[:timeframe] = parent.timeframe if parent.timeframe
74
74
  hash[:key] = parent.key if parent.key
75
+ hash[:comply] = parent.comply if parent.comply
75
76
  hash
76
77
  end
77
78
 
@@ -1,3 +1,3 @@
1
1
  module Carbon
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
  end
@@ -19,6 +19,10 @@ describe Carbon::EmissionEstimate::Request do
19
19
  request.should_receive :validate
20
20
  request.params
21
21
  end
22
+ it 'includes compliance' do
23
+ emission_estimate.comply = :iso
24
+ request.params.should include(:comply => :iso)
25
+ end
22
26
  end
23
27
 
24
28
  describe '#validate' do
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+
3
+ describe Carbon::EmissionEstimate do
4
+ describe '#take_options' do
5
+ it 'accepts the :comply option' do
6
+ estimate = Carbon::EmissionEstimate.new(RentalCar.new)
7
+ estimate.take_options :comply => :iso
8
+ estimate.comply.should == :iso
9
+ end
10
+ end
11
+ end
12
+
@@ -89,48 +89,6 @@ FakeWeb.register_uri :get,
89
89
  # }.to_json,
90
90
  # :headers => { 'Location' => "http://storage.carbon.brighterplanet.com/#{Digest::SHA1.hexdigest(KEY+MISSING_UNIQUE_ID)}" }
91
91
 
92
- class RentalCar
93
- include Carbon
94
- attr_accessor :model, :model_year, :fuel_economy
95
- class Make
96
- attr_accessor :name
97
- def to_param
98
- name
99
- end
100
- end
101
- def make
102
- @make ||= Make.new
103
- end
104
- emit_as :automobile_trip do
105
- provide :make
106
- provide :model
107
- provide :model_year
108
- provide :fuel_economy, :as => :fuel_efficiency
109
- end
110
- end
111
-
112
- class DonutFactory
113
- include Carbon
114
- attr_accessor :smokestack_size, :oven_count, :employees
115
- class Mixer
116
- attr_accessor :upc
117
- def to_param
118
- raise "Use #to_characteristic instead please"
119
- end
120
- def to_characteristic
121
- upc
122
- end
123
- end
124
- def mixer
125
- @mixer ||= Mixer.new
126
- end
127
- emit_as :factory do
128
- provide :smokestack_size
129
- provide :oven_count
130
- provide :employees, :as => :personnel
131
- provide :mixer, :key => :upc
132
- end
133
- end
134
92
 
135
93
  # set up timeouts
136
94
  module Carbon
@@ -334,6 +292,11 @@ describe Carbon do
334
292
  c = RentalCar.new
335
293
  c.emission_estimate(:certified => true).should == 54321
336
294
  end
295
+
296
+ it 'complies to given standards' do
297
+ c = RentalCar.new
298
+ c.emission_estimate(:comply => :iso).request.body.should =~ /comply=iso/
299
+ end
337
300
  end
338
301
 
339
302
  describe 'asynchronous (queued) requests' do
@@ -9,3 +9,46 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
9
9
  require 'carbon'
10
10
 
11
11
  Carbon.log = Logger.new nil
12
+
13
+ class RentalCar
14
+ include Carbon
15
+ attr_accessor :model, :model_year, :fuel_economy
16
+ class Make
17
+ attr_accessor :name
18
+ def to_param
19
+ name
20
+ end
21
+ end
22
+ def make
23
+ @make ||= Make.new
24
+ end
25
+ emit_as :automobile_trip do
26
+ provide :make
27
+ provide :model
28
+ provide :model_year
29
+ provide :fuel_economy, :as => :fuel_efficiency
30
+ end
31
+ end
32
+
33
+ class DonutFactory
34
+ include Carbon
35
+ attr_accessor :smokestack_size, :oven_count, :employees
36
+ class Mixer
37
+ attr_accessor :upc
38
+ def to_param
39
+ raise "Use #to_characteristic instead please"
40
+ end
41
+ def to_characteristic
42
+ upc
43
+ end
44
+ end
45
+ def mixer
46
+ @mixer ||= Mixer.new
47
+ end
48
+ emit_as :factory do
49
+ provide :smokestack_size
50
+ provide :oven_count
51
+ provide :employees, :as => :personnel
52
+ provide :mixer, :key => :upc
53
+ end
54
+ end
metadata CHANGED
@@ -1,8 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carbon
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 17
4
5
  prerelease:
5
- version: 1.1.0
6
+ segments:
7
+ - 1
8
+ - 1
9
+ - 1
10
+ version: 1.1.1
6
11
  platform: ruby
7
12
  authors:
8
13
  - Derek Kastner
@@ -12,7 +17,7 @@ autorequire:
12
17
  bindir: bin
13
18
  cert_chain: []
14
19
 
15
- date: 2011-04-04 00:00:00 -05:00
20
+ date: 2011-04-04 00:00:00 -04:00
16
21
  default_executable:
17
22
  dependencies:
18
23
  - !ruby/object:Gem::Dependency
@@ -23,6 +28,11 @@ dependencies:
23
28
  requirements:
24
29
  - - ">="
25
30
  - !ruby/object:Gem::Version
31
+ hash: 9
32
+ segments:
33
+ - 2
34
+ - 3
35
+ - 5
26
36
  version: 2.3.5
27
37
  type: :runtime
28
38
  version_requirements: *id001
@@ -34,6 +44,9 @@ dependencies:
34
44
  requirements:
35
45
  - - ">="
36
46
  - !ruby/object:Gem::Version
47
+ hash: 3
48
+ segments:
49
+ - 0
37
50
  version: "0"
38
51
  type: :runtime
39
52
  version_requirements: *id002
@@ -45,6 +58,9 @@ dependencies:
45
58
  requirements:
46
59
  - - ">="
47
60
  - !ruby/object:Gem::Version
61
+ hash: 3
62
+ segments:
63
+ - 0
48
64
  version: "0"
49
65
  type: :runtime
50
66
  version_requirements: *id003
@@ -56,6 +72,9 @@ dependencies:
56
72
  requirements:
57
73
  - - ">="
58
74
  - !ruby/object:Gem::Version
75
+ hash: 3
76
+ segments:
77
+ - 0
59
78
  version: "0"
60
79
  type: :runtime
61
80
  version_requirements: *id004
@@ -67,6 +86,9 @@ dependencies:
67
86
  requirements:
68
87
  - - ">="
69
88
  - !ruby/object:Gem::Version
89
+ hash: 3
90
+ segments:
91
+ - 0
70
92
  version: "0"
71
93
  type: :runtime
72
94
  version_requirements: *id005
@@ -78,6 +100,9 @@ dependencies:
78
100
  requirements:
79
101
  - - ">="
80
102
  - !ruby/object:Gem::Version
103
+ hash: 3
104
+ segments:
105
+ - 0
81
106
  version: "0"
82
107
  type: :runtime
83
108
  version_requirements: *id006
@@ -89,6 +114,9 @@ dependencies:
89
114
  requirements:
90
115
  - - ">="
91
116
  - !ruby/object:Gem::Version
117
+ hash: 3
118
+ segments:
119
+ - 0
92
120
  version: "0"
93
121
  type: :runtime
94
122
  version_requirements: *id007
@@ -100,6 +128,9 @@ dependencies:
100
128
  requirements:
101
129
  - - ">="
102
130
  - !ruby/object:Gem::Version
131
+ hash: 3
132
+ segments:
133
+ - 0
103
134
  version: "0"
104
135
  type: :runtime
105
136
  version_requirements: *id008
@@ -111,6 +142,9 @@ dependencies:
111
142
  requirements:
112
143
  - - ">="
113
144
  - !ruby/object:Gem::Version
145
+ hash: 3
146
+ segments:
147
+ - 0
114
148
  version: "0"
115
149
  type: :development
116
150
  version_requirements: *id009
@@ -122,6 +156,9 @@ dependencies:
122
156
  requirements:
123
157
  - - ">="
124
158
  - !ruby/object:Gem::Version
159
+ hash: 3
160
+ segments:
161
+ - 0
125
162
  version: "0"
126
163
  type: :development
127
164
  version_requirements: *id010
@@ -133,6 +170,9 @@ dependencies:
133
170
  requirements:
134
171
  - - ">="
135
172
  - !ruby/object:Gem::Version
173
+ hash: 3
174
+ segments:
175
+ - 0
136
176
  version: "0"
137
177
  type: :development
138
178
  version_requirements: *id011
@@ -172,6 +212,7 @@ files:
172
212
  - lib/carbon/version.rb
173
213
  - spec/lib/carbon/emission_estimate/request_spec.rb
174
214
  - spec/lib/carbon/emission_estimate/response_spec.rb
215
+ - spec/lib/carbon/emission_estimate_spec.rb
175
216
  - spec/lib/carbon_spec.rb
176
217
  - spec/spec_helper.rb
177
218
  - spec/specwatchr
@@ -189,12 +230,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
189
230
  requirements:
190
231
  - - ">="
191
232
  - !ruby/object:Gem::Version
233
+ hash: 3
234
+ segments:
235
+ - 0
192
236
  version: "0"
193
237
  required_rubygems_version: !ruby/object:Gem::Requirement
194
238
  none: false
195
239
  requirements:
196
240
  - - ">="
197
241
  - !ruby/object:Gem::Version
242
+ hash: 3
243
+ segments:
244
+ - 0
198
245
  version: "0"
199
246
  requirements: []
200
247
 
@@ -203,11 +250,5 @@ rubygems_version: 1.6.2
203
250
  signing_key:
204
251
  specification_version: 3
205
252
  summary: Carbon is a Ruby API wrapper for the Brighter Planet emission estimate web service (http://carbon.brighterplanet.com).
206
- test_files:
207
- - features/shell.feature
208
- - features/support/env.rb
209
- - spec/lib/carbon/emission_estimate/request_spec.rb
210
- - spec/lib/carbon/emission_estimate/response_spec.rb
211
- - spec/lib/carbon_spec.rb
212
- - spec/spec_helper.rb
213
- - spec/specwatchr
253
+ test_files: []
254
+