barometer-forecast_io 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f2cde19f63c1dcca98b85876496732a634d8022d
4
+ data.tar.gz: 801f3b8e20ee1fc88c63db889a549f38fd69c573
5
+ SHA512:
6
+ metadata.gz: 58d20087104e0fb8bf0ec94e3f5e7d46a395b088d2cf67f71eeab1821c30f15ae92dd889262e5353f936de0e0c820ffa9357de440b9c93d6b80cf716425e50c8
7
+ data.tar.gz: ac5e2d7468427c00c5d9a28d58e73facd3afc8a9bd3c1615f2a9faedee92bf635f1e0fc98d3ecc5a6e18e26921dc5b7755c549c153aa5d11eea13c75d17722c4
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Mark G
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,43 @@
1
+ # Barometer::ForecastIo
2
+
3
+ A wrapper for the forecast.io weather API. This wrapper is
4
+ barometer compatiable and can be used with or without barometer.
5
+
6
+ ## Usage
7
+
8
+ This wrapper was designed to be used via [Barometer](https://github.com/attack/barometer), or on its own.
9
+
10
+ ### Directly
11
+
12
+ By using this wrapper directly, you lose any Barometer aggregation and
13
+ failover capabilities. Barometer is still dependency to provide a
14
+ framework for query conversion, weather service integration and data
15
+ processing.
16
+
17
+ ```ruby
18
+ query = Barometer::Query.new('42.7243,-73.6927')
19
+ keys = {api: 'forecast io apikey'}
20
+
21
+ result = Barometer::ForecastIo.call(query, keys: keys)
22
+ puts result.current.temperature.c
23
+ ```
24
+
25
+ ### via Barometer
26
+
27
+ Barometer is a weather service framework, providing aggregation and failover
28
+ capabilities. To make forecast.io available to Barometer, you must register
29
+ it as an available weather service.
30
+
31
+ ```ruby
32
+ Barometer::WeatherService.register(:forecast_io, Barometer::ForecastIo)
33
+ ```
34
+
35
+ Then follow the instructions provided by [Barometer](https://github.com/attack/barometer).
36
+
37
+ ## Contributing
38
+
39
+ 1. Fork it
40
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
41
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
42
+ 4. Push to the branch (`git push origin my-new-feature`)
43
+ 5. Create new Pull Request
@@ -0,0 +1,11 @@
1
+ require 'rake'
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec) do |spec|
7
+ spec.pattern = 'spec/**/*_spec.rb'
8
+ spec.rspec_opts = ['--color']
9
+ end
10
+
11
+ task default: :spec
@@ -0,0 +1,31 @@
1
+ # encoding: utf-8
2
+ $:.push File.expand_path('../lib', __FILE__)
3
+ require 'barometer/forecast_io/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'barometer-forecast_io'
7
+ spec.version = Barometer::ForecastIo::VERSION
8
+ spec.platform = Gem::Platform::RUBY
9
+ spec.authors = ['Mark G']
10
+ spec.email = ['barometer@attackcorp.com']
11
+ spec.description = 'A barometer wrapper for Forecast.io'
12
+ spec.summary = spec.description
13
+ spec.homepage = 'http://github.com/attack/barometer-forecast_io'
14
+ spec.license = 'MIT'
15
+
16
+ spec.required_ruby_version = '>= 1.9.2'
17
+
18
+ spec.files = `git ls-files`.split($/)
19
+ spec.test_files = spec.files.grep(%r{^spec/})
20
+ spec.require_paths = ['lib']
21
+
22
+ spec.add_dependency 'barometer', '~> 0.9.3'
23
+
24
+ spec.add_development_dependency 'bundler', '~> 1.3'
25
+ spec.add_development_dependency 'rake'
26
+ spec.add_development_dependency 'rspec', '>= 2.11'
27
+ spec.add_development_dependency 'webmock'
28
+ spec.add_development_dependency 'pry'
29
+ spec.add_development_dependency 'vcr'
30
+ spec.add_development_dependency 'barometer-support'
31
+ end
@@ -0,0 +1,36 @@
1
+ require 'barometer'
2
+ require_relative 'forecast_io/version'
3
+ require_relative 'forecast_io/api'
4
+ require_relative 'forecast_io/response'
5
+
6
+ module Barometer
7
+ class ForecastIo
8
+ def self.call(query, config={})
9
+ ForecastIo.new(query, config).measure!
10
+ end
11
+
12
+ def initialize(query, config={})
13
+ @query = query
14
+ @apikey = config[:keys][:api] if config[:keys]
15
+ end
16
+
17
+ def measure!
18
+ validate_key!
19
+
20
+ api = ForecastIo::Api.new(query, apikey)
21
+ ForecastIo::Response.new.parse(api.get)
22
+ end
23
+
24
+ private
25
+
26
+ attr_reader :query, :apikey
27
+
28
+ def validate_key!
29
+ unless apikey && !apikey.empty?
30
+ raise Barometer::WeatherService::KeyRequired
31
+ end
32
+ end
33
+ end
34
+ end
35
+
36
+ Barometer::WeatherService.register(:forecast_io, Barometer::ForecastIo)
@@ -0,0 +1,20 @@
1
+ require_relative 'query'
2
+
3
+ module Barometer
4
+ class ForecastIo
5
+ class Api < Utils::Api
6
+ def initialize(query, api_code)
7
+ @query = ForecastIo::Query.new(query)
8
+ @api_code = api_code
9
+ end
10
+
11
+ def url
12
+ "https://api.forecast.io/forecast/#{@api_code}/#{@query.to_param}"
13
+ end
14
+
15
+ def params
16
+ @query.units_param
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,36 @@
1
+ require 'delegate'
2
+
3
+ module Barometer
4
+ class ForecastIo
5
+ class Query < SimpleDelegator
6
+ attr_reader :converted_query
7
+
8
+ def self.accepted_formats
9
+ [:coordinates]
10
+ end
11
+
12
+ def initialize(query)
13
+ super
14
+ @converted_query = convert_query
15
+ end
16
+
17
+ def to_param
18
+ @converted_query.q
19
+ end
20
+
21
+ def units_param
22
+ {units: unit_type}
23
+ end
24
+
25
+ private
26
+
27
+ def convert_query
28
+ convert!(*self.class.accepted_formats)
29
+ end
30
+
31
+ def unit_type
32
+ converted_query.metric? ? 'si' : 'us'
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,29 @@
1
+ require_relative 'response/timezone'
2
+ require_relative 'response/location'
3
+ require_relative 'response/current_weather'
4
+ require_relative 'response/forecasted_weather'
5
+
6
+ module Barometer
7
+ class ForecastIo
8
+ class Response
9
+ def initialize
10
+ @response = Barometer::Response.new
11
+ end
12
+
13
+ def parse(payload)
14
+ response.add_query(payload.query)
15
+
16
+ response.timezone = ForecastIo::Response::TimeZone.new(payload).parse
17
+ response.location = ForecastIo::Response::Location.new(payload).parse
18
+ response.current = ForecastIo::Response::CurrentWeather.new(payload).parse
19
+ response.forecast = ForecastIo::Response::ForecastedWeather.new(payload).parse
20
+
21
+ response
22
+ end
23
+
24
+ private
25
+
26
+ attr_reader :response
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,76 @@
1
+ module Barometer
2
+ class ForecastIo
3
+ class Response
4
+ class CurrentWeather
5
+ def initialize(payload)
6
+ @payload = payload
7
+ @current = Barometer::Response::Current.new
8
+ end
9
+
10
+ def parse
11
+ current.observed_at = observed_at
12
+ current.humidity = humidity
13
+ current.condition = condition
14
+ current.icon = icon
15
+ current.temperature = temperature
16
+ current.dew_point = dew_point
17
+ current.wind = wind
18
+ current.pressure = pressure
19
+ current.visibility = visibility
20
+
21
+ current
22
+ end
23
+
24
+ private
25
+
26
+ attr_reader :payload, :current
27
+
28
+ def units
29
+ payload.units
30
+ end
31
+
32
+ def observed_at
33
+ Time.at(payload.fetch('currently', 'time').to_i)
34
+ end
35
+
36
+ def humidity
37
+ payload.fetch('currently', 'humidity') * 100
38
+ end
39
+
40
+ def condition
41
+ payload.fetch('currently', 'summary')
42
+ end
43
+
44
+ def icon
45
+ payload.fetch('currently', 'icon')
46
+ end
47
+
48
+ def temperature
49
+ [units, payload.fetch('currently', 'temperature')]
50
+ end
51
+
52
+ def dew_point
53
+ [units, payload.fetch('currently', 'dewPoint')]
54
+ end
55
+
56
+ def wind
57
+ [units, convert_metre_per_second(payload.fetch('currently', 'windSpeed')), payload.fetch('currently', 'windBearing').to_i]
58
+ end
59
+
60
+ def pressure
61
+ [:metric, payload.fetch('currently', 'pressure')]
62
+ end
63
+
64
+ def visibility
65
+ [units, payload.fetch('currently', 'visibility')]
66
+ end
67
+
68
+ private
69
+
70
+ def convert_metre_per_second(value)
71
+ value.to_f * 60 * 60 / 1000
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,72 @@
1
+ module Barometer
2
+ class ForecastIo
3
+ class Response
4
+ class ForecastedWeather
5
+ def initialize(payload)
6
+ @payload = payload
7
+ @predictions = Barometer::Response::PredictionCollection.new
8
+ end
9
+
10
+ def parse
11
+ each_prediction do |prediction, forecast_payload|
12
+ prediction.starts_at = starts_at(forecast_payload)
13
+ prediction.ends_at = Utils::Time.add_one_day(prediction.starts_at)
14
+ prediction.icon = icon(forecast_payload)
15
+ prediction.condition = condition(forecast_payload)
16
+ prediction.high = high(forecast_payload)
17
+ prediction.low = low(forecast_payload)
18
+ prediction.sun = sun(forecast_payload, prediction.starts_at, prediction.ends_at)
19
+ end
20
+
21
+ predictions
22
+ end
23
+
24
+ private
25
+
26
+ attr_reader :payload, :predictions
27
+
28
+ def units
29
+ payload.units
30
+ end
31
+
32
+ def each_prediction
33
+ payload.fetch_each('daily', 'data') do |forecast_payload|
34
+ predictions.build do |prediction|
35
+ yield prediction, forecast_payload
36
+ end
37
+ end
38
+ end
39
+
40
+ def starts_at(forecast_payload)
41
+ time(forecast_payload.fetch('time'))
42
+ end
43
+
44
+ def icon(forecast_payload)
45
+ forecast_payload.fetch('icon')
46
+ end
47
+
48
+ def condition(forecast_payload)
49
+ forecast_payload.fetch('summary')
50
+ end
51
+
52
+ def high(forecast_payload)
53
+ [units, forecast_payload.fetch('temperatureMax')]
54
+ end
55
+
56
+ def low(forecast_payload)
57
+ [units, forecast_payload.fetch('temperatureMin')]
58
+ end
59
+
60
+ def sun(forecast_payload, starts_at, ends_at)
61
+ utc_rise_time = time(forecast_payload.fetch('sunriseTime'))
62
+ utc_set_time = time(forecast_payload.fetch('sunsetTime'))
63
+ Data::Sun.new(rise: utc_rise_time, set: utc_set_time)
64
+ end
65
+
66
+ def time(timestamp)
67
+ Time.at(timestamp.to_i)
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,17 @@
1
+ module Barometer
2
+ class ForecastIo
3
+ class Response
4
+ class Location < WeatherService::Response::Location
5
+ private
6
+
7
+ def latitude
8
+ payload.fetch('latitude')
9
+ end
10
+
11
+ def longitude
12
+ payload.fetch('longitude')
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,23 @@
1
+ module Barometer
2
+ class ForecastIo
3
+ class Response
4
+ class TimeZone
5
+ def initialize(payload)
6
+ @payload = payload
7
+ end
8
+
9
+ def parse
10
+ Data::Zone.new(time_zone)
11
+ end
12
+
13
+ private
14
+
15
+ attr_reader :payload
16
+
17
+ def time_zone
18
+ payload.fetch('timezone')
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,5 @@
1
+ module Barometer
2
+ class ForecastIo
3
+ VERSION = '0.0.1'
4
+ end
5
+ end
@@ -0,0 +1 @@
1
+ {"http_interactions":[{"request":{"method":"get","uri":"https://api.forecast.io/forecast/FORECAST_IO_APIKEY/42.7243,-73.6927?units=si","body":{"encoding":"UTF-8","string":""},"headers":{"User-Agent":["HTTPClient/1.0 (2.3.4.1, ruby 2.0.0 (2013-06-27))"],"Accept":["*/*"],"Date":["Sat, 23 Nov 2013 19:20:40 GMT"]}},"response":{"status":{"code":200,"message":"OK"},"headers":{"Server":["nginx/1.1.19"],"Date":["Sat, 23 Nov 2013 19:20:40 GMT"],"Content-Type":["application/json; charset=utf-8"],"Content-Length":["29702"],"Connection":["close"],"X-Powered-By":["Express"],"X-Forecast-Api-Calls":["2"],"Cache-Control":["max-age=20"],"Expires":["Sat, 23 Nov 2013 19:21:00 +0000"],"Etag":["\"-620185316\""],"X-Response-Time":["336ms"]},"body":{"encoding":"UTF-8","string":"{\"latitude\":42.7243,\"longitude\":-73.6927,\"timezone\":\"America/New_York\",\"offset\":-5,\"currently\":{\"time\":1385234440,\"summary\":\"Mostly Cloudy\",\"icon\":\"partly-cloudy-day\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":4.449999999999999,\"apparentTemperature\":-0.19999999999999968,\"dewPoint\":-4.177777777777777,\"humidity\":0.53,\"windSpeed\":7.014057599999999,\"windBearing\":251,\"visibility\":16.09344,\"cloudCover\":0.64,\"pressure\":1011.86,\"ozone\":323.86},\"minutely\":{\"summary\":\"Drizzle in 50 min.\",\"icon\":\"rain\",\"data\":[{\"time\":1385234400,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385234460,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385234520,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385234580,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385234640,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385234700,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385234760,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385234820,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385234880,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385234940,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385235000,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385235060,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385235120,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385235180,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385235240,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385235300,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385235360,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385235420,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385235480,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385235540,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385235600,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385235660,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385235720,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385235780,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385235840,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385235900,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385235960,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385236020,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385236080,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385236140,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385236200,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385236260,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385236320,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385236380,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385236440,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385236500,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385236560,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385236620,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385236680,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385236740,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385236800,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385236860,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385236920,\"precipIntensity\":0,\"precipProbability\":0},{\"time\":1385236980,\"precipIntensity\":0.08381999999999999,\"precipIntensityError\":0.0381,\"precipProbability\":0.01,\"precipType\":\"rain\"},{\"time\":1385237040,\"precipIntensity\":0.09144,\"precipIntensityError\":0.04064,\"precipProbability\":0.01,\"precipType\":\"rain\"},{\"time\":1385237100,\"precipIntensity\":0.10414,\"precipIntensityError\":0.04826,\"precipProbability\":0.02,\"precipType\":\"rain\"},{\"time\":1385237160,\"precipIntensity\":0.11429999999999998,\"precipIntensityError\":0.05333999999999999,\"precipProbability\":0.03,\"precipType\":\"rain\"},{\"time\":1385237220,\"precipIntensity\":0.127,\"precipIntensityError\":0.06095999999999999,\"precipProbability\":0.07,\"precipType\":\"rain\"},{\"time\":1385237280,\"precipIntensity\":0.1397,\"precipIntensityError\":0.06858,\"precipProbability\":0.11,\"precipType\":\"rain\"},{\"time\":1385237340,\"precipIntensity\":0.14986,\"precipIntensityError\":0.07365999999999999,\"precipProbability\":0.15,\"precipType\":\"rain\"},{\"time\":1385237400,\"precipIntensity\":0.16763999999999998,\"precipIntensityError\":0.08381999999999999,\"precipProbability\":0.21,\"precipType\":\"rain\"},{\"time\":1385237460,\"precipIntensity\":0.18288,\"precipIntensityError\":0.08889999999999999,\"precipProbability\":0.25,\"precipType\":\"rain\"},{\"time\":1385237520,\"precipIntensity\":0.21081999999999998,\"precipIntensityError\":0.09906,\"precipProbability\":0.31,\"precipType\":\"rain\"},{\"time\":1385237580,\"precipIntensity\":0.23114,\"precipIntensityError\":0.10922,\"precipProbability\":0.4,\"precipType\":\"rain\"},{\"time\":1385237640,\"precipIntensity\":0.24891999999999997,\"precipIntensityError\":0.11683999999999999,\"precipProbability\":0.42,\"precipType\":\"rain\"},{\"time\":1385237700,\"precipIntensity\":0.27686,\"precipIntensityError\":0.12445999999999999,\"precipProbability\":0.44,\"precipType\":\"rain\"},{\"time\":1385237760,\"precipIntensity\":0.3048,\"precipIntensityError\":0.13207999999999998,\"precipProbability\":0.45,\"precipType\":\"rain\"},{\"time\":1385237820,\"precipIntensity\":0.3429,\"precipIntensityError\":0.14223999999999998,\"precipProbability\":0.52,\"precipType\":\"rain\"},{\"time\":1385237880,\"precipIntensity\":0.3937,\"precipIntensityError\":0.15494,\"precipProbability\":0.56,\"precipType\":\"rain\"},{\"time\":1385237940,\"precipIntensity\":0.42671999999999993,\"precipIntensityError\":0.16256,\"precipProbability\":0.56,\"precipType\":\"rain\"},{\"time\":1385238000,\"precipIntensity\":0.48767999999999995,\"precipIntensityError\":0.17779999999999999,\"precipProbability\":0.6,\"precipType\":\"rain\"}]},\"hourly\":{\"summary\":\"Light rain starting later this afternoon, continuing until this evening.\",\"icon\":\"rain\",\"data\":[{\"time\":1385233200,\"summary\":\"Mostly Cloudy\",\"icon\":\"partly-cloudy-day\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":4.394444444444442,\"apparentTemperature\":-0.12777777777777802,\"dewPoint\":-4.277777777777778,\"humidity\":0.53,\"windSpeed\":6.6296032,\"windBearing\":255,\"visibility\":16.09344,\"cloudCover\":0.65,\"pressure\":1012.26,\"ozone\":322.46},{\"time\":1385236800,\"summary\":\"Mostly Cloudy\",\"icon\":\"partly-cloudy-day\",\"precipIntensity\":0.07365999999999999,\"precipProbability\":0.01,\"precipType\":\"rain\",\"temperature\":4.549999999999999,\"apparentTemperature\":-0.35555555555555585,\"dewPoint\":-3.994444444444445,\"humidity\":0.54,\"windSpeed\":7.8410816,\"windBearing\":243,\"visibility\":16.09344,\"cloudCover\":0.62,\"pressure\":1011.1,\"ozone\":326.51},{\"time\":1385240400,\"summary\":\"Light Rain\",\"icon\":\"rain\",\"precipIntensity\":0.36322,\"precipProbability\":0.2,\"precipType\":\"rain\",\"temperature\":3.8444444444444454,\"apparentTemperature\":-1.1055555555555547,\"dewPoint\":-2.45,\"humidity\":0.63,\"windSpeed\":7.353808,\"windBearing\":247,\"visibility\":14.77377792,\"cloudCover\":0.61,\"pressure\":1009.69,\"ozone\":331.43},{\"time\":1385244000,\"summary\":\"Drizzle\",\"icon\":\"rain\",\"precipIntensity\":0.15747999999999998,\"precipProbability\":0.18,\"precipType\":\"rain\",\"temperature\":1.8555555555555574,\"apparentTemperature\":-3.5055555555555546,\"dewPoint\":-3.177777777777777,\"humidity\":0.69,\"windSpeed\":6.947001599999999,\"windBearing\":255,\"visibility\":14.886432000000001,\"cloudCover\":0.7,\"pressure\":1008.62,\"ozone\":337.83},{\"time\":1385247600,\"summary\":\"Mostly Cloudy\",\"icon\":\"partly-cloudy-night\",\"precipIntensity\":0.017779999999999997,\"precipProbability\":0.04,\"precipType\":\"rain\",\"temperature\":0.21666666666666698,\"apparentTemperature\":-5.827777777777777,\"dewPoint\":-4.927777777777779,\"humidity\":0.68,\"windSpeed\":7.4476864,\"windBearing\":263,\"visibility\":15.691104000000001,\"cloudCover\":0.7,\"pressure\":1008.1,\"ozone\":345.09},{\"time\":1385251200,\"summary\":\"Mostly Cloudy\",\"icon\":\"partly-cloudy-night\",\"precipIntensity\":0.0127,\"precipProbability\":0.08,\"precipType\":\"rain\",\"temperature\":-0.9777777777777786,\"apparentTemperature\":-7.3500000000000005,\"dewPoint\":-5.877777777777776,\"humidity\":0.69,\"windSpeed\":7.4074528,\"windBearing\":264,\"visibility\":16.029066240000002,\"cloudCover\":0.72,\"pressure\":1007.88,\"ozone\":351.6},{\"time\":1385254800,\"summary\":\"Mostly Cloudy\",\"icon\":\"partly-cloudy-night\",\"precipIntensity\":0.02032,\"precipProbability\":0.09,\"precipType\":\"snow\",\"temperature\":-2.3166666666666678,\"apparentTemperature\":-9.005555555555556,\"dewPoint\":-6.811111111111113,\"humidity\":0.71,\"windSpeed\":7.2465184,\"windBearing\":268,\"visibility\":15.675010560000002,\"cloudCover\":0.71,\"pressure\":1006.82,\"ozone\":356.94},{\"time\":1385258400,\"summary\":\"Mostly Cloudy\",\"icon\":\"partly-cloudy-night\",\"precipIntensity\":0.02794,\"precipProbability\":0.07,\"precipType\":\"snow\",\"temperature\":-3.049999999999999,\"apparentTemperature\":-9.899999999999999,\"dewPoint\":-7.555555555555555,\"humidity\":0.71,\"windSpeed\":7.139228800000001,\"windBearing\":268,\"visibility\":15.514076160000002,\"cloudCover\":0.62,\"pressure\":1006.85,\"ozone\":361.53},{\"time\":1385262000,\"summary\":\"Mostly Cloudy\",\"icon\":\"partly-cloudy-night\",\"precipIntensity\":0.030479999999999997,\"precipProbability\":0.08,\"precipType\":\"snow\",\"temperature\":-3.855555555555556,\"apparentTemperature\":-10.894444444444444,\"dewPoint\":-8.355555555555554,\"humidity\":0.71,\"windSpeed\":7.0498208,\"windBearing\":269,\"visibility\":15.224394240000002,\"cloudCover\":0.62,\"pressure\":1007.03,\"ozone\":365.1},{\"time\":1385265600,\"summary\":\"Mostly Cloudy\",\"icon\":\"partly-cloudy-night\",\"precipIntensity\":0.0381,\"precipProbability\":0.1,\"precipType\":\"snow\",\"temperature\":-4.166666666666667,\"apparentTemperature\":-11.294444444444444,\"dewPoint\":-8.766666666666667,\"humidity\":0.7,\"windSpeed\":7.0587615999999995,\"windBearing\":273,\"visibility\":14.886432000000001,\"cloudCover\":0.76,\"pressure\":1007.42,\"ozone\":366.91},{\"time\":1385269200,\"summary\":\"Mostly Cloudy\",\"icon\":\"partly-cloudy-night\",\"precipIntensity\":0.05333999999999999,\"precipProbability\":0.06,\"precipType\":\"snow\",\"temperature\":-4.511111111111112,\"apparentTemperature\":-11.727777777777778,\"dewPoint\":-9.149999999999999,\"humidity\":0.7,\"windSpeed\":7.0274688,\"windBearing\":283,\"visibility\":14.178320640000003,\"cloudCover\":0.83,\"pressure\":1007.92,\"ozone\":367.69},{\"time\":1385272800,\"summary\":\"Mostly Cloudy\",\"icon\":\"partly-cloudy-night\",\"precipIntensity\":0.05588,\"precipProbability\":0.07,\"precipType\":\"snow\",\"temperature\":-4.894444444444444,\"apparentTemperature\":-12.350000000000001,\"dewPoint\":-9.777777777777779,\"humidity\":0.69,\"windSpeed\":7.282281599999999,\"windBearing\":290,\"visibility\":14.178320640000003,\"cloudCover\":0.79,\"pressure\":1008.41,\"ozone\":369.33},{\"time\":1385276400,\"summary\":\"Mostly Cloudy\",\"icon\":\"partly-cloudy-night\",\"precipIntensity\":0.0635,\"precipProbability\":0.13,\"precipType\":\"snow\",\"temperature\":-5.46111111111111,\"apparentTemperature\":-13.199999999999998,\"dewPoint\":-10.716666666666665,\"humidity\":0.66,\"windSpeed\":7.5370944,\"windBearing\":292,\"visibility\":14.35534848,\"cloudCover\":0.81,\"pressure\":1008.84,\"ozone\":372.86},{\"time\":1385280000,\"summary\":\"Mostly Cloudy\",\"icon\":\"partly-cloudy-night\",\"precipIntensity\":0.02032,\"precipProbability\":0.02,\"precipType\":\"snow\",\"temperature\":-6.23888888888889,\"apparentTemperature\":-14.094444444444445,\"dewPoint\":-11.961111111111112,\"humidity\":0.64,\"windSpeed\":7.313574399999999,\"windBearing\":292,\"visibility\":15.30486144,\"cloudCover\":0.92,\"pressure\":1009.3,\"ozone\":377.25},{\"time\":1385283600,\"summary\":\"Mostly Cloudy\",\"icon\":\"partly-cloudy-night\",\"precipIntensity\":0.015239999999999998,\"precipProbability\":0.01,\"precipType\":\"snow\",\"temperature\":-6.888888888888888,\"apparentTemperature\":-14.899999999999999,\"dewPoint\":-12.92222222222222,\"humidity\":0.62,\"windSpeed\":7.2465184,\"windBearing\":291,\"visibility\":15.70719744,\"cloudCover\":0.92,\"pressure\":1009.81,\"ozone\":381.2},{\"time\":1385287200,\"summary\":\"Mostly Cloudy\",\"icon\":\"partly-cloudy-night\",\"precipIntensity\":0.007619999999999999,\"precipProbability\":0.01,\"precipType\":\"snow\",\"temperature\":-7.538888888888888,\"apparentTemperature\":-15.75,\"dewPoint\":-13.594444444444443,\"humidity\":0.62,\"windSpeed\":7.2778112,\"windBearing\":291,\"visibility\":15.626730240000002,\"cloudCover\":0.91,\"pressure\":1010.4,\"ozone\":384.19},{\"time\":1385290800,\"summary\":\"Mostly Cloudy\",\"icon\":\"partly-cloudy-night\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":-8,\"apparentTemperature\":-16.23888888888889,\"dewPoint\":-14.072222222222221,\"humidity\":0.62,\"windSpeed\":7.0721728,\"windBearing\":294,\"visibility\":15.57844992,\"cloudCover\":0.88,\"pressure\":1011.03,\"ozone\":386.75},{\"time\":1385294400,\"summary\":\"Mostly Cloudy\",\"icon\":\"partly-cloudy-night\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":-8.244444444444445,\"apparentTemperature\":-16.794444444444444,\"dewPoint\":-14.533333333333335,\"humidity\":0.6,\"windSpeed\":7.523683199999999,\"windBearing\":293,\"visibility\":15.658917120000002,\"cloudCover\":0.85,\"pressure\":1011.64,\"ozone\":389.14},{\"time\":1385298000,\"summary\":\"Mostly Cloudy\",\"icon\":\"partly-cloudy-day\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":-7.75,\"apparentTemperature\":-16.5,\"dewPoint\":-14.950000000000001,\"humidity\":0.56,\"windSpeed\":8.2121248,\"windBearing\":294,\"visibility\":15.83594496,\"cloudCover\":0.84,\"pressure\":1012.21,\"ozone\":391.54},{\"time\":1385301600,\"summary\":\"Mostly Cloudy\",\"icon\":\"partly-cloudy-day\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":-6.833333333333333,\"apparentTemperature\":-15.683333333333334,\"dewPoint\":-15.116666666666667,\"humidity\":0.52,\"windSpeed\":9.048089599999999,\"windBearing\":296,\"visibility\":15.96469248,\"cloudCover\":0.75,\"pressure\":1012.76,\"ozone\":393.78},{\"time\":1385305200,\"summary\":\"Mostly Cloudy\",\"icon\":\"partly-cloudy-day\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":-6.188888888888889,\"apparentTemperature\":-14.972222222222221,\"dewPoint\":-15.577777777777776,\"humidity\":0.47,\"windSpeed\":9.365488,\"windBearing\":298,\"visibility\":16.029066240000002,\"cloudCover\":0.71,\"pressure\":1013.21,\"ozone\":395.69},{\"time\":1385308800,\"summary\":\"Mostly Cloudy\",\"icon\":\"partly-cloudy-day\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":-5.527777777777778,\"apparentTemperature\":-14.261111111111113,\"dewPoint\":-16.20555555555556,\"humidity\":0.43,\"windSpeed\":9.7633536,\"windBearing\":297,\"visibility\":16.061253120000003,\"cloudCover\":0.62,\"pressure\":1013.51,\"ozone\":397.31},{\"time\":1385312400,\"summary\":\"Partly Cloudy\",\"icon\":\"partly-cloudy-day\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":-4.761111111111111,\"apparentTemperature\":-13.522222222222222,\"dewPoint\":-17.044444444444444,\"humidity\":0.37,\"windSpeed\":10.5143808,\"windBearing\":298,\"visibility\":16.09344,\"cloudCover\":0.51,\"pressure\":1013.74,\"ozone\":398.6},{\"time\":1385316000,\"summary\":\"Partly Cloudy\",\"icon\":\"partly-cloudy-day\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":-4.561111111111112,\"apparentTemperature\":-13.372222222222222,\"dewPoint\":-17.766666666666666,\"humidity\":0.35,\"windSpeed\":10.8317792,\"windBearing\":297,\"visibility\":16.09344,\"cloudCover\":0.43,\"pressure\":1014.03,\"ozone\":399.28},{\"time\":1385319600,\"summary\":\"Partly Cloudy\",\"icon\":\"partly-cloudy-day\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":-4.366666666666666,\"apparentTemperature\":-13.13888888888889,\"dewPoint\":-17.755555555555556,\"humidity\":0.34,\"windSpeed\":10.9033056,\"windBearing\":295,\"visibility\":16.09344,\"cloudCover\":0.28,\"pressure\":1014.41,\"ozone\":399.09},{\"time\":1385323200,\"summary\":\"Clear\",\"icon\":\"clear-day\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":-4.761111111111111,\"apparentTemperature\":-13.522222222222222,\"dewPoint\":-17.78333333333333,\"humidity\":0.35,\"windSpeed\":10.487558400000001,\"windBearing\":291,\"visibility\":16.09344,\"cloudCover\":0.21,\"pressure\":1014.84,\"ozone\":398.29},{\"time\":1385326800,\"summary\":\"Clear\",\"icon\":\"clear-day\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":-5.433333333333334,\"apparentTemperature\":-14.283333333333335,\"dewPoint\":-17.872222222222224,\"humidity\":0.37,\"windSpeed\":10.147808,\"windBearing\":287,\"visibility\":16.09344,\"cloudCover\":0.15,\"pressure\":1015.39,\"ozone\":397.3},{\"time\":1385330400,\"summary\":\"Clear\",\"icon\":\"clear-night\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":-6.050000000000001,\"apparentTemperature\":-14.966666666666669,\"dewPoint\":-17.77777777777778,\"humidity\":0.39,\"windSpeed\":9.803587199999999,\"windBearing\":286,\"visibility\":16.09344,\"cloudCover\":0.13,\"pressure\":1016.15,\"ozone\":396.82},{\"time\":1385334000,\"summary\":\"Clear\",\"icon\":\"clear-night\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":-6.655555555555556,\"apparentTemperature\":-15.61111111111111,\"dewPoint\":-17.538888888888888,\"humidity\":0.42,\"windSpeed\":9.4280736,\"windBearing\":287,\"visibility\":16.09344,\"cloudCover\":0.13,\"pressure\":1017.01,\"ozone\":396.16},{\"time\":1385337600,\"summary\":\"Clear\",\"icon\":\"clear-night\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":-7.422222222222222,\"apparentTemperature\":-16.22222222222222,\"dewPoint\":-17.566666666666666,\"humidity\":0.44,\"windSpeed\":8.5250528,\"windBearing\":285,\"visibility\":16.09344,\"cloudCover\":0.11,\"pressure\":1017.83,\"ozone\":393.7},{\"time\":1385341200,\"summary\":\"Clear\",\"icon\":\"clear-night\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":-7.811111111111111,\"apparentTemperature\":-16.51111111111111,\"dewPoint\":-17.450000000000003,\"humidity\":0.46,\"windSpeed\":8.069072,\"windBearing\":285,\"visibility\":16.09344,\"cloudCover\":0.09,\"pressure\":1018.56,\"ozone\":388},{\"time\":1385344800,\"summary\":\"Clear\",\"icon\":\"clear-night\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":-8.133333333333333,\"apparentTemperature\":-16.672222222222224,\"dewPoint\":-17.355555555555554,\"humidity\":0.47,\"windSpeed\":7.572857600000001,\"windBearing\":284,\"visibility\":16.09344,\"cloudCover\":0.07,\"pressure\":1019.25,\"ozone\":380.5},{\"time\":1385348400,\"summary\":\"Clear\",\"icon\":\"clear-night\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":-8.522222222222222,\"apparentTemperature\":-16.87777777777778,\"dewPoint\":-17.333333333333332,\"humidity\":0.49,\"windSpeed\":7.0051168,\"windBearing\":283,\"visibility\":16.09344,\"cloudCover\":0.05,\"pressure\":1019.9,\"ozone\":373.89},{\"time\":1385352000,\"summary\":\"Clear\",\"icon\":\"clear-night\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":-9.077777777777778,\"apparentTemperature\":-17.18888888888889,\"dewPoint\":-17.450000000000003,\"humidity\":0.51,\"windSpeed\":6.339027199999999,\"windBearing\":282,\"visibility\":16.09344,\"cloudCover\":0.03,\"pressure\":1020.5,\"ozone\":369.21},{\"time\":1385355600,\"summary\":\"Clear\",\"icon\":\"clear-night\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":-9.677777777777779,\"apparentTemperature\":-17.46666666666667,\"dewPoint\":-17.6,\"humidity\":0.52,\"windSpeed\":5.610352000000001,\"windBearing\":281,\"visibility\":16.09344,\"cloudCover\":0.02,\"pressure\":1021.04,\"ozone\":365.41},{\"time\":1385359200,\"summary\":\"Clear\",\"icon\":\"clear-night\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":-10.18888888888889,\"apparentTemperature\":-17.577777777777776,\"dewPoint\":-17.59444444444445,\"humidity\":0.54,\"windSpeed\":4.8995584,\"windBearing\":279,\"visibility\":16.09344,\"cloudCover\":0.03,\"pressure\":1021.52,\"ozone\":362.03},{\"time\":1385362800,\"summary\":\"Clear\",\"icon\":\"clear-night\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":-10.633333333333333,\"apparentTemperature\":-17.58888888888889,\"dewPoint\":-17.383333333333333,\"humidity\":0.57,\"windSpeed\":4.2558207999999995,\"windBearing\":277,\"visibility\":16.09344,\"cloudCover\":0.08,\"pressure\":1021.93,\"ozone\":359.19},{\"time\":1385366400,\"summary\":\"Clear\",\"icon\":\"clear-night\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":-11.038888888888888,\"apparentTemperature\":-17.516666666666666,\"dewPoint\":-17.083333333333332,\"humidity\":0.61,\"windSpeed\":3.6746688,\"windBearing\":276,\"visibility\":16.09344,\"cloudCover\":0.15,\"pressure\":1022.31,\"ozone\":356.75},{\"time\":1385370000,\"summary\":\"Clear\",\"icon\":\"clear-night\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":-11.31111111111111,\"apparentTemperature\":-17.166666666666668,\"dewPoint\":-16.733333333333334,\"humidity\":0.64,\"windSpeed\":3.0666944000000003,\"windBearing\":275,\"visibility\":16.09344,\"cloudCover\":0.18,\"pressure\":1022.68,\"ozone\":353.84},{\"time\":1385373600,\"summary\":\"Clear\",\"icon\":\"clear-night\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":-11.533333333333331,\"apparentTemperature\":-16.52777777777778,\"dewPoint\":-16.316666666666666,\"humidity\":0.68,\"windSpeed\":2.3961344,\"windBearing\":271,\"visibility\":16.09344,\"cloudCover\":0.15,\"pressure\":1023.06,\"ozone\":350.21},{\"time\":1385377200,\"summary\":\"Clear\",\"icon\":\"clear-night\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":-11.583333333333334,\"apparentTemperature\":-15.622222222222222,\"dewPoint\":-15.811111111111112,\"humidity\":0.71,\"windSpeed\":1.8239232,\"windBearing\":261,\"visibility\":16.09344,\"cloudCover\":0.08,\"pressure\":1023.41,\"ozone\":346.11},{\"time\":1385380800,\"summary\":\"Clear\",\"icon\":\"clear-night\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":-11.066666666666668,\"apparentTemperature\":-14.649999999999999,\"dewPoint\":-15.200000000000001,\"humidity\":0.71,\"windSpeed\":1.631696,\"windBearing\":246,\"visibility\":16.09344,\"cloudCover\":0.04,\"pressure\":1023.68,\"ozone\":341.31},{\"time\":1385384400,\"summary\":\"Clear\",\"icon\":\"clear-day\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":-9.627777777777776,\"apparentTemperature\":-13.516666666666666,\"dewPoint\":-14.455555555555556,\"humidity\":0.68,\"windSpeed\":1.9043903999999998,\"windBearing\":236,\"visibility\":16.09344,\"cloudCover\":0,\"pressure\":1023.89,\"ozone\":335.18},{\"time\":1385388000,\"summary\":\"Clear\",\"icon\":\"clear-day\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":-7.605555555555556,\"apparentTemperature\":-11.944444444444445,\"dewPoint\":-13.694444444444445,\"humidity\":0.62,\"windSpeed\":2.4318976,\"windBearing\":231,\"visibility\":16.09344,\"cloudCover\":0,\"pressure\":1024.03,\"ozone\":328.37},{\"time\":1385391600,\"summary\":\"Clear\",\"icon\":\"clear-day\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":-5.627777777777776,\"apparentTemperature\":-10.166666666666666,\"dewPoint\":-13.050000000000002,\"humidity\":0.56,\"windSpeed\":2.9102303999999997,\"windBearing\":225,\"visibility\":16.09344,\"cloudCover\":0.05,\"pressure\":1023.95,\"ozone\":322.62},{\"time\":1385395200,\"summary\":\"Partly Cloudy\",\"icon\":\"partly-cloudy-day\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":-3.788888888888889,\"apparentTemperature\":-8.344444444444443,\"dewPoint\":-12.466666666666665,\"humidity\":0.51,\"windSpeed\":3.2991552,\"windBearing\":216,\"visibility\":16.09344,\"cloudCover\":0.28,\"pressure\":1023.55,\"ozone\":318.52},{\"time\":1385398800,\"summary\":\"Partly Cloudy\",\"icon\":\"partly-cloudy-day\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":-2.0500000000000007,\"apparentTemperature\":-6.588888888888889,\"dewPoint\":-11.949999999999998,\"humidity\":0.47,\"windSpeed\":3.7149024,\"windBearing\":208,\"visibility\":16.09344,\"cloudCover\":0.59,\"pressure\":1022.96,\"ozone\":315.49},{\"time\":1385402400,\"summary\":\"Mostly Cloudy\",\"icon\":\"partly-cloudy-day\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":-0.8888888888888897,\"apparentTemperature\":-5.416666666666667,\"dewPoint\":-11.483333333333334,\"humidity\":0.44,\"windSpeed\":4.0591232,\"windBearing\":200,\"visibility\":16.09344,\"cloudCover\":0.75,\"pressure\":1022.38,\"ozone\":313.56},{\"time\":1385406000,\"summary\":\"Mostly Cloudy\",\"icon\":\"partly-cloudy-day\",\"precipIntensity\":0,\"precipProbability\":0,\"temperature\":-0.5499999999999992,\"apparentTemperature\":-5.122222222222222,\"dewPoint\":-10.916666666666666,\"humidity\":0.45,\"windSpeed\":4.2334688,\"windBearing\":190,\"visibility\":16.09344,\"cloudCover\":0.63,\"pressure\":1021.84,\"ozone\":313.19}]},\"daily\":{\"summary\":\"Mixed precipitation off-and-on until Wednesday; temperatures falling to -4° tomorrow.\",\"icon\":\"rain\",\"data\":[{\"time\":1385182800,\"summary\":\"Light rain starting in the afternoon, continuing until evening.\",\"icon\":\"rain\",\"sunriseTime\":1385207887,\"sunsetTime\":1385242044,\"precipIntensity\":0.035559999999999994,\"precipIntensityMax\":0.36322,\"precipIntensityMaxTime\":1385240400,\"precipProbability\":0.63,\"precipType\":\"rain\",\"temperatureMin\":-4.166666666666667,\"temperatureMinTime\":1385265600,\"temperatureMax\":6.844444444444445,\"temperatureMaxTime\":1385182800,\"apparentTemperatureMin\":-11.294444444444444,\"apparentTemperatureMinTime\":1385265600,\"apparentTemperatureMax\":3.0166666666666666,\"apparentTemperatureMaxTime\":1385182800,\"dewPoint\":-3.561111111111111,\"humidity\":0.69,\"windSpeed\":6.4865504,\"windBearing\":271,\"visibility\":15.75547776,\"cloudCover\":0.58,\"pressure\":1011.95,\"ozone\":320.35},{\"time\":1385269200,\"summary\":\"Mostly cloudy until afternoon.\",\"icon\":\"partly-cloudy-day\",\"sunriseTime\":1385294358,\"sunsetTime\":1385328408,\"precipIntensity\":0.01016,\"precipIntensityMax\":0.0635,\"precipIntensityMaxTime\":1385276400,\"precipProbability\":0.13,\"precipType\":\"snow\",\"precipAccumulation\":0.46482,\"temperatureMin\":-9.077777777777778,\"temperatureMinTime\":1385352000,\"temperatureMax\":-4.366666666666666,\"temperatureMaxTime\":1385319600,\"apparentTemperatureMin\":-17.18888888888889,\"apparentTemperatureMinTime\":1385352000,\"apparentTemperatureMax\":-13.13888888888889,\"apparentTemperatureMaxTime\":1385319600,\"dewPoint\":-15.38888888888889,\"humidity\":0.5,\"windSpeed\":8.4803488,\"windBearing\":291,\"visibility\":15.73938432,\"cloudCover\":0.5,\"pressure\":1013.78,\"ozone\":387.4},{\"time\":1385355600,\"summary\":\"Mostly cloudy throughout the day.\",\"icon\":\"partly-cloudy-day\",\"sunriseTime\":1385380829,\"sunsetTime\":1385414774,\"precipIntensity\":0,\"precipIntensityMax\":0,\"precipProbability\":0,\"temperatureMin\":-11.583333333333334,\"temperatureMinTime\":1385377200,\"temperatureMax\":-0.5499999999999992,\"temperatureMaxTime\":1385406000,\"apparentTemperatureMin\":-17.58888888888889,\"apparentTemperatureMinTime\":1385362800,\"apparentTemperatureMax\":-5.122222222222222,\"apparentTemperatureMaxTime\":1385406000,\"dewPoint\":-12.988888888888889,\"humidity\":0.58,\"windSpeed\":2.6151839999999997,\"windBearing\":206,\"visibility\":16.09344,\"cloudCover\":0.32,\"pressure\":1021.96,\"ozone\":328.9},{\"time\":1385442000,\"summary\":\"Rain starting in the afternoon.\",\"icon\":\"rain\",\"sunriseTime\":1385467299,\"sunsetTime\":1385501142,\"precipIntensity\":0.15494,\"precipIntensityMax\":0.68072,\"precipIntensityMaxTime\":1385524800,\"precipProbability\":0.37,\"precipType\":\"rain\",\"temperatureMin\":-3.711111111111111,\"temperatureMinTime\":1385456400,\"temperatureMax\":3.199999999999999,\"temperatureMaxTime\":1385488800,\"apparentTemperatureMin\":-9.616666666666667,\"apparentTemperatureMinTime\":1385456400,\"apparentTemperatureMax\":-0.5888888888888881,\"apparentTemperatureMaxTime\":1385488800,\"dewPoint\":-5.888888888888889,\"humidity\":0.68,\"windSpeed\":3.7551360000000003,\"windBearing\":163,\"visibility\":16.09344,\"cloudCover\":0.87,\"pressure\":1016.7,\"ozone\":301.53},{\"time\":1385528400,\"summary\":\"Snow (3–4 cm) until afternoon.\",\"icon\":\"snow\",\"sunriseTime\":1385553768,\"sunsetTime\":1385587513,\"precipIntensity\":0.28194,\"precipIntensityMax\":0.7340599999999999,\"precipIntensityMaxTime\":1385528400,\"precipProbability\":0.34,\"precipType\":\"snow\",\"precipAccumulation\":7.90956,\"temperatureMin\":-3.922222222222222,\"temperatureMinTime\":1385611200,\"temperatureMax\":3.2722222222222226,\"temperatureMaxTime\":1385575200,\"apparentTemperatureMin\":-9.255555555555555,\"apparentTemperatureMinTime\":1385611200,\"apparentTemperatureMax\":-0.5666666666666664,\"apparentTemperatureMaxTime\":1385575200,\"dewPoint\":-3.877777777777778,\"humidity\":0.78,\"windSpeed\":3.173984,\"windBearing\":321,\"cloudCover\":0.4,\"pressure\":1015.9,\"ozone\":309.12},{\"time\":1385614800,\"summary\":\"Mostly cloudy until afternoon.\",\"icon\":\"partly-cloudy-day\",\"sunriseTime\":1385640236,\"sunsetTime\":1385673885,\"precipIntensity\":0.01016,\"precipIntensityMax\":0.02286,\"precipIntensityMaxTime\":1385614800,\"precipProbability\":0.05,\"precipType\":\"snow\",\"precipAccumulation\":0.37084,\"temperatureMin\":-7.361111111111111,\"temperatureMinTime\":1385697600,\"temperatureMax\":-1.6111111111111103,\"temperatureMaxTime\":1385661600,\"apparentTemperatureMin\":-12.194444444444445,\"apparentTemperatureMinTime\":1385640000,\"apparentTemperatureMax\":-6.761111111111112,\"apparentTemperatureMaxTime\":1385661600,\"dewPoint\":-11.677777777777777,\"humidity\":0.59,\"windSpeed\":3.5852608,\"windBearing\":349,\"cloudCover\":0.51,\"pressure\":1026.14,\"ozone\":298.81},{\"time\":1385701200,\"summary\":\"Mostly cloudy until evening.\",\"icon\":\"partly-cloudy-day\",\"sunriseTime\":1385726703,\"sunsetTime\":1385760261,\"precipIntensity\":0.00508,\"precipIntensityMax\":0.015239999999999998,\"precipIntensityMaxTime\":1385769600,\"precipProbability\":0.08,\"precipType\":\"snow\",\"precipAccumulation\":0.2286,\"temperatureMin\":-9.805555555555555,\"temperatureMinTime\":1385722800,\"temperatureMax\":-1.0500000000000003,\"temperatureMaxTime\":1385748000,\"apparentTemperatureMin\":-11.483333333333334,\"apparentTemperatureMinTime\":1385704800,\"apparentTemperatureMax\":-1.0500000000000003,\"apparentTemperatureMaxTime\":1385748000,\"dewPoint\":-12.149999999999999,\"humidity\":0.62,\"windSpeed\":0.9432543999999999,\"windBearing\":336,\"cloudCover\":0.46,\"pressure\":1031.02,\"ozone\":315.37},{\"time\":1385787600,\"summary\":\"Partly cloudy overnight.\",\"icon\":\"partly-cloudy-night\",\"sunriseTime\":1385813168,\"sunsetTime\":1385846638,\"precipIntensity\":0.007619999999999999,\"precipIntensityMax\":0.01016,\"precipIntensityMaxTime\":1385809200,\"precipProbability\":0.1,\"precipType\":\"snow\",\"precipAccumulation\":0.28448,\"temperatureMin\":-8.883333333333333,\"temperatureMinTime\":1385809200,\"temperatureMax\":0.033333333333334596,\"temperatureMaxTime\":1385834400,\"apparentTemperatureMin\":-13.272222222222222,\"apparentTemperatureMinTime\":1385805600,\"apparentTemperatureMax\":-3.455555555555555,\"apparentTemperatureMaxTime\":1385834400,\"dewPoint\":-9.911111111111111,\"humidity\":0.7,\"windSpeed\":1.8865087999999999,\"windBearing\":320,\"cloudCover\":0.04,\"pressure\":1031.08,\"ozone\":298.04}]},\"flags\":{\"sources\":[\"nwspa\",\"isd\",\"fnmoc\",\"sref\",\"rtma\",\"rap\",\"nam\",\"cmc\",\"gfs\",\"metar\",\"lamp\",\"darksky\"],\"isd-stations\":[\"725180-14735\",\"744994-04741\",\"999999-04741\",\"999999-14735\",\"999999-14796\"],\"metar-stations\":[\"KALB\",\"KDDH\",\"KPSF\"],\"lamp-stations\":[\"KALB\",\"KDDH\",\"KPSF\"],\"darksky-stations\":[\"KENX\"],\"units\":\"si\"}}"},"http_version":null},"recorded_at":"Sat, 23 Nov 2013 19:20:40 GMT"}],"recorded_with":"VCR 2.7.0"}
@@ -0,0 +1,73 @@
1
+ require 'spec_helper'
2
+
3
+ module Barometer
4
+ describe ForecastIo, vcr: {
5
+ cassette_name: 'ForecastIo'
6
+ } do
7
+
8
+ it 'auto-registers this weather service as :forecast_io' do
9
+ expect( Barometer::WeatherService.source(:forecast_io) ).to eq Barometer::ForecastIo
10
+ end
11
+
12
+ describe '.call' do
13
+ context 'when no keys provided' do
14
+ let(:query) { build_query }
15
+
16
+ it 'raises error' do
17
+ expect {
18
+ ForecastIo.call(query)
19
+ }.to raise_error(Barometer::WeatherService::KeyRequired)
20
+ end
21
+ end
22
+
23
+ context 'when keys are provided' do
24
+ let(:converted_query) { ConvertedQuery.new('42.7243,-73.6927', :coordinates, :metric) }
25
+ let(:query) { build_query.tap{|q|q.stub(:convert! => converted_query)} }
26
+ let(:config) { {keys: {api: FORECAST_IO_APIKEY}} }
27
+
28
+ subject { ForecastIo.call(query, config) }
29
+
30
+ it 'asks the query to convert to accepted formats' do
31
+ query.should_receive(:convert!).with(:coordinates)
32
+ subject
33
+ end
34
+
35
+ it 'includes the expected data' do
36
+ subject.query.should == '42.7243,-73.6927'
37
+ subject.format.should == :coordinates
38
+ subject.should be_metric
39
+
40
+ should have_data(:current, :observed_at).as_format(:time)
41
+ # should have_data(:current, :stale_at).as_format(:time)
42
+
43
+ should have_data(:current, :humidity).as_format(:float)
44
+ should have_data(:current, :condition).as_format(:string)
45
+ should have_data(:current, :icon).as_format(:string)
46
+ should have_data(:current, :temperature).as_format(:temperature)
47
+ should have_data(:current, :dew_point).as_format(:temperature)
48
+ should have_data(:current, :wind).as_format(:vector)
49
+ should have_data(:current, :pressure).as_format(:pressure)
50
+ should have_data(:current, :visibility).as_format(:distance)
51
+ # should have_data(:current, :sun, :rise).as_format(:time)
52
+ # should have_data(:current, :sun, :set).as_format(:time)
53
+
54
+ should have_data(:location, :latitude).as_value(42.7243)
55
+ should have_data(:location, :longitude).as_value(-73.6927)
56
+
57
+ should have_data(:timezone, :to_s).as_value('America/New_York')
58
+ should have_data(:timezone, :code).as_format(/^E[DS]T$/i)
59
+
60
+ subject.forecast.size.should == 8
61
+ should have_forecast(:starts_at).as_format(:time)
62
+ should have_forecast(:ends_at).as_format(:time)
63
+ should have_forecast(:icon).as_format(:string)
64
+ should have_forecast(:condition).as_format(:string)
65
+ should have_forecast(:high).as_format(:temperature)
66
+ should have_forecast(:low).as_format(:temperature)
67
+ should have_forecast(:sun, :rise).as_format(:time)
68
+ should have_forecast(:sun, :set).as_format(:time)
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,27 @@
1
+ require 'rspec'
2
+ require 'pry'
3
+ require 'vcr'
4
+ require 'webmock/rspec'
5
+ require 'barometer/support'
6
+
7
+ require_relative '../lib/barometer/forecast_io'
8
+
9
+ Dir['./spec/support/**/*.rb'].sort.each {|f| require f}
10
+
11
+ FORECAST_IO_APIKEY = Barometer::Support::KeyFileParser.find(:forecast_io, :apikey) || 'forecastio'
12
+
13
+ VCR.configure do |config|
14
+ config.cassette_library_dir = 'spec/cassettes'
15
+ config.hook_into :webmock
16
+ config.default_cassette_options = { record: :none, serialize_with: :json }
17
+
18
+ config.filter_sensitive_data('FORECAST_IO_APIKEY') { FORECAST_IO_APIKEY.to_s }
19
+
20
+ config.configure_rspec_metadata!
21
+ end
22
+
23
+ RSpec.configure do |config|
24
+ config.treat_symbols_as_metadata_keys_with_true_values = true
25
+ config.include Barometer::Support::Matchers
26
+ config.include Barometer::Support::Factory
27
+ end
metadata ADDED
@@ -0,0 +1,179 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: barometer-forecast_io
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Mark G
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-11-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: barometer
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 0.9.3
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 0.9.3
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '2.11'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '2.11'
69
+ - !ruby/object:Gem::Dependency
70
+ name: webmock
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: vcr
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: barometer-support
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ description: A barometer wrapper for Forecast.io
126
+ email:
127
+ - barometer@attackcorp.com
128
+ executables: []
129
+ extensions: []
130
+ extra_rdoc_files: []
131
+ files:
132
+ - .gitignore
133
+ - .rspec
134
+ - Gemfile
135
+ - LICENSE.txt
136
+ - README.md
137
+ - Rakefile
138
+ - barometer-forecast_io.gemspec
139
+ - lib/barometer/forecast_io.rb
140
+ - lib/barometer/forecast_io/api.rb
141
+ - lib/barometer/forecast_io/query.rb
142
+ - lib/barometer/forecast_io/response.rb
143
+ - lib/barometer/forecast_io/response/current_weather.rb
144
+ - lib/barometer/forecast_io/response/forecasted_weather.rb
145
+ - lib/barometer/forecast_io/response/location.rb
146
+ - lib/barometer/forecast_io/response/timezone.rb
147
+ - lib/barometer/forecast_io/version.rb
148
+ - spec/cassettes/ForecastIo.json
149
+ - spec/forecast_io_spec.rb
150
+ - spec/spec_helper.rb
151
+ homepage: http://github.com/attack/barometer-forecast_io
152
+ licenses:
153
+ - MIT
154
+ metadata: {}
155
+ post_install_message:
156
+ rdoc_options: []
157
+ require_paths:
158
+ - lib
159
+ required_ruby_version: !ruby/object:Gem::Requirement
160
+ requirements:
161
+ - - '>='
162
+ - !ruby/object:Gem::Version
163
+ version: 1.9.2
164
+ required_rubygems_version: !ruby/object:Gem::Requirement
165
+ requirements:
166
+ - - '>='
167
+ - !ruby/object:Gem::Version
168
+ version: '0'
169
+ requirements: []
170
+ rubyforge_project:
171
+ rubygems_version: 2.0.3
172
+ signing_key:
173
+ specification_version: 4
174
+ summary: A barometer wrapper for Forecast.io
175
+ test_files:
176
+ - spec/cassettes/ForecastIo.json
177
+ - spec/forecast_io_spec.rb
178
+ - spec/spec_helper.rb
179
+ has_rdoc: