forecast_io 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/.rspec +3 -0
- data/.rvmrc +1 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +20 -0
- data/README.md +86 -0
- data/Rakefile +11 -0
- data/forecast_io.gemspec +29 -0
- data/lib/forecast_io.rb +34 -0
- data/lib/forecast_io/configuration.rb +35 -0
- data/lib/forecast_io/version.rb +6 -0
- data/spec/cassettes/.keep +0 -0
- data/spec/cassettes/forecast_for_latitude_longitide.yml +385 -0
- data/spec/cassettes/forecast_for_latitude_longitide_and_query_params.yml +391 -0
- data/spec/cassettes/forecast_for_latitude_longitide_and_time.yml +47 -0
- data/spec/forecast_io/configuration_spec.rb +12 -0
- data/spec/forecast_io/forecast_io_spec.rb +41 -0
- data/spec/forecast_io/version_spec.rb +7 -0
- data/spec/spec_helper.rb +18 -0
- metadata +175 -0
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Forecast::IO do
|
4
|
+
describe '.forecast' do
|
5
|
+
it 'should return a forecast for a given latitude, longitude' do
|
6
|
+
VCR.use_cassette('forecast_for_latitude_longitide', record: :once) do
|
7
|
+
Forecast::IO.api_key = 'this-is-an-api-key'
|
8
|
+
forecast = Forecast::IO.forecast('37.8267','-122.423')
|
9
|
+
forecast.should_not be_nil
|
10
|
+
forecast.latitude.should == 37.8267
|
11
|
+
forecast.longitude.should == -122.423
|
12
|
+
forecast.daily.size.should == 3
|
13
|
+
forecast.alerts.should be_nil
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should return a forecast for a given latitude, longitude and time' do
|
18
|
+
VCR.use_cassette('forecast_for_latitude_longitide_and_time') do
|
19
|
+
Forecast::IO.api_key = 'this-is-an-api-key'
|
20
|
+
forecast = Forecast::IO.forecast('37.8267','-122.423', time: Time.new(2013, 3, 11).to_i)
|
21
|
+
forecast.should_not be_nil
|
22
|
+
forecast.latitude.should == 37.8267
|
23
|
+
forecast.longitude.should == -122.423
|
24
|
+
forecast.daily.size.should == 1
|
25
|
+
forecast.alerts.should be_nil
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should return a forecast for a given latitude, longitude and query params' do
|
30
|
+
VCR.use_cassette('forecast_for_latitude_longitide_and_query_params') do
|
31
|
+
Forecast::IO.api_key = 'this-is-an-api-key'
|
32
|
+
forecast = Forecast::IO.forecast('37.8267','-122.423', params: {si: true})
|
33
|
+
forecast.should_not be_nil
|
34
|
+
forecast.latitude.should == 37.8267
|
35
|
+
forecast.longitude.should == -122.423
|
36
|
+
forecast.daily.size.should == 3
|
37
|
+
forecast.alerts.should be_nil
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'forecast_io'
|
3
|
+
|
4
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
5
|
+
|
6
|
+
require 'vcr'
|
7
|
+
|
8
|
+
VCR.configure do |c|
|
9
|
+
c.cassette_library_dir = 'spec/cassettes'
|
10
|
+
c.hook_into :typhoeus
|
11
|
+
c.allow_http_connections_when_no_cassette = false
|
12
|
+
end
|
13
|
+
|
14
|
+
RSpec.configure do |config|
|
15
|
+
config.before(:each) do
|
16
|
+
Forecast::IO.api_key = nil
|
17
|
+
end
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,175 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: forecast_io
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- David Czarnecki
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-03-27 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: typhoeus
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: multi_json
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: hashie
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rake
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rspec
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: vcr
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
description: forecast.io API wrapper in Ruby
|
111
|
+
email:
|
112
|
+
- me@davidczarnecki.com
|
113
|
+
executables: []
|
114
|
+
extensions: []
|
115
|
+
extra_rdoc_files: []
|
116
|
+
files:
|
117
|
+
- .gitignore
|
118
|
+
- .rspec
|
119
|
+
- .rvmrc
|
120
|
+
- CHANGELOG.md
|
121
|
+
- Gemfile
|
122
|
+
- LICENSE.txt
|
123
|
+
- README.md
|
124
|
+
- Rakefile
|
125
|
+
- forecast_io.gemspec
|
126
|
+
- lib/forecast_io.rb
|
127
|
+
- lib/forecast_io/configuration.rb
|
128
|
+
- lib/forecast_io/version.rb
|
129
|
+
- spec/cassettes/.keep
|
130
|
+
- spec/cassettes/forecast_for_latitude_longitide.yml
|
131
|
+
- spec/cassettes/forecast_for_latitude_longitide_and_query_params.yml
|
132
|
+
- spec/cassettes/forecast_for_latitude_longitide_and_time.yml
|
133
|
+
- spec/forecast_io/configuration_spec.rb
|
134
|
+
- spec/forecast_io/forecast_io_spec.rb
|
135
|
+
- spec/forecast_io/version_spec.rb
|
136
|
+
- spec/spec_helper.rb
|
137
|
+
homepage: https://github.com/darkskyapp/forecast-ruby
|
138
|
+
licenses: []
|
139
|
+
post_install_message:
|
140
|
+
rdoc_options: []
|
141
|
+
require_paths:
|
142
|
+
- lib
|
143
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
144
|
+
none: false
|
145
|
+
requirements:
|
146
|
+
- - ! '>='
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: '0'
|
149
|
+
segments:
|
150
|
+
- 0
|
151
|
+
hash: 4509173212901527585
|
152
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
154
|
+
requirements:
|
155
|
+
- - ! '>='
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
158
|
+
segments:
|
159
|
+
- 0
|
160
|
+
hash: 4509173212901527585
|
161
|
+
requirements: []
|
162
|
+
rubyforge_project: forecast_io
|
163
|
+
rubygems_version: 1.8.25
|
164
|
+
signing_key:
|
165
|
+
specification_version: 3
|
166
|
+
summary: forecast.io API wrapper in Ruby
|
167
|
+
test_files:
|
168
|
+
- spec/cassettes/.keep
|
169
|
+
- spec/cassettes/forecast_for_latitude_longitide.yml
|
170
|
+
- spec/cassettes/forecast_for_latitude_longitide_and_query_params.yml
|
171
|
+
- spec/cassettes/forecast_for_latitude_longitide_and_time.yml
|
172
|
+
- spec/forecast_io/configuration_spec.rb
|
173
|
+
- spec/forecast_io/forecast_io_spec.rb
|
174
|
+
- spec/forecast_io/version_spec.rb
|
175
|
+
- spec/spec_helper.rb
|