open_weather_api 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +26 -0
- data/LICENSE.txt +22 -0
- data/README.md +36 -0
- data/Rakefile +8 -0
- data/lib/open_weather_api.rb +4 -0
- data/lib/open_weather_api/city_methods.rb +15 -0
- data/lib/open_weather_api/configure.rb +21 -0
- data/lib/open_weather_api/current.rb +21 -0
- data/lib/open_weather_api/forecast.rb +21 -0
- data/lib/open_weather_api/location.rb +64 -0
- data/lib/open_weather_api/version.rb +3 -0
- data/open_weather_api.gemspec +27 -0
- data/spec/fixtures/openweathermap_cassettes/current.yml +87 -0
- data/spec/fixtures/openweathermap_cassettes/forecast.yml +171 -0
- data/spec/lib/configure_spec.rb +15 -0
- data/spec/lib/current_spec.rb +23 -0
- data/spec/lib/forecast_spec.rb +23 -0
- data/spec/lib/location_spec.rb +39 -0
- data/spec/lib/open_weather_api_spec.rb +59 -0
- data/spec/spec_helper.rb +10 -0
- metadata +143 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f2bd6b79871ed42e5fb3cac973083408aa5740a3
|
4
|
+
data.tar.gz: 0e185646c4b8e6677e23710b6b40dfd7efae93b5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 84c0c2ff356312f7383979b4ab480c38eb071508587083a8324dcd8f63d0e1140a2fe5d723bf3abd714b4f7f90ece6f598d344f9cf5d8c275bfa6cef7243a7d1
|
7
|
+
data.tar.gz: 6d0b183df417124b9c44dc6e93c342a066557da73650d741d89337cfc2de205cc972ed059cb20bf7bd10f7e5ea01f7b9e5a0eabf63b4c585c3d6a3229b60a2fc
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
addressable (2.3.6)
|
5
|
+
crack (0.4.2)
|
6
|
+
safe_yaml (~> 1.0.0)
|
7
|
+
httparty (0.13.3)
|
8
|
+
json (~> 1.8)
|
9
|
+
multi_xml (>= 0.5.2)
|
10
|
+
json (1.8.1)
|
11
|
+
multi_xml (0.5.5)
|
12
|
+
rake (10.4.2)
|
13
|
+
safe_yaml (1.0.4)
|
14
|
+
vcr (2.9.3)
|
15
|
+
webmock (1.20.4)
|
16
|
+
addressable (>= 2.3.6)
|
17
|
+
crack (>= 0.3.2)
|
18
|
+
|
19
|
+
PLATFORMS
|
20
|
+
ruby
|
21
|
+
|
22
|
+
DEPENDENCIES
|
23
|
+
httparty
|
24
|
+
rake
|
25
|
+
vcr
|
26
|
+
webmock
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Peter Debelak
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# open-weather-map
|
2
|
+
|
3
|
+
A gem wrapper for the [OpenWeatherMap API](http://openweathermap.org/api).
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'open_weather_map'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install open_weather_map
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
### Quick Start:
|
22
|
+
|
23
|
+
`
|
24
|
+
OpenWeatherMap.city("London").forecast
|
25
|
+
OpenWeatherMap.city_id(524901).forecast
|
26
|
+
OpenWeatherMap.geolocate(lat: 45.321, lng: 34201).forecast
|
27
|
+
OpenWeatherMap.geolocate(ObjectThatRespondsToLatAndLngMethods).forecast
|
28
|
+
`
|
29
|
+
|
30
|
+
## Contributing
|
31
|
+
|
32
|
+
1. Fork it ( https://github.com/pdebelak/open-weather-map/fork )
|
33
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
34
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
35
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
36
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
module OpenWeatherApi
|
2
|
+
def self.city(city)
|
3
|
+
Location.new(city: city)
|
4
|
+
end
|
5
|
+
|
6
|
+
def self.city_id(city_id)
|
7
|
+
Location.new(city_id: city_id)
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.geolocate(args)
|
11
|
+
lat = args.respond_to?(:lat) ? args.lat : args[:lat]
|
12
|
+
lng = args.respond_to?(:lng) ? args.lng : args[:lng]
|
13
|
+
Location.new(lat: lat, lng: lng)
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module OpenWeatherApi
|
2
|
+
class << self
|
3
|
+
attr_writer :configuration
|
4
|
+
end
|
5
|
+
|
6
|
+
def self.configuration
|
7
|
+
@configuration ||= Configuration.new
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.configure
|
11
|
+
yield(configuration)
|
12
|
+
end
|
13
|
+
|
14
|
+
class Configuration
|
15
|
+
attr_accessor :app_id
|
16
|
+
|
17
|
+
def initialize
|
18
|
+
@app_id = nil
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module OpenWeatherApi
|
2
|
+
class Current
|
3
|
+
def initialize(current)
|
4
|
+
@current_hash = current.parsed_response
|
5
|
+
end
|
6
|
+
|
7
|
+
def [](key)
|
8
|
+
@current_hash[key]
|
9
|
+
end
|
10
|
+
|
11
|
+
def method_missing(name, *args, &block)
|
12
|
+
if @current_hash.respond_to? name
|
13
|
+
@current_hash.send(name)
|
14
|
+
elsif @current_hash.has_key?(name.to_s)
|
15
|
+
@current_hash[name.to_s]
|
16
|
+
else
|
17
|
+
super
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module OpenWeatherApi
|
2
|
+
class Forecast
|
3
|
+
def initialize(forecast)
|
4
|
+
@forecast_hash = forecast.parsed_response
|
5
|
+
end
|
6
|
+
|
7
|
+
def [](key)
|
8
|
+
@forecast_hash[key]
|
9
|
+
end
|
10
|
+
|
11
|
+
def method_missing(name, *args, &block)
|
12
|
+
if @forecast_hash.respond_to? name
|
13
|
+
@forecast_hash.send(name)
|
14
|
+
elsif @forecast_hash.has_key?(name.to_s)
|
15
|
+
@forecast_hash[name.to_s]
|
16
|
+
else
|
17
|
+
super
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require_relative 'city_methods'
|
2
|
+
|
3
|
+
module OpenWeatherApi
|
4
|
+
|
5
|
+
class Location
|
6
|
+
include HTTParty
|
7
|
+
attr_reader :city, :city_id, :lat, :lng, :app_id
|
8
|
+
|
9
|
+
base_uri 'http://api.openweathermap.org/data/2.5'
|
10
|
+
|
11
|
+
def initialize(args)
|
12
|
+
@city = args[:city]
|
13
|
+
@city_id = args[:city_id]
|
14
|
+
@lat = args[:lat]
|
15
|
+
@lng = args[:lng]
|
16
|
+
@app_id = OpenWeatherApi.configuration.app_id
|
17
|
+
end
|
18
|
+
|
19
|
+
def forecast(options={})
|
20
|
+
defaults = {
|
21
|
+
daily: false,
|
22
|
+
units: 'imperial',
|
23
|
+
count: 16
|
24
|
+
}
|
25
|
+
options = defaults.merge(options)
|
26
|
+
forecast = get_forecast(options)
|
27
|
+
OpenWeatherApi::Forecast.new(forecast)
|
28
|
+
end
|
29
|
+
|
30
|
+
def current
|
31
|
+
current = make_request("/weather?#{location_query}")
|
32
|
+
OpenWeatherApi::Current.new(current)
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def get_forecast(options)
|
38
|
+
options[:daily] ? daily_forecast(options) : three_hour_forecast(options)
|
39
|
+
end
|
40
|
+
|
41
|
+
def daily_forecast(options)
|
42
|
+
make_request("/forecast/daily?#{location_query}&cnt=#{options[:count]}&units=#{options[:units]}")
|
43
|
+
end
|
44
|
+
|
45
|
+
def three_hour_forecast(options)
|
46
|
+
make_request("/forecast?#{location_query}&units=#{options[:units]}")
|
47
|
+
end
|
48
|
+
|
49
|
+
def location_query
|
50
|
+
return "id=#{city_id}" if city_id
|
51
|
+
return "q=#{city}" if city
|
52
|
+
return "lat=#{lat}&lon=#{lng}" if lat && lng
|
53
|
+
end
|
54
|
+
|
55
|
+
def make_request(url)
|
56
|
+
self.class.get(add_app_id(url))
|
57
|
+
end
|
58
|
+
|
59
|
+
def add_app_id(url)
|
60
|
+
return url unless app_id
|
61
|
+
url + "&APPID=#{app_id}"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'open_weather_api/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "open_weather_api"
|
8
|
+
spec.version = OpenWeatherApi::VERSION
|
9
|
+
spec.authors = ["Peter Debelak"]
|
10
|
+
spec.email = ["pdebelak@gmail.com"]
|
11
|
+
spec.summary = %q{Gem to wrap http://openweathermap.org/api}
|
12
|
+
spec.description = %q{Gem to wrap http://openweathermap.org/api}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split("\n")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "webmock"
|
24
|
+
spec.add_development_dependency "vcr"
|
25
|
+
|
26
|
+
spec.add_dependency "httparty"
|
27
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://api.openweathermap.org/data/2.5/weather?id=524901
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- nginx
|
23
|
+
Date:
|
24
|
+
- Wed, 07 Jan 2015 17:16:52 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json; charset=utf-8
|
27
|
+
Transfer-Encoding:
|
28
|
+
- chunked
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
X-Source:
|
32
|
+
- redis
|
33
|
+
Access-Control-Allow-Origin:
|
34
|
+
- "*"
|
35
|
+
Access-Control-Allow-Credentials:
|
36
|
+
- 'true'
|
37
|
+
Access-Control-Allow-Methods:
|
38
|
+
- GET, POST
|
39
|
+
body:
|
40
|
+
encoding: UTF-8
|
41
|
+
string: |
|
42
|
+
{"coord":{"lon":37.62,"lat":55.75},"sys":{"type":3,"id":150069,"message":0.0232,"country":"RU","sunrise":1420610166,"sunset":1420636537},"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03n"}],"base":"cmc stations","main":{"temp":255,"humidity":88,"pressure":1034.321,"temp_min":250.09,"temp_max":257.25},"wind":{"speed":2.2,"gust":4,"deg":292},"clouds":{"all":48},"dt":1420650291,"id":524901,"name":"Moscow","cod":200}
|
43
|
+
http_version:
|
44
|
+
recorded_at: Wed, 07 Jan 2015 17:16:51 GMT
|
45
|
+
- request:
|
46
|
+
method: get
|
47
|
+
uri: http://api.openweathermap.org/data/2.5/weather?APPID=12345&id=524901
|
48
|
+
body:
|
49
|
+
encoding: US-ASCII
|
50
|
+
string: ''
|
51
|
+
headers:
|
52
|
+
Accept-Encoding:
|
53
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
54
|
+
Accept:
|
55
|
+
- "*/*"
|
56
|
+
User-Agent:
|
57
|
+
- Ruby
|
58
|
+
response:
|
59
|
+
status:
|
60
|
+
code: 200
|
61
|
+
message: OK
|
62
|
+
headers:
|
63
|
+
Server:
|
64
|
+
- nginx
|
65
|
+
Date:
|
66
|
+
- Wed, 07 Jan 2015 18:15:07 GMT
|
67
|
+
Content-Type:
|
68
|
+
- application/json; charset=utf-8
|
69
|
+
Transfer-Encoding:
|
70
|
+
- chunked
|
71
|
+
Connection:
|
72
|
+
- keep-alive
|
73
|
+
X-Source:
|
74
|
+
- back
|
75
|
+
Access-Control-Allow-Origin:
|
76
|
+
- "*"
|
77
|
+
Access-Control-Allow-Credentials:
|
78
|
+
- 'true'
|
79
|
+
Access-Control-Allow-Methods:
|
80
|
+
- GET, POST
|
81
|
+
body:
|
82
|
+
encoding: UTF-8
|
83
|
+
string: |
|
84
|
+
{"coord":{"lon":37.62,"lat":55.75},"sys":{"type":3,"id":150069,"message":0.2261,"country":"RU","sunrise":1420610166,"sunset":1420636537},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01n"}],"base":"cmc stations","main":{"temp":254.74,"humidity":88,"pressure":1034.017,"temp_min":249.9,"temp_max":257.25},"wind":{"speed":1.8,"gust":3.6,"deg":292},"clouds":{"all":0},"dt":1420654355,"id":524901,"name":"Moscow","cod":200}
|
85
|
+
http_version:
|
86
|
+
recorded_at: Wed, 07 Jan 2015 18:15:07 GMT
|
87
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,171 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://api.openweathermap.org/data/2.5/forecast?id=524901&units=imperial
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- nginx
|
23
|
+
Date:
|
24
|
+
- Mon, 05 Jan 2015 19:58:13 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json; charset=utf-8
|
27
|
+
Transfer-Encoding:
|
28
|
+
- chunked
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
X-Source:
|
32
|
+
- back
|
33
|
+
Access-Control-Allow-Origin:
|
34
|
+
- "*"
|
35
|
+
Access-Control-Allow-Credentials:
|
36
|
+
- 'true'
|
37
|
+
Access-Control-Allow-Methods:
|
38
|
+
- GET, POST
|
39
|
+
body:
|
40
|
+
encoding: UTF-8
|
41
|
+
string: |
|
42
|
+
{"cod":"200","message":0.3356,"city":{"id":524901,"name":"Moscow","coord":{"lon":37.615555,"lat":55.75222},"country":"RU","population":1000000},"cnt":35,"list":[{"dt":1420480800,"main":{"temp":6.15,"temp_min":4.63,"temp_max":6.15,"pressure":997.39,"sea_level":1018.78,"grnd_level":997.39,"humidity":77,"temp_kf":0.85},"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13n"}],"clouds":{"all":80},"wind":{"speed":10.54,"deg":354.504},"snow":{"3h":0.175},"sys":{"pod":"n"},"dt_txt":"2015-01-05 18:00:00"},{"dt":1420491600,"main":{"temp":5.81,"temp_min":4.36,"temp_max":5.81,"pressure":999.35,"sea_level":1020.85,"grnd_level":999.35,"humidity":78,"temp_kf":0.8},"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13n"}],"clouds":{"all":92},"wind":{"speed":10.93,"deg":356.004},"snow":{"3h":0.25},"sys":{"pod":"n"},"dt_txt":"2015-01-05 21:00:00"},{"dt":1420502400,"main":{"temp":6.17,"temp_min":4.79,"temp_max":6.17,"pressure":1001.13,"sea_level":1022.74,"grnd_level":1001.13,"humidity":76,"temp_kf":0.76},"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13n"}],"clouds":{"all":88},"wind":{"speed":11.45,"deg":359.5},"snow":{"3h":0.125},"sys":{"pod":"n"},"dt_txt":"2015-01-06 00:00:00"},{"dt":1420513200,"main":{"temp":4.71,"temp_min":3.41,"temp_max":4.71,"pressure":1003.51,"sea_level":1025.12,"grnd_level":1003.51,"humidity":81,"temp_kf":0.72},"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13n"}],"clouds":{"all":76},"wind":{"speed":12.38,"deg":357.504},"snow":{"3h":0.25},"sys":{"pod":"n"},"dt_txt":"2015-01-06 03:00:00"},{"dt":1420524000,"main":{"temp":3.2,"temp_min":1.99,"temp_max":3.2,"pressure":1005.46,"sea_level":1027.27,"grnd_level":1005.46,"humidity":78,"temp_kf":0.68},"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03d"}],"clouds":{"all":44},"wind":{"speed":11.73,"deg":355.504},"snow":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2015-01-06 06:00:00"},{"dt":1420534800,"main":{"temp":5.5,"temp_min":4.36,"temp_max":5.5,"pressure":1006.79,"sea_level":1028.56,"grnd_level":1006.79,"humidity":78,"temp_kf":0.64},"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03d"}],"clouds":{"all":48},"wind":{"speed":11.6,"deg":353.507},"snow":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2015-01-06 09:00:00"},{"dt":1420545600,"main":{"temp":4.44,"temp_min":3.38,"temp_max":4.44,"pressure":1008.33,"sea_level":1030.12,"grnd_level":1008.33,"humidity":82,"temp_kf":0.59},"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03d"}],"clouds":{"all":36},"wind":{"speed":11.56,"deg":356.002},"snow":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2015-01-06 12:00:00"},{"dt":1420556400,"main":{"temp":1.4,"temp_min":0.41,"temp_max":1.4,"pressure":1010.83,"sea_level":1032.77,"grnd_level":1010.83,"humidity":73,"temp_kf":0.55},"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03n"}],"clouds":{"all":36},"wind":{"speed":9.66,"deg":357.007},"snow":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2015-01-06 15:00:00"},{"dt":1420567200,"main":{"temp":0.91,"temp_min":-0,"temp_max":0.91,"pressure":1009.27,"sea_level":1031.39,"grnd_level":1009.27,"humidity":75,"temp_kf":0.51},"weather":[{"id":601,"main":"Snow","description":"snow","icon":"13n"}],"clouds":{"all":12},"wind":{"speed":9.44,"deg":5.50281},"snow":{"3h":4.25},"sys":{"pod":"n"},"dt_txt":"2015-01-06 18:00:00"},{"dt":1420578000,"main":{"temp":-5.49,"temp_min":-6.33,"temp_max":-5.49,"pressure":1011.68,"sea_level":1033.87,"grnd_level":1011.68,"humidity":72,"temp_kf":0.47},"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13n"}],"clouds":{"all":32},"wind":{"speed":9.57,"deg":358.501},"snow":{"3h":0.25},"sys":{"pod":"n"},"dt_txt":"2015-01-06 21:00:00"},{"dt":1420588800,"main":{"temp":-6.54,"temp_min":-7.29,"temp_max":-6.54,"pressure":1013.5,"sea_level":1035.87,"grnd_level":1013.5,"humidity":76,"temp_kf":0.42},"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03n"}],"clouds":{"all":32},"wind":{"speed":9.01,"deg":355.003},"snow":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2015-01-07 00:00:00"},{"dt":1420599600,"main":{"temp":-5.98,"temp_min":-6.67,"temp_max":-5.98,"pressure":1013.84,"sea_level":1036.3,"grnd_level":1013.84,"humidity":74,"temp_kf":0.38},"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03n"}],"clouds":{"all":32},"wind":{"speed":8.99,"deg":350.001},"snow":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2015-01-07 03:00:00"},{"dt":1420610400,"main":{"temp":-7.01,"temp_min":-7.62,"temp_max":-7.01,"pressure":1014.71,"sea_level":1037.15,"grnd_level":1014.71,"humidity":77,"temp_kf":0.34},"weather":[{"id":800,"main":"Clear","description":"sky is clear","icon":"01d"}],"clouds":{"all":0},"wind":{"speed":8.45,"deg":348.003},"snow":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2015-01-07 06:00:00"},{"dt":1420621200,"main":{"temp":-3.37,"temp_min":-3.9,"temp_max":-3.37,"pressure":1015.43,"sea_level":1037.8,"grnd_level":1015.43,"humidity":78,"temp_kf":0.3},"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03d"}],"clouds":{"all":36},"wind":{"speed":7.71,"deg":346.003},"snow":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2015-01-07 09:00:00"},{"dt":1420632000,"main":{"temp":-1.21,"temp_min":-1.66,"temp_max":-1.21,"pressure":1015.78,"sea_level":1038.12,"grnd_level":1015.78,"humidity":81,"temp_kf":0.25},"weather":[{"id":801,"main":"Clouds","description":"few clouds","icon":"02d"}],"clouds":{"all":20},"wind":{"speed":9.09,"deg":354.002},"snow":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2015-01-07 12:00:00"},{"dt":1420642800,"main":{"temp":-5.15,"temp_min":-5.54,"temp_max":-5.15,"pressure":1017.37,"sea_level":1039.83,"grnd_level":1017.37,"humidity":70,"temp_kf":0.21},"weather":[{"id":800,"main":"Clear","description":"sky is clear","icon":"01n"}],"clouds":{"all":0},"wind":{"speed":9.42,"deg":357.5},"snow":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2015-01-07 15:00:00"},{"dt":1420653600,"main":{"temp":-6.11,"temp_min":-6.41,"temp_max":-6.11,"pressure":1017.52,"sea_level":1040.07,"grnd_level":1017.52,"humidity":73,"temp_kf":0.17},"weather":[{"id":801,"main":"Clouds","description":"few clouds","icon":"02n"}],"clouds":{"all":24},"wind":{"speed":7.47,"deg":343.006},"snow":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2015-01-07 18:00:00"},{"dt":1420664400,"main":{"temp":0.99,"temp_min":0.76,"temp_max":0.99,"pressure":1016.68,"sea_level":1039.32,"grnd_level":1016.68,"humidity":73,"temp_kf":0.13},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04n"}],"clouds":{"all":76},"wind":{"speed":8.45,"deg":324.502},"snow":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2015-01-07 21:00:00"},{"dt":1420675200,"main":{"temp":5.38,"temp_min":5.22,"temp_max":5.38,"pressure":1017.14,"sea_level":1039.61,"grnd_level":1017.14,"humidity":84,"temp_kf":0.08},"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13n"}],"clouds":{"all":56},"wind":{"speed":9.55,"deg":357.004},"snow":{"3h":0.5},"sys":{"pod":"n"},"dt_txt":"2015-01-08 00:00:00"},{"dt":1420686000,"main":{"temp":6.58,"temp_min":6.51,"temp_max":6.58,"pressure":1017.9,"sea_level":1040.5,"grnd_level":1017.9,"humidity":80,"temp_kf":0.04},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04n"}],"clouds":{"all":56},"wind":{"speed":8.55,"deg":357.004},"snow":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2015-01-08 03:00:00"},{"dt":1420696800,"main":{"temp":6.33,"temp_min":6.33,"temp_max":6.33,"pressure":1018.96,"sea_level":1041.65,"grnd_level":1018.96,"humidity":80},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":56},"wind":{"speed":7.56,"deg":346.002},"snow":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2015-01-08 06:00:00"},{"dt":1420707600,"main":{"temp":7.62,"temp_min":7.62,"temp_max":7.62,"pressure":1019.6,"sea_level":1042,"grnd_level":1019.6,"humidity":83},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":56},"wind":{"speed":6.18,"deg":332.002},"snow":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2015-01-08 09:00:00"},{"dt":1420718400,"main":{"temp":7.71,"temp_min":7.71,"temp_max":7.71,"pressure":1019.69,"sea_level":1041.96,"grnd_level":1019.69,"humidity":83},"weather":[{"id":801,"main":"Clouds","description":"few clouds","icon":"02d"}],"clouds":{"all":24},"wind":{"speed":5.34,"deg":317.501},"snow":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2015-01-08 12:00:00"},{"dt":1420729200,"main":{"temp":-3.26,"temp_min":-3.26,"temp_max":-3.26,"pressure":1019.96,"sea_level":1042.48,"grnd_level":1019.96,"humidity":76},"weather":[{"id":800,"main":"Clear","description":"sky is clear","icon":"01n"}],"clouds":{"all":0},"wind":{"speed":5.51,"deg":289.5},"snow":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2015-01-08 15:00:00"},{"dt":1420740000,"main":{"temp":-13.44,"temp_min":-13.44,"temp_max":-13.44,"pressure":1018.71,"sea_level":1041.36,"grnd_level":1018.71,"humidity":53},"weather":[{"id":800,"main":"Clear","description":"sky is clear","icon":"01n"}],"clouds":{"all":0},"wind":{"speed":2.59,"deg":220},"snow":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2015-01-08 18:00:00"},{"dt":1420750800,"main":{"temp":-15.93,"temp_min":-15.93,"temp_max":-15.93,"pressure":1016.88,"sea_level":1039.46,"grnd_level":1016.88,"humidity":47},"weather":[{"id":800,"main":"Clear","description":"sky is clear","icon":"02n"}],"clouds":{"all":8},"wind":{"speed":3.39,"deg":200.501},"snow":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2015-01-08 21:00:00"},{"dt":1420761600,"main":{"temp":-3.53,"temp_min":-3.53,"temp_max":-3.53,"pressure":1014.54,"sea_level":1036.97,"grnd_level":1014.54,"humidity":76},"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03n"}],"clouds":{"all":36},"wind":{"speed":7.67,"deg":212.501},"snow":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2015-01-09 00:00:00"},{"dt":1420772400,"main":{"temp":2.29,"temp_min":2.29,"temp_max":2.29,"pressure":1011.28,"sea_level":1033.34,"grnd_level":1011.28,"humidity":77},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04n"}],"clouds":{"all":64},"wind":{"speed":9.31,"deg":202.001},"snow":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2015-01-09 03:00:00"},{"dt":1420783200,"main":{"temp":6,"temp_min":6,"temp_max":6,"pressure":1006.93,"sea_level":1028.77,"grnd_level":1006.93,"humidity":81},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":76},"wind":{"speed":12.14,"deg":192.5},"snow":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2015-01-09 06:00:00"},{"dt":1420794000,"main":{"temp":10.12,"temp_min":10.12,"temp_max":10.12,"pressure":1002.51,"sea_level":1024.04,"grnd_level":1002.51,"humidity":80},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":76},"wind":{"speed":14.93,"deg":189.501},"snow":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2015-01-09 09:00:00"},{"dt":1420804800,"main":{"temp":12.25,"temp_min":12.25,"temp_max":12.25,"pressure":998.23,"sea_level":1019.56,"grnd_level":998.23,"humidity":85},"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13d"}],"clouds":{"all":80},"wind":{"speed":16.46,"deg":191.501},"snow":{"3h":1.5},"sys":{"pod":"d"},"dt_txt":"2015-01-09 12:00:00"},{"dt":1420815600,"main":{"temp":12.47,"temp_min":12.47,"temp_max":12.47,"pressure":995.48,"sea_level":1016.81,"grnd_level":995.48,"humidity":83},"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13n"}],"clouds":{"all":88},"wind":{"speed":14.73,"deg":197.502},"snow":{"3h":1.5},"sys":{"pod":"n"},"dt_txt":"2015-01-09 15:00:00"},{"dt":1420826400,"main":{"temp":14.55,"temp_min":14.55,"temp_max":14.55,"pressure":992.32,"sea_level":1013.62,"grnd_level":992.32,"humidity":81},"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13n"}],"clouds":{"all":80},"wind":{"speed":12.36,"deg":191.505},"snow":{"3h":0.5},"sys":{"pod":"n"},"dt_txt":"2015-01-09 18:00:00"},{"dt":1420837200,"main":{"temp":19.5,"temp_min":19.5,"temp_max":19.5,"pressure":990.29,"sea_level":1011.37,"grnd_level":990.29,"humidity":87},"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13n"}],"clouds":{"all":92},"wind":{"speed":8.88,"deg":193.501},"snow":{"3h":0.5},"sys":{"pod":"n"},"dt_txt":"2015-01-09 21:00:00"},{"dt":1420848000,"main":{"temp":26.74,"temp_min":26.74,"temp_max":26.74,"pressure":990.12,"sea_level":1011.03,"grnd_level":990.12,"humidity":90},"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13n"}],"clouds":{"all":80},"wind":{"speed":7.8,"deg":226.501},"snow":{"3h":0.5},"sys":{"pod":"n"},"dt_txt":"2015-01-10 00:00:00"}]}
|
43
|
+
http_version:
|
44
|
+
recorded_at: Mon, 05 Jan 2015 19:58:13 GMT
|
45
|
+
- request:
|
46
|
+
method: get
|
47
|
+
uri: http://api.openweathermap.org/data/2.5/forecast/daily?cnt=16&id=524901&units=imperial
|
48
|
+
body:
|
49
|
+
encoding: US-ASCII
|
50
|
+
string: ''
|
51
|
+
headers:
|
52
|
+
Accept-Encoding:
|
53
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
54
|
+
Accept:
|
55
|
+
- "*/*"
|
56
|
+
User-Agent:
|
57
|
+
- Ruby
|
58
|
+
response:
|
59
|
+
status:
|
60
|
+
code: 200
|
61
|
+
message: OK
|
62
|
+
headers:
|
63
|
+
Server:
|
64
|
+
- nginx
|
65
|
+
Date:
|
66
|
+
- Wed, 07 Jan 2015 03:22:55 GMT
|
67
|
+
Content-Type:
|
68
|
+
- application/json; charset=utf-8
|
69
|
+
Transfer-Encoding:
|
70
|
+
- chunked
|
71
|
+
Connection:
|
72
|
+
- keep-alive
|
73
|
+
X-Source:
|
74
|
+
- back
|
75
|
+
Access-Control-Allow-Origin:
|
76
|
+
- "*"
|
77
|
+
Access-Control-Allow-Credentials:
|
78
|
+
- 'true'
|
79
|
+
Access-Control-Allow-Methods:
|
80
|
+
- GET, POST
|
81
|
+
body:
|
82
|
+
encoding: UTF-8
|
83
|
+
string: |
|
84
|
+
{"cod":"200","message":0.2805,"city":{"id":524901,"name":"Moscow","coord":{"lon":37.615555,"lat":55.75222},"country":"RU","population":1000000},"cnt":16,"list":[{"dt":1420621200,"temp":{"day":-1.1,"min":-9.27,"max":4.53,"night":2.62,"eve":3.38,"morn":-6.95},"pressure":1017.83,"humidity":75,"weather":[{"id":800,"main":"Clear","description":"sky is clear","icon":"01d"}],"speed":7.8,"deg":332,"clouds":0},{"dt":1420707600,"temp":{"day":8.89,"min":1.4,"max":12.16,"night":9.82,"eve":10.72,"morn":1.4},"pressure":1013.74,"humidity":74,"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13d"}],"speed":12.33,"deg":259,"clouds":76,"snow":1},{"dt":1420794000,"temp":{"day":12.78,"min":8.65,"max":12.78,"night":9.81,"eve":9.66,"morn":11.43},"pressure":991.62,"humidity":84,"weather":[{"id":601,"main":"Snow","description":"snow","icon":"13d"}],"speed":11.99,"deg":211,"clouds":92,"snow":6},{"dt":1420880400,"temp":{"day":30.65,"min":18.46,"max":30.65,"night":27.66,"eve":29.39,"morn":18.46},"pressure":979.38,"humidity":92,"weather":[{"id":601,"main":"Snow","description":"snow","icon":"13d"}],"speed":13.41,"deg":236,"clouds":92,"snow":2.5},{"dt":1420966800,"temp":{"day":36.19,"min":31.55,"max":36.93,"night":35.13,"eve":36.93,"morn":31.55},"pressure":964.53,"humidity":0,"weather":[{"id":601,"main":"Snow","description":"snow","icon":"13d"}],"speed":17.06,"deg":214,"clouds":96,"rain":1.71,"snow":2.26},{"dt":1421053200,"temp":{"day":17.67,"min":8.67,"max":24.76,"night":8.67,"eve":12.07,"morn":24.76},"pressure":977.63,"humidity":0,"weather":[{"id":601,"main":"Snow","description":"snow","icon":"13d"}],"speed":19.25,"deg":298,"clouds":98,"snow":2.18},{"dt":1421139600,"temp":{"day":4.82,"min":-3.05,"max":4.82,"night":-3.05,"eve":-0.36,"morn":1.63},"pressure":993.7,"humidity":0,"weather":[{"id":800,"main":"Clear","description":"sky is clear","icon":"01d"}],"speed":7.37,"deg":304,"clouds":5,"snow":0},{"dt":1421226000,"temp":{"day":8.49,"min":-6.88,"max":15.69,"night":14.99,"eve":15.69,"morn":-6.88},"pressure":987.91,"humidity":0,"weather":[{"id":601,"main":"Snow","description":"snow","icon":"13d"}],"speed":12.87,"deg":147,"clouds":97,"snow":2.33},{"dt":1421312400,"temp":{"day":13.95,"min":-2.2,"max":13.95,"night":-2.2,"eve":9.23,"morn":12.22},"pressure":1004.87,"humidity":0,"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13d"}],"speed":13.95,"deg":20,"clouds":72,"snow":0.66},{"dt":1421398800,"temp":{"day":11.16,"min":1.11,"max":27.61,"night":27.61,"eve":20.03,"morn":1.11},"pressure":1007.81,"humidity":0,"weather":[{"id":601,"main":"Snow","description":"snow","icon":"13d"}],"speed":15.06,"deg":201,"clouds":11,"snow":3.99},{"dt":1421485200,"temp":{"day":33.33,"min":30.4,"max":33.33,"night":32.74,"eve":31.32,"morn":30.4},"pressure":992.7,"humidity":0,"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13d"}],"speed":9.44,"deg":224,"clouds":78,"snow":0.53},{"dt":1421571600,"temp":{"day":31.5,"min":24.33,"max":31.59,"night":24.33,"eve":30.63,"morn":31.59},"pressure":987.39,"humidity":0,"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13d"}],"speed":7.62,"deg":272,"clouds":56,"snow":0.68},{"dt":1421658000,"temp":{"day":28.74,"min":21.76,"max":34.81,"night":30.54,"eve":34.81,"morn":21.76},"pressure":983.11,"humidity":0,"weather":[{"id":601,"main":"Snow","description":"snow","icon":"13d"}],"speed":20.43,"deg":186,"clouds":98,"rain":0.25,"snow":2.05},{"dt":1421744400,"temp":{"day":30.99,"min":27.34,"max":30.99,"night":27.34,"eve":28.49,"morn":30.04},"pressure":992.23,"humidity":0,"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13d"}],"speed":13.33,"deg":268,"clouds":82,"snow":0.17},{"dt":1421830800,"temp":{"day":26.19,"min":24.6,"max":37.47,"night":37.47,"eve":34.7,"morn":24.6},"pressure":991.62,"humidity":0,"weather":[{"id":601,"main":"Snow","description":"snow","icon":"13d"}],"speed":14.84,"deg":196,"clouds":98,"rain":1.59,"snow":4.41},{"dt":1421917200,"temp":{"day":37.47,"min":37.47,"max":37.47,"night":37.47,"eve":37.47,"morn":37.47},"pressure":984.01,"humidity":0,"weather":[{"id":800,"main":"Clear","description":"sky is clear","icon":"01d"}],"speed":19.29,"deg":264,"clouds":99,"rain":1.11,"snow":0.02}]}
|
85
|
+
http_version:
|
86
|
+
recorded_at: Wed, 07 Jan 2015 03:22:55 GMT
|
87
|
+
- request:
|
88
|
+
method: get
|
89
|
+
uri: http://api.openweathermap.org/data/2.5/forecast/daily?APPID=12345&cnt=16&id=524901&units=imperial
|
90
|
+
body:
|
91
|
+
encoding: US-ASCII
|
92
|
+
string: ''
|
93
|
+
headers:
|
94
|
+
Accept-Encoding:
|
95
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
96
|
+
Accept:
|
97
|
+
- "*/*"
|
98
|
+
User-Agent:
|
99
|
+
- Ruby
|
100
|
+
response:
|
101
|
+
status:
|
102
|
+
code: 200
|
103
|
+
message: OK
|
104
|
+
headers:
|
105
|
+
Server:
|
106
|
+
- nginx
|
107
|
+
Date:
|
108
|
+
- Wed, 07 Jan 2015 18:15:06 GMT
|
109
|
+
Content-Type:
|
110
|
+
- application/json; charset=utf-8
|
111
|
+
Transfer-Encoding:
|
112
|
+
- chunked
|
113
|
+
Connection:
|
114
|
+
- keep-alive
|
115
|
+
X-Source:
|
116
|
+
- back
|
117
|
+
Access-Control-Allow-Origin:
|
118
|
+
- "*"
|
119
|
+
Access-Control-Allow-Credentials:
|
120
|
+
- 'true'
|
121
|
+
Access-Control-Allow-Methods:
|
122
|
+
- GET, POST
|
123
|
+
body:
|
124
|
+
encoding: UTF-8
|
125
|
+
string: |
|
126
|
+
{"cod":"200","message":0.0936,"city":{"id":524901,"name":"Moscow","coord":{"lon":37.615555,"lat":55.75222},"country":"RU","population":1000000},"cnt":16,"list":[{"dt":1420621200,"temp":{"day":-1.05,"min":-1.23,"max":-0.42,"night":-1.23,"eve":-1.05,"morn":-1.05},"pressure":1018.31,"humidity":70,"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03n"}],"speed":7.5,"deg":307,"clouds":36},{"dt":1420707600,"temp":{"day":6.17,"min":-1.88,"max":9.73,"night":8.26,"eve":8.58,"morn":-1.88},"pressure":1013.74,"humidity":74,"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13d"}],"speed":12.33,"deg":259,"clouds":76,"snow":1},{"dt":1420794000,"temp":{"day":12.34,"min":8.76,"max":12.34,"night":9.88,"eve":9.81,"morn":10.44},"pressure":991.62,"humidity":84,"weather":[{"id":601,"main":"Snow","description":"snow","icon":"13d"}],"speed":11.99,"deg":211,"clouds":92,"snow":6},{"dt":1420880400,"temp":{"day":30.65,"min":18.46,"max":30.65,"night":27.66,"eve":29.39,"morn":18.46},"pressure":979.38,"humidity":92,"weather":[{"id":601,"main":"Snow","description":"snow","icon":"13d"}],"speed":13.41,"deg":236,"clouds":92,"snow":2.5},{"dt":1420966800,"temp":{"day":36.19,"min":31.55,"max":36.93,"night":35.13,"eve":36.93,"morn":31.55},"pressure":964.53,"humidity":0,"weather":[{"id":601,"main":"Snow","description":"snow","icon":"13d"}],"speed":17.06,"deg":214,"clouds":96,"rain":1.71,"snow":2.26},{"dt":1421053200,"temp":{"day":17.67,"min":8.67,"max":24.76,"night":8.67,"eve":12.07,"morn":24.76},"pressure":977.63,"humidity":0,"weather":[{"id":601,"main":"Snow","description":"snow","icon":"13d"}],"speed":19.25,"deg":298,"clouds":98,"snow":2.18},{"dt":1421139600,"temp":{"day":4.82,"min":-3.05,"max":4.82,"night":-3.05,"eve":-0.36,"morn":1.63},"pressure":993.7,"humidity":0,"weather":[{"id":800,"main":"Clear","description":"sky is clear","icon":"01d"}],"speed":7.37,"deg":304,"clouds":5,"snow":0},{"dt":1421226000,"temp":{"day":8.49,"min":-6.88,"max":15.69,"night":14.99,"eve":15.69,"morn":-6.88},"pressure":987.91,"humidity":0,"weather":[{"id":601,"main":"Snow","description":"snow","icon":"13d"}],"speed":12.87,"deg":147,"clouds":97,"snow":2.33},{"dt":1421312400,"temp":{"day":13.95,"min":-2.2,"max":13.95,"night":-2.2,"eve":9.23,"morn":12.22},"pressure":1004.87,"humidity":0,"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13d"}],"speed":13.95,"deg":20,"clouds":72,"snow":0.66},{"dt":1421398800,"temp":{"day":11.16,"min":1.11,"max":27.61,"night":27.61,"eve":20.03,"morn":1.11},"pressure":1007.81,"humidity":0,"weather":[{"id":601,"main":"Snow","description":"snow","icon":"13d"}],"speed":15.06,"deg":201,"clouds":11,"snow":3.99},{"dt":1421485200,"temp":{"day":33.33,"min":30.4,"max":33.33,"night":32.74,"eve":31.32,"morn":30.4},"pressure":992.7,"humidity":0,"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13d"}],"speed":9.44,"deg":224,"clouds":78,"snow":0.53},{"dt":1421571600,"temp":{"day":31.5,"min":24.33,"max":31.59,"night":24.33,"eve":30.63,"morn":31.59},"pressure":987.39,"humidity":0,"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13d"}],"speed":7.62,"deg":272,"clouds":56,"snow":0.68},{"dt":1421658000,"temp":{"day":28.74,"min":21.76,"max":34.81,"night":30.54,"eve":34.81,"morn":21.76},"pressure":983.11,"humidity":0,"weather":[{"id":601,"main":"Snow","description":"snow","icon":"13d"}],"speed":20.43,"deg":186,"clouds":98,"rain":0.25,"snow":2.05},{"dt":1421744400,"temp":{"day":30.99,"min":27.34,"max":30.99,"night":27.34,"eve":28.49,"morn":30.04},"pressure":992.23,"humidity":0,"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13d"}],"speed":13.33,"deg":268,"clouds":82,"snow":0.17},{"dt":1421830800,"temp":{"day":26.19,"min":24.6,"max":37.47,"night":37.47,"eve":34.7,"morn":24.6},"pressure":991.62,"humidity":0,"weather":[{"id":601,"main":"Snow","description":"snow","icon":"13d"}],"speed":14.84,"deg":196,"clouds":98,"rain":1.59,"snow":4.41},{"dt":1421917200,"temp":{"day":37.47,"min":37.47,"max":37.47,"night":37.47,"eve":37.47,"morn":37.47},"pressure":984.01,"humidity":0,"weather":[{"id":800,"main":"Clear","description":"sky is clear","icon":"01d"}],"speed":19.29,"deg":264,"clouds":99,"rain":1.11,"snow":0.02}]}
|
127
|
+
http_version:
|
128
|
+
recorded_at: Wed, 07 Jan 2015 18:15:06 GMT
|
129
|
+
- request:
|
130
|
+
method: get
|
131
|
+
uri: http://api.openweathermap.org/data/2.5/forecast?APPID=12345&id=524901&units=imperial
|
132
|
+
body:
|
133
|
+
encoding: US-ASCII
|
134
|
+
string: ''
|
135
|
+
headers:
|
136
|
+
Accept-Encoding:
|
137
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
138
|
+
Accept:
|
139
|
+
- "*/*"
|
140
|
+
User-Agent:
|
141
|
+
- Ruby
|
142
|
+
response:
|
143
|
+
status:
|
144
|
+
code: 200
|
145
|
+
message: OK
|
146
|
+
headers:
|
147
|
+
Server:
|
148
|
+
- nginx
|
149
|
+
Date:
|
150
|
+
- Wed, 07 Jan 2015 18:15:19 GMT
|
151
|
+
Content-Type:
|
152
|
+
- application/json; charset=utf-8
|
153
|
+
Transfer-Encoding:
|
154
|
+
- chunked
|
155
|
+
Connection:
|
156
|
+
- keep-alive
|
157
|
+
X-Source:
|
158
|
+
- back
|
159
|
+
Access-Control-Allow-Origin:
|
160
|
+
- "*"
|
161
|
+
Access-Control-Allow-Credentials:
|
162
|
+
- 'true'
|
163
|
+
Access-Control-Allow-Methods:
|
164
|
+
- GET, POST
|
165
|
+
body:
|
166
|
+
encoding: UTF-8
|
167
|
+
string: |
|
168
|
+
{"cod":"200","message":0.2052,"city":{"id":524901,"name":"Moscow","coord":{"lon":37.615555,"lat":55.75222},"country":"RU","population":1000000},"cnt":37,"list":[{"dt":1420653600,"main":{"temp":-1.12,"temp_min":-7.41,"temp_max":-1.12,"pressure":1024.1,"sea_level":1046.84,"grnd_level":1024.1,"humidity":62,"temp_kf":3.5},"weather":[{"id":800,"main":"Clear","description":"sky is clear","icon":"01n"}],"clouds":{"all":0},"wind":{"speed":5.98,"deg":285.003},"sys":{"pod":"n"},"dt_txt":"2015-01-07 18:00:00"},{"dt":1420664400,"main":{"temp":-0.6,"temp_min":-6.58,"temp_max":-0.6,"pressure":1023.6,"sea_level":1046.19,"grnd_level":1023.6,"humidity":74,"temp_kf":3.32},"weather":[{"id":801,"main":"Clouds","description":"few clouds","icon":"02n"}],"clouds":{"all":20},"wind":{"speed":6.39,"deg":285.5},"sys":{"pod":"n"},"dt_txt":"2015-01-07 21:00:00"},{"dt":1420675200,"main":{"temp":1.18,"temp_min":-4.48,"temp_max":1.18,"pressure":1022.37,"sea_level":1045.06,"grnd_level":1022.37,"humidity":80,"temp_kf":3.15},"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03n"}],"clouds":{"all":36},"wind":{"speed":7.13,"deg":274.501},"sys":{"pod":"n"},"dt_txt":"2015-01-08 00:00:00"},{"dt":1420686000,"main":{"temp":3.02,"temp_min":-2.33,"temp_max":3.02,"pressure":1021.11,"sea_level":1043.63,"grnd_level":1021.11,"humidity":72,"temp_kf":2.97},"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03n"}],"clouds":{"all":48},"wind":{"speed":7.93,"deg":267.5},"sys":{"pod":"n"},"dt_txt":"2015-01-08 03:00:00"},{"dt":1420696800,"main":{"temp":5.4,"temp_min":0.36,"temp_max":5.4,"pressure":1019.58,"sea_level":1042.05,"grnd_level":1019.58,"humidity":74,"temp_kf":2.8},"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03d"}],"clouds":{"all":44},"wind":{"speed":8.88,"deg":260.502},"sys":{"pod":"d"},"dt_txt":"2015-01-08 06:00:00"},{"dt":1420707600,"main":{"temp":10.58,"temp_min":5.85,"temp_max":10.58,"pressure":1017.48,"sea_level":1039.77,"grnd_level":1017.48,"humidity":82,"temp_kf":2.62},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"clouds":{"all":88},"wind":{"speed":10.41,"deg":255.006},"sys":{"pod":"d"},"dt_txt":"2015-01-08 09:00:00"},{"dt":1420718400,"main":{"temp":13.23,"temp_min":8.81,"temp_max":13.23,"pressure":1014.9,"sea_level":1036.88,"grnd_level":1014.9,"humidity":79,"temp_kf":2.45},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":76},"wind":{"speed":12.23,"deg":254},"sys":{"pod":"d"},"dt_txt":"2015-01-08 12:00:00"},{"dt":1420729200,"main":{"temp":12.56,"temp_min":8.46,"temp_max":12.56,"pressure":1011.78,"sea_level":1033.83,"grnd_level":1011.78,"humidity":80,"temp_kf":2.27},"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13n"}],"clouds":{"all":88},"wind":{"speed":12.96,"deg":246.503},"snow":{"3h":0.25},"sys":{"pod":"n"},"dt_txt":"2015-01-08 15:00:00"},{"dt":1420740000,"main":{"temp":12.52,"temp_min":8.75,"temp_max":12.52,"pressure":1009.43,"sea_level":1031.29,"grnd_level":1009.43,"humidity":86,"temp_kf":2.1},"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13n"}],"clouds":{"all":76},"wind":{"speed":12.31,"deg":258},"snow":{"3h":0.5},"sys":{"pod":"n"},"dt_txt":"2015-01-08 18:00:00"},{"dt":1420750800,"main":{"temp":13.77,"temp_min":10.31,"temp_max":13.77,"pressure":1007.26,"sea_level":1028.98,"grnd_level":1007.26,"humidity":80,"temp_kf":1.92},"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13n"}],"clouds":{"all":80},"wind":{"speed":9.76,"deg":255.504},"snow":{"3h":0.25},"sys":{"pod":"n"},"dt_txt":"2015-01-08 21:00:00"},{"dt":1420761600,"main":{"temp":14.99,"temp_min":11.84,"temp_max":14.99,"pressure":1005.18,"sea_level":1026.7,"grnd_level":1005.18,"humidity":87,"temp_kf":1.75},"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13n"}],"clouds":{"all":80},"wind":{"speed":9.2,"deg":246.004},"snow":{"3h":0.25},"sys":{"pod":"n"},"dt_txt":"2015-01-09 00:00:00"},{"dt":1420772400,"main":{"temp":16.25,"temp_min":13.41,"temp_max":16.25,"pressure":1002.03,"sea_level":1023.46,"grnd_level":1002.03,"humidity":86,"temp_kf":1.57},"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13n"}],"clouds":{"all":88},"wind":{"speed":9.09,"deg":233.001},"snow":{"3h":0.5},"sys":{"pod":"n"},"dt_txt":"2015-01-09 03:00:00"},{"dt":1420783200,"main":{"temp":17.29,"temp_min":14.78,"temp_max":17.29,"pressure":998.96,"sea_level":1020.34,"grnd_level":998.96,"humidity":86,"temp_kf":1.4},"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13d"}],"clouds":{"all":88},"wind":{"speed":9.22,"deg":222.007},"snow":{"3h":0.25},"sys":{"pod":"d"},"dt_txt":"2015-01-09 06:00:00"},{"dt":1420794000,"main":{"temp":18.95,"temp_min":16.76,"temp_max":18.95,"pressure":995.65,"sea_level":1016.72,"grnd_level":995.65,"humidity":89,"temp_kf":1.22},"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13d"}],"clouds":{"all":88},"wind":{"speed":10.41,"deg":217.005},"snow":{"3h":0.75},"sys":{"pod":"d"},"dt_txt":"2015-01-09 09:00:00"},{"dt":1420804800,"main":{"temp":18.7,"temp_min":16.81,"temp_max":18.7,"pressure":991.59,"sea_level":1012.53,"grnd_level":991.59,"humidity":83,"temp_kf":1.05},"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13d"}],"clouds":{"all":88},"wind":{"speed":11.19,"deg":211},"snow":{"3h":1.25},"sys":{"pod":"d"},"dt_txt":"2015-01-09 12:00:00"},{"dt":1420815600,"main":{"temp":16.79,"temp_min":15.21,"temp_max":16.79,"pressure":988,"sea_level":1009.01,"grnd_level":988,"humidity":84,"temp_kf":0.87},"weather":[{"id":601,"main":"Snow","description":"snow","icon":"13n"}],"clouds":{"all":80},"wind":{"speed":11.3,"deg":210},"snow":{"3h":2},"sys":{"pod":"n"},"dt_txt":"2015-01-09 15:00:00"},{"dt":1420826400,"main":{"temp":17.13,"temp_min":15.87,"temp_max":17.13,"pressure":983.88,"sea_level":1004.79,"grnd_level":983.88,"humidity":86,"temp_kf":0.7},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":88},"wind":{"speed":10.07,"deg":205.502},"snow":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2015-01-09 18:00:00"},{"dt":1420837200,"main":{"temp":20.68,"temp_min":19.74,"temp_max":20.68,"pressure":979.88,"sea_level":1000.55,"grnd_level":979.88,"humidity":90,"temp_kf":0.52},"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13n"}],"clouds":{"all":80},"wind":{"speed":8.01,"deg":203.001},"snow":{"3h":1.25},"sys":{"pod":"n"},"dt_txt":"2015-01-09 21:00:00"},{"dt":1420848000,"main":{"temp":26.76,"temp_min":26.13,"temp_max":26.76,"pressure":977.78,"sea_level":998.35,"grnd_level":977.78,"humidity":91,"temp_kf":0.35},"weather":[{"id":601,"main":"Snow","description":"snow","icon":"13n"}],"clouds":{"all":88},"wind":{"speed":7.69,"deg":262.001},"snow":{"3h":1.75},"sys":{"pod":"n"},"dt_txt":"2015-01-10 00:00:00"},{"dt":1420858800,"main":{"temp":26.67,"temp_min":26.36,"temp_max":26.67,"pressure":979.17,"sea_level":999.76,"grnd_level":979.17,"humidity":90,"temp_kf":0.17},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":88},"wind":{"speed":8.45,"deg":287.511},"snow":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2015-01-10 03:00:00"},{"dt":1420869600,"main":{"temp":27.48,"temp_min":27.48,"temp_max":27.48,"pressure":981.66,"sea_level":1002.23,"grnd_level":981.66,"humidity":93},"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13d"}],"clouds":{"all":88},"wind":{"speed":7.15,"deg":277.502},"snow":{"3h":0.5},"sys":{"pod":"d"},"dt_txt":"2015-01-10 06:00:00"},{"dt":1420880400,"main":{"temp":30.51,"temp_min":30.51,"temp_max":30.51,"pressure":983.88,"sea_level":1004.39,"grnd_level":983.88,"humidity":96},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"clouds":{"all":88},"wind":{"speed":5.96,"deg":265.501},"snow":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2015-01-10 09:00:00"},{"dt":1420891200,"main":{"temp":31.33,"temp_min":31.33,"temp_max":31.33,"pressure":985.39,"sea_level":1006.09,"grnd_level":985.39,"humidity":98},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"clouds":{"all":88},"wind":{"speed":5.08,"deg":242.003},"snow":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2015-01-10 12:00:00"},{"dt":1420902000,"main":{"temp":28.66,"temp_min":28.66,"temp_max":28.66,"pressure":986.82,"sea_level":1007.45,"grnd_level":986.82,"humidity":95},"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13n"}],"clouds":{"all":76},"wind":{"speed":4.58,"deg":215.005},"snow":{"3h":0.5},"sys":{"pod":"n"},"dt_txt":"2015-01-10 15:00:00"},{"dt":1420912800,"main":{"temp":26.03,"temp_min":26.03,"temp_max":26.03,"pressure":987.28,"sea_level":1008.01,"grnd_level":987.28,"humidity":92},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":92},"wind":{"speed":4.56,"deg":188.502},"snow":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2015-01-10 18:00:00"},{"dt":1420923600,"main":{"temp":24.7,"temp_min":24.7,"temp_max":24.7,"pressure":986.44,"sea_level":1007.16,"grnd_level":986.44,"humidity":98},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":88},"wind":{"speed":4.56,"deg":145.005},"snow":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2015-01-10 21:00:00"},{"dt":1420934400,"main":{"temp":25.19,"temp_min":25.19,"temp_max":25.19,"pressure":984.31,"sea_level":1005.16,"grnd_level":984.31,"humidity":95},"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13n"}],"clouds":{"all":88},"wind":{"speed":5.55,"deg":137.508},"snow":{"3h":0.5},"sys":{"pod":"n"},"dt_txt":"2015-01-11 00:00:00"},{"dt":1420945200,"main":{"temp":25.62,"temp_min":25.62,"temp_max":25.62,"pressure":982.11,"sea_level":1002.67,"grnd_level":982.11,"humidity":94},"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13n"}],"clouds":{"all":88},"wind":{"speed":6.61,"deg":140.501},"snow":{"3h":0.5},"sys":{"pod":"n"},"dt_txt":"2015-01-11 03:00:00"},{"dt":1420956000,"main":{"temp":25.12,"temp_min":25.12,"temp_max":25.12,"pressure":980,"sea_level":1000.51,"grnd_level":980,"humidity":95},"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13d"}],"clouds":{"all":80},"wind":{"speed":7.58,"deg":126.008},"snow":{"3h":0.5},"sys":{"pod":"d"},"dt_txt":"2015-01-11 06:00:00"},{"dt":1420966800,"main":{"temp":26.26,"temp_min":26.26,"temp_max":26.26,"pressure":977.92,"sea_level":998.48,"grnd_level":977.92,"humidity":94},"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13d"}],"clouds":{"all":92},"wind":{"speed":8.55,"deg":117.511},"snow":{"3h":0.5},"sys":{"pod":"d"},"dt_txt":"2015-01-11 09:00:00"},{"dt":1420977600,"main":{"temp":28.33,"temp_min":28.33,"temp_max":28.33,"pressure":977.02,"sea_level":997.45,"grnd_level":977.02,"humidity":95},"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13d"}],"clouds":{"all":88},"wind":{"speed":7.8,"deg":109.503},"snow":{"3h":1},"sys":{"pod":"d"},"dt_txt":"2015-01-11 12:00:00"},{"dt":1420988400,"main":{"temp":29.3,"temp_min":29.3,"temp_max":29.3,"pressure":977.51,"sea_level":997.87,"grnd_level":977.51,"humidity":91},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":88},"wind":{"speed":7.04,"deg":97.0015},"snow":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2015-01-11 15:00:00"},{"dt":1420999200,"main":{"temp":29.85,"temp_min":29.85,"temp_max":29.85,"pressure":978.62,"sea_level":999.02,"grnd_level":978.62,"humidity":95},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":92},"wind":{"speed":5.96,"deg":87.001},"snow":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2015-01-11 18:00:00"},{"dt":1421010000,"main":{"temp":29.6,"temp_min":29.6,"temp_max":29.6,"pressure":980.46,"sea_level":1000.98,"grnd_level":980.46,"humidity":96},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":92},"wind":{"speed":5.53,"deg":61.0078},"snow":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2015-01-11 21:00:00"},{"dt":1421020800,"main":{"temp":28.86,"temp_min":28.86,"temp_max":28.86,"pressure":982.75,"sea_level":1003.42,"grnd_level":982.75,"humidity":96},"weather":[{"id":601,"main":"Snow","description":"snow","icon":"13n"}],"clouds":{"all":88},"wind":{"speed":6.42,"deg":26.5027},"snow":{"3h":2},"sys":{"pod":"n"},"dt_txt":"2015-01-12 00:00:00"},{"dt":1421031600,"main":{"temp":26.29,"temp_min":26.29,"temp_max":26.29,"pressure":985.22,"sea_level":1005.9,"grnd_level":985.22,"humidity":94},"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13n"}],"clouds":{"all":92},"wind":{"speed":9.55,"deg":4.50333},"snow":{"3h":0.5},"sys":{"pod":"n"},"dt_txt":"2015-01-12 03:00:00"},{"dt":1421042400,"main":{"temp":21.59,"temp_min":21.59,"temp_max":21.59,"pressure":988.21,"sea_level":1009.24,"grnd_level":988.21,"humidity":92},"weather":[{"id":600,"main":"Snow","description":"light snow","icon":"13d"}],"clouds":{"all":88},"wind":{"speed":10.61,"deg":357.001},"snow":{"3h":0.5},"sys":{"pod":"d"},"dt_txt":"2015-01-12 06:00:00"}]}
|
169
|
+
http_version:
|
170
|
+
recorded_at: Wed, 07 Jan 2015 18:15:19 GMT
|
171
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
describe "OpenWeatherApi#configure" do
|
4
|
+
|
5
|
+
before do
|
6
|
+
OpenWeatherApi.configure do |config|
|
7
|
+
config.app_id = 12345
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'must set the app id for a new location' do
|
12
|
+
loc = OpenWeatherApi.city_id(524901)
|
13
|
+
loc.app_id.must_equal 12345
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
describe OpenWeatherApi::Current do
|
4
|
+
|
5
|
+
let(:current) { OpenWeatherApi.city_id(524901).current }
|
6
|
+
|
7
|
+
before do
|
8
|
+
VCR.insert_cassette 'current', :record => :new_episodes
|
9
|
+
end
|
10
|
+
|
11
|
+
after do
|
12
|
+
VCR.eject_cassette
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'must act like a hash' do
|
16
|
+
current.keys.must_be_instance_of Array
|
17
|
+
current.keys.include?('name').must_equal true
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'must have methods for each hash key' do
|
21
|
+
current.name.must_equal 'Moscow'
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
describe OpenWeatherApi::Forecast do
|
4
|
+
|
5
|
+
let(:forecast) { OpenWeatherApi.city_id(524901).forecast(daily: true) }
|
6
|
+
|
7
|
+
before do
|
8
|
+
VCR.insert_cassette 'forecast', :record => :new_episodes
|
9
|
+
end
|
10
|
+
|
11
|
+
after do
|
12
|
+
VCR.eject_cassette
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'must act like a hash' do
|
16
|
+
forecast.keys.must_be_instance_of Array
|
17
|
+
forecast.keys.include?('city').must_equal true
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'must have methods for each hash key' do
|
21
|
+
forecast.city['name'].must_equal 'Moscow'
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
describe OpenWeatherApi::Location do
|
4
|
+
|
5
|
+
describe "default attributes" do
|
6
|
+
|
7
|
+
it "must include httparty methods" do
|
8
|
+
OpenWeatherApi::Location.must_include HTTParty
|
9
|
+
end
|
10
|
+
|
11
|
+
it "must have the base url set to the Open Weather Map api endpoint" do
|
12
|
+
OpenWeatherApi::Location.base_uri.must_equal 'http://api.openweathermap.org/data/2.5'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe 'forecast' do
|
17
|
+
let(:loc) { OpenWeatherApi.city_id(524901) }
|
18
|
+
|
19
|
+
before do
|
20
|
+
VCR.insert_cassette 'forecast', :record => :new_episodes
|
21
|
+
end
|
22
|
+
|
23
|
+
after do
|
24
|
+
VCR.eject_cassette
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'must have a forecast method' do
|
28
|
+
loc.must_respond_to :forecast
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'must parse the api response to OpenWeatherApi::Forecast' do
|
32
|
+
loc.forecast.must_be_instance_of OpenWeatherApi::Forecast
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'must perform the request and get the data' do
|
36
|
+
loc.forecast['city']['name'].must_equal 'Moscow'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
describe OpenWeatherApi do
|
4
|
+
|
5
|
+
describe 'location initializing methods' do
|
6
|
+
|
7
|
+
describe "#city" do
|
8
|
+
|
9
|
+
it "sets the name of the city" do
|
10
|
+
OpenWeatherApi.city("London").city.must_equal "London"
|
11
|
+
end
|
12
|
+
|
13
|
+
it "returns an instance of OpenWeatherApi::Location class" do
|
14
|
+
OpenWeatherApi.city("London").must_be_instance_of OpenWeatherApi::Location
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "#city_id" do
|
19
|
+
|
20
|
+
it "sets the city id" do
|
21
|
+
OpenWeatherApi.city_id(12345).city_id.must_equal 12345
|
22
|
+
end
|
23
|
+
|
24
|
+
it "returns an instance of OpenWeatherApi::Location class" do
|
25
|
+
OpenWeatherApi.city_id(12345).must_be_instance_of OpenWeatherApi::Location
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "#geolocate" do
|
30
|
+
|
31
|
+
it "sets the lat" do
|
32
|
+
OpenWeatherApi.geolocate(lat: 12.345, lng: 54.321).lat.must_equal 12.345
|
33
|
+
end
|
34
|
+
|
35
|
+
it "sets the lng" do
|
36
|
+
OpenWeatherApi.geolocate(lat: 12.345, lng: 54.321).lng.must_equal 54.321
|
37
|
+
end
|
38
|
+
|
39
|
+
it "returns an instance of OpenWeatherApi::Location class" do
|
40
|
+
OpenWeatherApi.geolocate(lat: 12.345, lng: 54.321).must_be_instance_of OpenWeatherApi::Location
|
41
|
+
end
|
42
|
+
|
43
|
+
it "accepts an object that responds to lat and lng" do
|
44
|
+
class LatLng
|
45
|
+
def lat
|
46
|
+
12.345
|
47
|
+
end
|
48
|
+
def lng
|
49
|
+
54.321
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
location = OpenWeatherApi.geolocate(LatLng.new)
|
54
|
+
location.lat.must_equal 12.345
|
55
|
+
location.lng.must_equal 54.321
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: open_weather_api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Peter Debelak
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-01-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: webmock
|
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: vcr
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: httparty
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: Gem to wrap http://openweathermap.org/api
|
84
|
+
email:
|
85
|
+
- pdebelak@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- Gemfile
|
91
|
+
- Gemfile.lock
|
92
|
+
- LICENSE.txt
|
93
|
+
- README.md
|
94
|
+
- Rakefile
|
95
|
+
- lib/open_weather_api.rb
|
96
|
+
- lib/open_weather_api/city_methods.rb
|
97
|
+
- lib/open_weather_api/configure.rb
|
98
|
+
- lib/open_weather_api/current.rb
|
99
|
+
- lib/open_weather_api/forecast.rb
|
100
|
+
- lib/open_weather_api/location.rb
|
101
|
+
- lib/open_weather_api/version.rb
|
102
|
+
- open_weather_api.gemspec
|
103
|
+
- spec/fixtures/openweathermap_cassettes/current.yml
|
104
|
+
- spec/fixtures/openweathermap_cassettes/forecast.yml
|
105
|
+
- spec/lib/configure_spec.rb
|
106
|
+
- spec/lib/current_spec.rb
|
107
|
+
- spec/lib/forecast_spec.rb
|
108
|
+
- spec/lib/location_spec.rb
|
109
|
+
- spec/lib/open_weather_api_spec.rb
|
110
|
+
- spec/spec_helper.rb
|
111
|
+
homepage: ''
|
112
|
+
licenses:
|
113
|
+
- MIT
|
114
|
+
metadata: {}
|
115
|
+
post_install_message:
|
116
|
+
rdoc_options: []
|
117
|
+
require_paths:
|
118
|
+
- lib
|
119
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
|
+
requirements:
|
126
|
+
- - ">="
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
129
|
+
requirements: []
|
130
|
+
rubyforge_project:
|
131
|
+
rubygems_version: 2.4.4
|
132
|
+
signing_key:
|
133
|
+
specification_version: 4
|
134
|
+
summary: Gem to wrap http://openweathermap.org/api
|
135
|
+
test_files:
|
136
|
+
- spec/fixtures/openweathermap_cassettes/current.yml
|
137
|
+
- spec/fixtures/openweathermap_cassettes/forecast.yml
|
138
|
+
- spec/lib/configure_spec.rb
|
139
|
+
- spec/lib/current_spec.rb
|
140
|
+
- spec/lib/forecast_spec.rb
|
141
|
+
- spec/lib/location_spec.rb
|
142
|
+
- spec/lib/open_weather_api_spec.rb
|
143
|
+
- spec/spec_helper.rb
|