barometer 0.9.4 → 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +2 -5
- data/Gemfile +11 -7
- data/LICENSE +1 -1
- data/README.md +3 -3
- data/barometer.gemspec +7 -10
- data/lib/barometer/utils/json_reader.rb +2 -3
- data/lib/barometer/utils/payload.rb +6 -87
- data/lib/barometer/utils/translations/zone_codes.yml +1 -0
- data/lib/barometer/version.rb +1 -1
- data/lib/barometer/weather_service.rb +0 -1
- data/spec/barometer_spec.rb +6 -0
- data/spec/spec_helper.rb +0 -11
- data/spec/utils/payload_spec.rb +20 -153
- data/spec/weather_services/wunderground_v1/current_response_spec.rb +5 -4
- data/spec/weather_services/wunderground_v1/forecast_response_spec.rb +23 -22
- metadata +32 -170
- data/.pelusa.yml +0 -7
- data/lib/barometer/weather_services/weather_bug.rb +0 -41
- data/lib/barometer/weather_services/weather_bug/current_api.rb +0 -26
- data/lib/barometer/weather_services/weather_bug/current_response.rb +0 -33
- data/lib/barometer/weather_services/weather_bug/forecast_api.rb +0 -26
- data/lib/barometer/weather_services/weather_bug/forecast_response.rb +0 -29
- data/lib/barometer/weather_services/weather_bug/query.rb +0 -42
- data/lib/barometer/weather_services/weather_bug/response/current_weather.rb +0 -82
- data/lib/barometer/weather_services/weather_bug/response/forecasted_weather.rb +0 -67
- data/lib/barometer/weather_services/weather_bug/response/location.rb +0 -23
- data/lib/barometer/weather_services/weather_bug/response/station.rb +0 -43
- data/lib/barometer/weather_services/weather_bug/response/sun.rb +0 -32
- data/lib/barometer/weather_services/weather_bug/response/time_helper.rb +0 -52
- data/lib/barometer/weather_services/weather_bug/response/timezone.rb +0 -15
- data/spec/cassettes/WeatherService_WeatherBug.json +0 -1
- data/spec/weather_services/weather_bug/current_response_spec.rb +0 -64
- data/spec/weather_services/weather_bug/forecast_response_spec.rb +0 -23
- data/spec/weather_services/weather_bug/query_spec.rb +0 -44
- data/spec/weather_services/weather_bug_spec.rb +0 -80
@@ -2,14 +2,15 @@ require_relative '../../spec_helper'
|
|
2
2
|
|
3
3
|
module Barometer::WeatherService
|
4
4
|
describe WundergroundV1::CurrentResponse do
|
5
|
-
it
|
5
|
+
it 'parses the timezones correctly' do
|
6
6
|
payload = Barometer::Utils::Payload.new({
|
7
|
-
|
7
|
+
'local_time' => 'May 18, 10:46 AM PDT'
|
8
8
|
})
|
9
9
|
response = WundergroundV1::CurrentResponse.new.parse(payload)
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
current_year = Time.now.year
|
12
|
+
utc_observed_at = Time.utc(current_year,5,18,17,46,0)
|
13
|
+
utc_stale_at = Time.utc(current_year,5,18,18,0,0)
|
13
14
|
|
14
15
|
expect( response.current.observed_at.utc ).to eq utc_observed_at
|
15
16
|
expect( response.current.stale_at.utc ).to eq utc_stale_at
|
@@ -2,56 +2,57 @@ require_relative '../../spec_helper'
|
|
2
2
|
|
3
3
|
module Barometer::WeatherService
|
4
4
|
describe WundergroundV1::ForecastResponse do
|
5
|
+
let(:current_year) { Time.now.year }
|
5
6
|
let(:current_response) { Barometer::Response.new }
|
6
7
|
|
7
|
-
it
|
8
|
+
it 'parses the timezones correctly' do
|
8
9
|
payload = Barometer::Utils::Payload.new({
|
9
|
-
|
10
|
+
'simpleforecast' => { 'forecastday' => [
|
10
11
|
{
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
'date' => {
|
13
|
+
'tz_long' => 'America/Los_Angeles',
|
14
|
+
'pretty' => "10:46 PM PDT on May 18, #{current_year}"
|
14
15
|
}
|
15
16
|
}
|
16
17
|
]}
|
17
18
|
})
|
18
19
|
response = WundergroundV1::ForecastResponse.new(current_response).parse(payload)
|
19
20
|
|
20
|
-
utc_starts_at = Time.utc(
|
21
|
-
utc_ends_at = Time.utc(
|
21
|
+
utc_starts_at = Time.utc(current_year,5,19,5,46,0)
|
22
|
+
utc_ends_at = Time.utc(current_year,5,20,5,45,59)
|
22
23
|
|
23
24
|
expect( response.forecast[0].starts_at.utc ).to eq utc_starts_at
|
24
25
|
expect( response.forecast[0].ends_at.utc ).to eq utc_ends_at
|
25
26
|
expect( response.timezone.to_s ).to eq 'America/Los_Angeles'
|
26
27
|
end
|
27
28
|
|
28
|
-
it
|
29
|
+
it 'parses sun timezones correctly' do
|
29
30
|
current_response.current = Barometer::Response::Current.new
|
30
|
-
current_response.current.observed_at = Barometer::Utils::Time.parse(
|
31
|
+
current_response.current.observed_at = Barometer::Utils::Time.parse('May 18, 10:46 AM PDT')
|
31
32
|
payload = Barometer::Utils::Payload.new({
|
32
|
-
|
33
|
+
'simpleforecast' => { 'forecastday' => [
|
33
34
|
{
|
34
|
-
|
35
|
-
|
36
|
-
|
35
|
+
'date' => {
|
36
|
+
'tz_long' => 'America/Los_Angeles',
|
37
|
+
'pretty' => "10:46 PM PDT on May 18, #{current_year}"
|
37
38
|
}
|
38
39
|
}
|
39
40
|
]},
|
40
|
-
|
41
|
-
|
42
|
-
|
41
|
+
'moon_phase' => {
|
42
|
+
'sunrise' => {
|
43
|
+
'hour' => '7', 'minute' => '59'
|
43
44
|
},
|
44
|
-
|
45
|
-
|
45
|
+
'sunset' => {
|
46
|
+
'hour' => '17', 'minute' => '42'
|
46
47
|
}
|
47
48
|
}
|
48
49
|
})
|
49
50
|
response = WundergroundV1::ForecastResponse.new(current_response).parse(payload)
|
50
51
|
|
51
|
-
utc_current_sun_rise = Time.utc(
|
52
|
-
utc_current_sun_set = Time.utc(
|
53
|
-
utc_forecast_sun_rise = Time.utc(
|
54
|
-
utc_forecast_sun_set = Time.utc(
|
52
|
+
utc_current_sun_rise = Time.utc(current_year,5,18,14,59,0)
|
53
|
+
utc_current_sun_set = Time.utc(current_year,5,19,0,42,0)
|
54
|
+
utc_forecast_sun_rise = Time.utc(current_year,5,19,14,59,0)
|
55
|
+
utc_forecast_sun_set = Time.utc(current_year,5,20,0,42,0)
|
55
56
|
|
56
57
|
expect( response.current.sun.rise.utc ).to eq utc_current_sun_rise
|
57
58
|
expect( response.current.sun.set.utc ).to eq utc_current_sun_set
|
metadata
CHANGED
@@ -1,250 +1,136 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: barometer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
5
|
-
prerelease:
|
4
|
+
version: 0.9.5
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
|
-
- Mark
|
7
|
+
- Mark Gangl
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-04-13 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: httpclient
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: tzinfo
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: 0.3.14
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: 0.3.14
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: nokogiri
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - ">="
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - ">="
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: addressable
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - ">="
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '0'
|
70
62
|
type: :runtime
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: '0'
|
78
|
-
- !ruby/object:Gem::Dependency
|
79
|
-
name: yajl-ruby
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
|
-
requirements:
|
83
|
-
- - ! '>='
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: '0'
|
86
|
-
type: :runtime
|
87
|
-
prerelease: false
|
88
|
-
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
|
-
requirements:
|
91
|
-
- - ! '>='
|
66
|
+
- - ">="
|
92
67
|
- !ruby/object:Gem::Version
|
93
68
|
version: '0'
|
94
69
|
- !ruby/object:Gem::Dependency
|
95
70
|
name: nori
|
96
71
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
72
|
requirements:
|
99
|
-
- -
|
73
|
+
- - ">="
|
100
74
|
- !ruby/object:Gem::Version
|
101
75
|
version: '0'
|
102
76
|
type: :runtime
|
103
77
|
prerelease: false
|
104
78
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
79
|
requirements:
|
107
|
-
- -
|
80
|
+
- - ">="
|
108
81
|
- !ruby/object:Gem::Version
|
109
82
|
version: '0'
|
110
|
-
- !ruby/object:Gem::Dependency
|
111
|
-
name: multi_json
|
112
|
-
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
|
-
requirements:
|
115
|
-
- - ~>
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '1.0'
|
118
|
-
type: :runtime
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
|
-
requirements:
|
123
|
-
- - ~>
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: '1.0'
|
126
83
|
- !ruby/object:Gem::Dependency
|
127
84
|
name: virtus
|
128
85
|
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
86
|
requirements:
|
131
|
-
- -
|
87
|
+
- - ">="
|
132
88
|
- !ruby/object:Gem::Version
|
133
89
|
version: 1.0.0
|
134
90
|
type: :runtime
|
135
91
|
prerelease: false
|
136
92
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
93
|
requirements:
|
139
|
-
- -
|
94
|
+
- - ">="
|
140
95
|
- !ruby/object:Gem::Version
|
141
96
|
version: 1.0.0
|
142
97
|
- !ruby/object:Gem::Dependency
|
143
|
-
name:
|
144
|
-
requirement: !ruby/object:Gem::Requirement
|
145
|
-
none: false
|
146
|
-
requirements:
|
147
|
-
- - ! '>='
|
148
|
-
- !ruby/object:Gem::Version
|
149
|
-
version: '2.11'
|
150
|
-
type: :development
|
151
|
-
prerelease: false
|
152
|
-
version_requirements: !ruby/object:Gem::Requirement
|
153
|
-
none: false
|
154
|
-
requirements:
|
155
|
-
- - ! '>='
|
156
|
-
- !ruby/object:Gem::Version
|
157
|
-
version: '2.11'
|
158
|
-
- !ruby/object:Gem::Dependency
|
159
|
-
name: webmock
|
98
|
+
name: choc_mool
|
160
99
|
requirement: !ruby/object:Gem::Requirement
|
161
|
-
none: false
|
162
100
|
requirements:
|
163
|
-
- -
|
101
|
+
- - ">="
|
164
102
|
- !ruby/object:Gem::Version
|
165
103
|
version: '0'
|
166
|
-
type: :
|
167
|
-
prerelease: false
|
168
|
-
version_requirements: !ruby/object:Gem::Requirement
|
169
|
-
none: false
|
170
|
-
requirements:
|
171
|
-
- - ! '>='
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
version: '0'
|
174
|
-
- !ruby/object:Gem::Dependency
|
175
|
-
name: rake
|
176
|
-
requirement: !ruby/object:Gem::Requirement
|
177
|
-
none: false
|
178
|
-
requirements:
|
179
|
-
- - ! '>='
|
180
|
-
- !ruby/object:Gem::Version
|
181
|
-
version: '0'
|
182
|
-
type: :development
|
183
|
-
prerelease: false
|
184
|
-
version_requirements: !ruby/object:Gem::Requirement
|
185
|
-
none: false
|
186
|
-
requirements:
|
187
|
-
- - ! '>='
|
188
|
-
- !ruby/object:Gem::Version
|
189
|
-
version: '0'
|
190
|
-
- !ruby/object:Gem::Dependency
|
191
|
-
name: pry
|
192
|
-
requirement: !ruby/object:Gem::Requirement
|
193
|
-
none: false
|
194
|
-
requirements:
|
195
|
-
- - ! '>='
|
196
|
-
- !ruby/object:Gem::Version
|
197
|
-
version: '0'
|
198
|
-
type: :development
|
199
|
-
prerelease: false
|
200
|
-
version_requirements: !ruby/object:Gem::Requirement
|
201
|
-
none: false
|
202
|
-
requirements:
|
203
|
-
- - ! '>='
|
204
|
-
- !ruby/object:Gem::Version
|
205
|
-
version: '0'
|
206
|
-
- !ruby/object:Gem::Dependency
|
207
|
-
name: vcr
|
208
|
-
requirement: !ruby/object:Gem::Requirement
|
209
|
-
none: false
|
210
|
-
requirements:
|
211
|
-
- - ! '>='
|
212
|
-
- !ruby/object:Gem::Version
|
213
|
-
version: '0'
|
214
|
-
type: :development
|
104
|
+
type: :runtime
|
215
105
|
prerelease: false
|
216
106
|
version_requirements: !ruby/object:Gem::Requirement
|
217
|
-
none: false
|
218
107
|
requirements:
|
219
|
-
- -
|
108
|
+
- - ">="
|
220
109
|
- !ruby/object:Gem::Version
|
221
110
|
version: '0'
|
222
111
|
- !ruby/object:Gem::Dependency
|
223
|
-
name:
|
112
|
+
name: bundler
|
224
113
|
requirement: !ruby/object:Gem::Requirement
|
225
|
-
none: false
|
226
114
|
requirements:
|
227
|
-
- -
|
115
|
+
- - ">="
|
228
116
|
- !ruby/object:Gem::Version
|
229
117
|
version: '0'
|
230
118
|
type: :development
|
231
119
|
prerelease: false
|
232
120
|
version_requirements: !ruby/object:Gem::Requirement
|
233
|
-
none: false
|
234
121
|
requirements:
|
235
|
-
- -
|
122
|
+
- - ">="
|
236
123
|
- !ruby/object:Gem::Version
|
237
124
|
version: '0'
|
238
125
|
description: A multi API consuming weather forecasting superstar.
|
239
126
|
email:
|
240
|
-
-
|
127
|
+
- mark@attackcorp.com
|
241
128
|
executables: []
|
242
129
|
extensions: []
|
243
130
|
extra_rdoc_files: []
|
244
131
|
files:
|
245
|
-
- .gitignore
|
246
|
-
- .
|
247
|
-
- .travis.yml
|
132
|
+
- ".gitignore"
|
133
|
+
- ".travis.yml"
|
248
134
|
- Gemfile
|
249
135
|
- LICENSE
|
250
136
|
- README.md
|
@@ -355,19 +241,6 @@ files:
|
|
355
241
|
- lib/barometer/weather_services/response.rb
|
356
242
|
- lib/barometer/weather_services/response/location.rb
|
357
243
|
- lib/barometer/weather_services/response/time_zone.rb
|
358
|
-
- lib/barometer/weather_services/weather_bug.rb
|
359
|
-
- lib/barometer/weather_services/weather_bug/current_api.rb
|
360
|
-
- lib/barometer/weather_services/weather_bug/current_response.rb
|
361
|
-
- lib/barometer/weather_services/weather_bug/forecast_api.rb
|
362
|
-
- lib/barometer/weather_services/weather_bug/forecast_response.rb
|
363
|
-
- lib/barometer/weather_services/weather_bug/query.rb
|
364
|
-
- lib/barometer/weather_services/weather_bug/response/current_weather.rb
|
365
|
-
- lib/barometer/weather_services/weather_bug/response/forecasted_weather.rb
|
366
|
-
- lib/barometer/weather_services/weather_bug/response/location.rb
|
367
|
-
- lib/barometer/weather_services/weather_bug/response/station.rb
|
368
|
-
- lib/barometer/weather_services/weather_bug/response/sun.rb
|
369
|
-
- lib/barometer/weather_services/weather_bug/response/time_helper.rb
|
370
|
-
- lib/barometer/weather_services/weather_bug/response/timezone.rb
|
371
244
|
- lib/barometer/weather_services/wunderground_v1.rb
|
372
245
|
- lib/barometer/weather_services/wunderground_v1/current_api.rb
|
373
246
|
- lib/barometer/weather_services/wunderground_v1/current_response.rb
|
@@ -406,7 +279,6 @@ files:
|
|
406
279
|
- spec/cassettes/Service_YahooGeocode.json
|
407
280
|
- spec/cassettes/WeatherService_ForecastIo.json
|
408
281
|
- spec/cassettes/WeatherService_Noaa.json
|
409
|
-
- spec/cassettes/WeatherService_WeatherBug.json
|
410
282
|
- spec/cassettes/WeatherService_WundergroundV1.json
|
411
283
|
- spec/cassettes/WeatherService_Yahoo.json
|
412
284
|
- spec/data/attributes/distance_spec.rb
|
@@ -473,10 +345,6 @@ files:
|
|
473
345
|
- spec/weather_services/noaa/current_response_spec.rb
|
474
346
|
- spec/weather_services/noaa/forecast_response_spec.rb
|
475
347
|
- spec/weather_services/noaa_spec.rb
|
476
|
-
- spec/weather_services/weather_bug/current_response_spec.rb
|
477
|
-
- spec/weather_services/weather_bug/forecast_response_spec.rb
|
478
|
-
- spec/weather_services/weather_bug/query_spec.rb
|
479
|
-
- spec/weather_services/weather_bug_spec.rb
|
480
348
|
- spec/weather_services/wunderground_v1/current_response_spec.rb
|
481
349
|
- spec/weather_services/wunderground_v1/forecast_response_spec.rb
|
482
350
|
- spec/weather_services/wunderground_v1_spec.rb
|
@@ -487,28 +355,27 @@ files:
|
|
487
355
|
homepage: http://github.com/attack/barometer
|
488
356
|
licenses:
|
489
357
|
- MIT
|
358
|
+
metadata: {}
|
490
359
|
post_install_message:
|
491
360
|
rdoc_options:
|
492
|
-
- --charset=UTF-8
|
361
|
+
- "--charset=UTF-8"
|
493
362
|
require_paths:
|
494
363
|
- lib
|
495
364
|
required_ruby_version: !ruby/object:Gem::Requirement
|
496
|
-
none: false
|
497
365
|
requirements:
|
498
|
-
- -
|
366
|
+
- - ">="
|
499
367
|
- !ruby/object:Gem::Version
|
500
|
-
version:
|
368
|
+
version: 1.9.0
|
501
369
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
502
|
-
none: false
|
503
370
|
requirements:
|
504
|
-
- -
|
371
|
+
- - ">="
|
505
372
|
- !ruby/object:Gem::Version
|
506
373
|
version: '0'
|
507
374
|
requirements: []
|
508
375
|
rubyforge_project:
|
509
|
-
rubygems_version:
|
376
|
+
rubygems_version: 2.2.2
|
510
377
|
signing_key:
|
511
|
-
specification_version:
|
378
|
+
specification_version: 4
|
512
379
|
summary: A multi API consuming weather forecasting superstar.
|
513
380
|
test_files:
|
514
381
|
- spec/barometer_spec.rb
|
@@ -527,7 +394,6 @@ test_files:
|
|
527
394
|
- spec/cassettes/Service_YahooGeocode.json
|
528
395
|
- spec/cassettes/WeatherService_ForecastIo.json
|
529
396
|
- spec/cassettes/WeatherService_Noaa.json
|
530
|
-
- spec/cassettes/WeatherService_WeatherBug.json
|
531
397
|
- spec/cassettes/WeatherService_WundergroundV1.json
|
532
398
|
- spec/cassettes/WeatherService_Yahoo.json
|
533
399
|
- spec/data/attributes/distance_spec.rb
|
@@ -594,10 +460,6 @@ test_files:
|
|
594
460
|
- spec/weather_services/noaa/current_response_spec.rb
|
595
461
|
- spec/weather_services/noaa/forecast_response_spec.rb
|
596
462
|
- spec/weather_services/noaa_spec.rb
|
597
|
-
- spec/weather_services/weather_bug/current_response_spec.rb
|
598
|
-
- spec/weather_services/weather_bug/forecast_response_spec.rb
|
599
|
-
- spec/weather_services/weather_bug/query_spec.rb
|
600
|
-
- spec/weather_services/weather_bug_spec.rb
|
601
463
|
- spec/weather_services/wunderground_v1/current_response_spec.rb
|
602
464
|
- spec/weather_services/wunderground_v1/forecast_response_spec.rb
|
603
465
|
- spec/weather_services/wunderground_v1_spec.rb
|