carbon 0.2.3 → 0.2.4
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/VERSION +1 -1
- data/carbon.gemspec +1 -1
- data/lib/carbon/emission_estimate.rb +1 -1
- data/lib/carbon/emission_estimate/response.rb +4 -0
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.4
|
data/carbon.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{carbon}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Derek Kastner", "Seamus Abshere", "Andy Rossmeissl"]
|
@@ -76,7 +76,7 @@ module Carbon
|
|
76
76
|
end
|
77
77
|
# The timeframe being looked at in the emission calculation.
|
78
78
|
def active_subtimeframe
|
79
|
-
|
79
|
+
response.data['active_subtimeframe']
|
80
80
|
end
|
81
81
|
# Another way to access the emission value.
|
82
82
|
# Useful if you don't like treating <tt>EmissionEstimate</tt> objects like <tt>Numeric</tt> objects (even though they do quack like numbers...)
|
@@ -26,8 +26,12 @@ module Carbon
|
|
26
26
|
end
|
27
27
|
raise ::Carbon::RealtimeEstimateFailed unless response.success?
|
28
28
|
@data = ::ActiveSupport::JSON.decode response.body
|
29
|
+
instantiate_known_response_objects
|
29
30
|
@number = data['emission'].to_f.freeze
|
30
31
|
end
|
32
|
+
def instantiate_known_response_objects # :nodoc:
|
33
|
+
data['active_subtimeframe'] = ::Timeframe.interval(data['active_subtimeframe']) if data.has_key? 'active_subtimeframe'
|
34
|
+
end
|
31
35
|
def load_async_data # :nodoc:
|
32
36
|
response = perform
|
33
37
|
raise ::Carbon::QueueingFailed unless response.success?
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carbon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 4
|
10
|
+
version: 0.2.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Derek Kastner
|