forecast_io 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +2 -2
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +4 -0
- data/LICENSE.txt +1 -1
- data/README.md +1 -1
- data/lib/forecast_io/configuration.rb +1 -1
- data/lib/forecast_io/version.rb +1 -1
- data/spec/cassettes/forecast_for_latitude_longitude.yml +1 -1
- data/spec/cassettes/forecast_for_latitude_longitude_and_query_params.yml +1 -1
- data/spec/cassettes/forecast_for_latitude_longitude_and_time.yml +1 -1
- data/spec/forecast_io/configuration_spec.rb +2 -2
- data/spec/forecast_io/forecast_io_spec.rb +30 -30
- data/spec/forecast_io/version_spec.rb +1 -1
- metadata +25 -46
- data/.rvmrc +0 -1
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0bd639a3593f4d407dd9833b18c797250c05989b
|
4
|
+
data.tar.gz: e81f3541c4dad1d8598311144a22473636e614ff
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 36dcad0f6fc8db2fea47b5cf7181238d03be6d38e2a530e7ba93402e3cfcb111549abb638431a635b282a0ed98a7716e55938a31ec807eabbebdd3e6a942857f
|
7
|
+
data.tar.gz: a11101784cbea1796df0e11791b6022f0f5b7cbbe29cc9007b5d5fdb82b7ffc6430534b91d3dac309c6f78faa3830dff6a8b78dc4fc09dbbf34c97b74419b893
|
data/.rspec
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
--color
|
2
|
-
--format
|
3
|
-
--order random
|
2
|
+
--format documentation
|
3
|
+
--order random
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
forecast_io
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.3.1
|
data/CHANGELOG.md
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
data/lib/forecast_io/version.rb
CHANGED
@@ -4,8 +4,8 @@ describe ForecastIO::Configuration do
|
|
4
4
|
describe '.configure' do
|
5
5
|
it 'should have default attributes' do
|
6
6
|
ForecastIO.configure do |configuration|
|
7
|
-
configuration.api_endpoint.
|
8
|
-
configuration.api_key.
|
7
|
+
expect(configuration.api_endpoint).to eq(ForecastIO::Configuration::DEFAULT_FORECAST_IO_API_ENDPOINT)
|
8
|
+
expect(configuration.api_key).to be_nil
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe ForecastIO do
|
4
4
|
describe '.default_params' do
|
5
5
|
it "defaults to an empty hash" do
|
6
|
-
ForecastIO.default_params.
|
6
|
+
expect(ForecastIO.default_params).to eq({})
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
@@ -15,33 +15,33 @@ describe ForecastIO do
|
|
15
15
|
it 'should return a forecast for a given latitude, longitude' do
|
16
16
|
VCR.use_cassette('forecast_for_latitude_longitude', record: :once) do
|
17
17
|
forecast = ForecastIO.forecast('37.8267','-122.423')
|
18
|
-
forecast.
|
19
|
-
forecast.latitude.
|
20
|
-
forecast.longitude.
|
21
|
-
forecast.daily.size.
|
22
|
-
forecast.alerts.
|
18
|
+
expect(forecast).to_not be_nil
|
19
|
+
expect(forecast.latitude).to eq(37.8267)
|
20
|
+
expect(forecast.longitude).to eq(-122.423)
|
21
|
+
expect(forecast.daily.size).to eq(3)
|
22
|
+
expect(forecast.alerts).to be_nil
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
26
|
it 'should return a forecast for a given latitude, longitude and time' do
|
27
27
|
VCR.use_cassette('forecast_for_latitude_longitude_and_time') do
|
28
28
|
forecast = ForecastIO.forecast('37.8267','-122.423', time: Time.utc(2013, 3, 11, 4).to_i)
|
29
|
-
forecast.
|
30
|
-
forecast.latitude.
|
31
|
-
forecast.longitude.
|
32
|
-
forecast.daily.size.
|
33
|
-
forecast.alerts.
|
29
|
+
expect(forecast).to_not be_nil
|
30
|
+
expect(forecast.latitude).to eq(37.8267)
|
31
|
+
expect(forecast.longitude).to eq(-122.423)
|
32
|
+
expect(forecast.daily.size).to eq(1)
|
33
|
+
expect(forecast.alerts).to be_nil
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'should return a forecast for a given latitude, longitude and query params' do
|
38
38
|
VCR.use_cassette('forecast_for_latitude_longitude_and_query_params') do
|
39
39
|
forecast = ForecastIO.forecast('37.8267','-122.423', params: {units: 'si'})
|
40
|
-
forecast.
|
41
|
-
forecast.latitude.
|
42
|
-
forecast.longitude.
|
43
|
-
forecast.daily.size.
|
44
|
-
forecast.alerts.
|
40
|
+
expect(forecast).to_not be_nil
|
41
|
+
expect(forecast.latitude).to eq(37.8267)
|
42
|
+
expect(forecast.longitude).to eq(-122.423)
|
43
|
+
expect(forecast.daily.size).to eq(3)
|
44
|
+
expect(forecast.alerts).to be_nil
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
@@ -50,27 +50,27 @@ describe ForecastIO do
|
|
50
50
|
let(:response) { double 'Response', success?: true, body: '{}' }
|
51
51
|
|
52
52
|
before :each do
|
53
|
-
stub_const 'Faraday',
|
53
|
+
stub_const 'Faraday', double(new: faraday)
|
54
54
|
|
55
|
-
ForecastIO.
|
55
|
+
allow(ForecastIO).to receive_messages(api_key: 'abc123', connection: faraday)
|
56
56
|
end
|
57
57
|
|
58
58
|
context 'without default parameters' do
|
59
59
|
before :each do
|
60
|
-
ForecastIO.
|
60
|
+
expect(ForecastIO).to receive_messages(default_params: {})
|
61
61
|
end
|
62
62
|
|
63
63
|
it "sends through a standard request" do
|
64
|
-
faraday.
|
65
|
-
'https://api.
|
64
|
+
expect(faraday).to receive(:get).with(
|
65
|
+
'https://api.darksky.net/forecast/abc123/1.2,3.4', {}
|
66
66
|
).and_return(response)
|
67
67
|
|
68
68
|
ForecastIO.forecast(1.2, 3.4)
|
69
69
|
end
|
70
70
|
|
71
71
|
it "sends through provided parameters" do
|
72
|
-
faraday.
|
73
|
-
'https://api.
|
72
|
+
expect(faraday).to receive(:get).with(
|
73
|
+
'https://api.darksky.net/forecast/abc123/1.2,3.4', {units: 'si'}
|
74
74
|
).and_return(response)
|
75
75
|
|
76
76
|
ForecastIO.forecast(1.2, 3.4, params: {units: 'si'})
|
@@ -79,20 +79,20 @@ describe ForecastIO do
|
|
79
79
|
|
80
80
|
context 'with default parameters' do
|
81
81
|
before :each do
|
82
|
-
ForecastIO.
|
82
|
+
allow(ForecastIO).to receive_messages(default_params: {units: 'si'})
|
83
83
|
end
|
84
84
|
|
85
85
|
it "sends through the default parameters" do
|
86
|
-
faraday.
|
87
|
-
'https://api.
|
86
|
+
expect(faraday).to receive(:get).with(
|
87
|
+
'https://api.darksky.net/forecast/abc123/1.2,3.4', {units: 'si'}
|
88
88
|
).and_return(response)
|
89
89
|
|
90
90
|
ForecastIO.forecast(1.2, 3.4)
|
91
91
|
end
|
92
92
|
|
93
93
|
it "sends through the merged parameters" do
|
94
|
-
faraday.
|
95
|
-
'https://api.
|
94
|
+
expect(faraday).to receive(:get).with(
|
95
|
+
'https://api.darksky.net/forecast/abc123/1.2,3.4',
|
96
96
|
{units: 'si', exclude: 'daily'}
|
97
97
|
).and_return(response)
|
98
98
|
|
@@ -100,8 +100,8 @@ describe ForecastIO do
|
|
100
100
|
end
|
101
101
|
|
102
102
|
it "overwrites default parameters when appropriate" do
|
103
|
-
faraday.
|
104
|
-
'https://api.
|
103
|
+
expect(faraday).to receive(:get).with(
|
104
|
+
'https://api.darksky.net/forecast/abc123/1.2,3.4',
|
105
105
|
{units: 'imperial'}
|
106
106
|
).and_return(response)
|
107
107
|
|
metadata
CHANGED
@@ -1,126 +1,111 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: forecast_io
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
5
|
-
prerelease:
|
4
|
+
version: 2.0.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- David Czarnecki
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2016-09-20 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: faraday
|
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: multi_json
|
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'
|
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'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: hashie
|
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: rake
|
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: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - ">="
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: '0'
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: rspec
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - ">="
|
84
74
|
- !ruby/object:Gem::Version
|
85
75
|
version: '0'
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - ">="
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: '0'
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: vcr
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
|
-
- -
|
87
|
+
- - ">="
|
100
88
|
- !ruby/object:Gem::Version
|
101
89
|
version: '0'
|
102
90
|
type: :development
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
|
-
- -
|
94
|
+
- - ">="
|
108
95
|
- !ruby/object:Gem::Version
|
109
96
|
version: '0'
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
98
|
name: typhoeus
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
100
|
requirements:
|
115
|
-
- -
|
101
|
+
- - ">="
|
116
102
|
- !ruby/object:Gem::Version
|
117
103
|
version: '0'
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
107
|
requirements:
|
123
|
-
- -
|
108
|
+
- - ">="
|
124
109
|
- !ruby/object:Gem::Version
|
125
110
|
version: '0'
|
126
111
|
description: forecast.io API wrapper in Ruby
|
@@ -130,9 +115,10 @@ executables: []
|
|
130
115
|
extensions: []
|
131
116
|
extra_rdoc_files: []
|
132
117
|
files:
|
133
|
-
- .gitignore
|
134
|
-
- .rspec
|
135
|
-
- .
|
118
|
+
- ".gitignore"
|
119
|
+
- ".rspec"
|
120
|
+
- ".ruby-gemset"
|
121
|
+
- ".ruby-version"
|
136
122
|
- CHANGELOG.md
|
137
123
|
- Gemfile
|
138
124
|
- LICENSE.txt
|
@@ -152,33 +138,26 @@ files:
|
|
152
138
|
- spec/spec_helper.rb
|
153
139
|
homepage: https://github.com/darkskyapp/forecast-ruby
|
154
140
|
licenses: []
|
141
|
+
metadata: {}
|
155
142
|
post_install_message:
|
156
143
|
rdoc_options: []
|
157
144
|
require_paths:
|
158
145
|
- lib
|
159
146
|
required_ruby_version: !ruby/object:Gem::Requirement
|
160
|
-
none: false
|
161
147
|
requirements:
|
162
|
-
- -
|
148
|
+
- - ">="
|
163
149
|
- !ruby/object:Gem::Version
|
164
150
|
version: '0'
|
165
|
-
segments:
|
166
|
-
- 0
|
167
|
-
hash: -4308199890416542600
|
168
151
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
169
|
-
none: false
|
170
152
|
requirements:
|
171
|
-
- -
|
153
|
+
- - ">="
|
172
154
|
- !ruby/object:Gem::Version
|
173
155
|
version: '0'
|
174
|
-
segments:
|
175
|
-
- 0
|
176
|
-
hash: -4308199890416542600
|
177
156
|
requirements: []
|
178
157
|
rubyforge_project: forecast_io
|
179
|
-
rubygems_version:
|
158
|
+
rubygems_version: 2.5.1
|
180
159
|
signing_key:
|
181
|
-
specification_version:
|
160
|
+
specification_version: 4
|
182
161
|
summary: forecast.io API wrapper in Ruby
|
183
162
|
test_files:
|
184
163
|
- spec/cassettes/.keep
|
data/.rvmrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rvm use ruby-1.9.3@forecast_io --create
|