├── .rspec ├── lib ├── open_weather │ ├── version.rb │ ├── current.rb │ ├── forecast.rb │ ├── history.rb │ ├── forecast_daily.rb │ ├── exceptions.rb │ ├── find.rb │ ├── base.rb │ └── api.rb └── open_weather.rb ├── .gitignore ├── Gemfile ├── spec ├── open_weather │ ├── version_spec.rb │ └── api_spec.rb ├── spec_helper.rb ├── fixtures │ └── cassettes │ │ ├── api │ │ ├── current_cities_invalid.yml │ │ ├── forecast_daily_city_id_invalid.yml │ │ ├── forecast_daily_geocode_invalid.yml │ │ ├── forecast_daily_invalid.yml │ │ ├── history_city_id_invalid.yml │ │ ├── forecast_city_id_invalid.yml │ │ ├── forecast_geocode_invalid.yml │ │ ├── forecast_invalid.yml │ │ ├── history_city_invalid.yml │ │ ├── history_geocode_invalid.yml │ │ ├── current_city_id_invalid.yml │ │ ├── current_city_invalid.yml │ │ ├── current_geocode_invalid.yml │ │ ├── current_rectangle_zone_invalid.yml │ │ ├── current_circle_zone_invalid.yml │ │ ├── current_city_id_valid.yml │ │ ├── current_city_valid.yml │ │ ├── current_city_imperial_valid.yml │ │ ├── current_city_metric_valid.yml │ │ ├── current_geocode_valid.yml │ │ ├── history_city_id_valid.yml │ │ ├── history_city_valid.yml │ │ ├── history_geocode_valid.yml │ │ ├── current_cities_valid.yml │ │ ├── forecast_daily_cnt_6.yml │ │ ├── forecast_daily_city_metric_valid.yml │ │ ├── forecast_daily_city_valid.yml │ │ ├── forecast_daily_cnt_default.yml │ │ ├── forecast_daily_city_imperial_valid.yml │ │ ├── forecast_daily_city_id_valid.yml │ │ ├── forecast_daily_geocode_valid.yml │ │ ├── current_rectangle_zone_valid.yml │ │ ├── current_circle_zone_valid.yml │ │ ├── forecast_city_imperial_valid.yml │ │ ├── forecast_city_metric_invalid.yml │ │ ├── forecast_city_metric_valid.yml │ │ ├── forecast_city_valid.yml │ │ ├── forecast_geocode_valid.yml │ │ └── forecast_city_id_valid.yml │ │ └── integration │ │ ├── current_not_found_city.yml │ │ ├── current_by_city_id.yml │ │ ├── current_by_geocode.yml │ │ ├── current_by_city.yml │ │ ├── current_by_cities.yml │ │ ├── current_by_circle_zone.yml │ │ └── current_by_rectangle_zone.yml └── integration │ └── current_spec.rb ├── .travis.yml ├── CONTRIBUTORS.md ├── open_weather.gemspec ├── LICENSE └── README.md /.rspec: -------------------------------------------------------------------------------- 1 | --color 2 | --require spec_helper 3 | --format documentation -------------------------------------------------------------------------------- /lib/open_weather/version.rb: -------------------------------------------------------------------------------- 1 | module OpenWeather 2 | VERSION = '0.12.0' 3 | end 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .bundle 2 | *.gem 3 | *.db 4 | *~ 5 | *# 6 | *.DS_Store 7 | log/* 8 | tmp/* 9 | Gemfile.lock 10 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'http://rubygems.org' 2 | 3 | # gem's dependencies should be in open_weather.gemspec 4 | gemspec 5 | -------------------------------------------------------------------------------- /spec/open_weather/version_spec.rb: -------------------------------------------------------------------------------- 1 | describe 'Version' do 2 | it 'should be version 0.12.0' do 3 | OpenWeather::VERSION.should == '0.12.0' 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /lib/open_weather/current.rb: -------------------------------------------------------------------------------- 1 | module OpenWeather 2 | class Current < Base 3 | def initialize(options = {}) 4 | super('http://api.openweathermap.org/data/2.5/weather', options) 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /lib/open_weather/forecast.rb: -------------------------------------------------------------------------------- 1 | module OpenWeather 2 | class Forecast < Base 3 | def initialize options = {} 4 | super('http://api.openweathermap.org/data/2.5/forecast', options) 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /lib/open_weather/history.rb: -------------------------------------------------------------------------------- 1 | module OpenWeather 2 | class History < Base 3 | def initialize options = {} 4 | super('http://history.openweathermap.org/data/2.5/history/city', options) 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: ruby 2 | rvm: 3 | - 2.1.5 4 | before_install: 5 | - gem update --system 6 | install: 7 | - "gem install bundler" 8 | - "bundle install --jobs=3 --retry=3" 9 | script: 10 | - bundle exec rspec 11 | -------------------------------------------------------------------------------- /lib/open_weather/forecast_daily.rb: -------------------------------------------------------------------------------- 1 | module OpenWeather 2 | class ForecastDaily < Base 3 | def initialize options = {} 4 | super('http://api.openweathermap.org/data/2.5/forecast/daily', options) 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | 3 | require 'bundler/setup' 4 | Bundler.setup 5 | 6 | require 'open_weather' 7 | require 'vcr' 8 | 9 | VCR.configure do |c| 10 | c.cassette_library_dir = 'spec/fixtures/cassettes' 11 | c.hook_into :webmock 12 | end 13 | -------------------------------------------------------------------------------- /lib/open_weather/exceptions.rb: -------------------------------------------------------------------------------- 1 | module OpenWeather 2 | 3 | # OpenWeather imposes a limit on the amount of city IDs requested at once, 4 | # see http://openweathermap.org/current 5 | class LocationsLimitExceeded < StandardError 6 | def initialize(msg="Too many city IDs requested at once") 7 | super 8 | end 9 | end 10 | 11 | end 12 | -------------------------------------------------------------------------------- /lib/open_weather/find.rb: -------------------------------------------------------------------------------- 1 | module OpenWeather 2 | class Find < Base 3 | def initialize(options = {}) 4 | super('http://api.openweathermap.org/data/2.5/find', options) 5 | end 6 | 7 | def self.like(q, options = {}) 8 | new(options.merge!(q: q, type: 'like')).retrieve 9 | end 10 | 11 | def self.accurate(q, options = {}) 12 | new(options.merge!(q: q, type: 'accurate')).retrieve 13 | end 14 | end 15 | end -------------------------------------------------------------------------------- /CONTRIBUTORS.md: -------------------------------------------------------------------------------- 1 | ### CONTRIBUTORS 2 | 3 | [Harisankar P S](https://github.com/coderhs) 4 | 5 | [Deepak Kumar](https://github.com/42races) 6 | 7 | [Daniel Nitsikopoulos](https://github.com/dNitza) 8 | 9 | [Yone Lacort Collado](https://github.com/yonelacort) 10 | 11 | [iamdeuterium](https://github.com/iamdeuterium) 12 | 13 | [ssendev](https://github.com/ssendev) 14 | 15 | [Nithin Bekal](https://github.com/nithinbekal) 16 | 17 | [Jesse Emond](https://github.com/JesseEmond) 18 | -------------------------------------------------------------------------------- /lib/open_weather.rb: -------------------------------------------------------------------------------- 1 | module OpenWeather 2 | $LOAD_PATH<< '../lib' 3 | 4 | autoload :Base, 'open_weather/base' 5 | autoload :Current, 'open_weather/current' 6 | autoload :Forecast, 'open_weather/forecast' 7 | autoload :ForecastDaily, 'open_weather/forecast_daily' 8 | autoload :Find, 'open_weather/find' 9 | autoload :History, 'open_weather/history' 10 | autoload :VERSION, 'open_weather/version' 11 | 12 | require 'open_weather/api.rb' 13 | require 'open_weather/exceptions.rb' 14 | end 15 | -------------------------------------------------------------------------------- /open_weather.gemspec: -------------------------------------------------------------------------------- 1 | $:.push File.expand_path('../lib', __FILE__) 2 | require 'open_weather/version' 3 | 4 | Gem::Specification.new do |gem| 5 | gem.name = 'open-weather' 6 | gem.version = OpenWeather::VERSION 7 | gem.authors = ["HsPS mailme@hsps.in", "Deepak deepakkumarnd@gmail.com"] 8 | gem.licenses = ['MIT'] 9 | gem.email = ['mailme@hsps.in'] 10 | gem.homepage = 'https://github.com/coderhs/ruby_open_weather_map' 11 | gem.summary = %q{ A ruby wrapper for Open Weather Map API. } 12 | gem.description = %q{ A ruby wrapper for Open Weather Map API. } 13 | gem.files = `git ls-files`.split("\n") 14 | gem.test_files = gem.files.grep(/^(spec|test|features)/) 15 | gem.executables = gem.files.grep(/^bin/).map{ |f| File.basename(f) } 16 | gem.require_paths = ["lib"] 17 | gem.add_development_dependency 'rspec', '~> 2.13', '>= 2.13.0' 18 | gem.add_development_dependency 'vcr', '~> 2.9', '>= 2.9.2' 19 | gem.add_development_dependency 'webmock', '~> 1.18', '>= 1.18.0' 20 | gem.add_runtime_dependency 'json', '~> 1' 21 | end 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 HsPS , Deepak Kumar 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. -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/current_cities_invalid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/group?id=42,1000 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Thu, 03 Sep 2015 18:55:49 GMT 27 | Content-Type: 28 | - application/json; charset=utf8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - redis 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"cnt":0,"list":[]} 45 | http_version: 46 | recorded_at: Thu, 03 Sep 2015 18:55:48 GMT 47 | recorded_with: VCR 2.9.3 48 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/forecast_daily_city_id_invalid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/forecast/daily?q=,invalidid 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Wed, 24 Dec 2014 21:15:13 GMT 27 | Content-Type: 28 | - text/html 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - redis 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"message":"","cod":"404"} 45 | http_version: 46 | recorded_at: Wed, 24 Dec 2014 21:15:13 GMT 47 | recorded_with: VCR 2.9.2 48 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/forecast_daily_geocode_invalid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/forecast/daily?lat=181&lon=181 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Wed, 24 Dec 2014 21:15:14 GMT 27 | Content-Type: 28 | - text/html 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - redis 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"message":"","cod":"404"} 45 | http_version: 46 | recorded_at: Wed, 24 Dec 2014 21:15:15 GMT 47 | recorded_with: VCR 2.9.2 48 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/forecast_daily_invalid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/forecast/daily?q=,Cochiiiiiin,%20In 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Wed, 24 Dec 2014 21:15:12 GMT 27 | Content-Type: 28 | - text/html 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - back 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"message":"","cod":"404"} 45 | http_version: 46 | recorded_at: Wed, 24 Dec 2014 21:15:13 GMT 47 | recorded_with: VCR 2.9.2 48 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/history_city_id_invalid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://history.openweathermap.org/data/2.5/history/city?q=,invalidid 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Thu, 28 Aug 2014 10:50:49 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - back 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"error":"404"} 45 | http_version: 46 | recorded_at: Thu, 28 Aug 2014 10:50:48 GMT 47 | recorded_with: VCR 2.9.2 48 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/forecast_city_id_invalid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/forecast?q=,invalidid 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Thu, 28 Aug 2014 10:50:50 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - back 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"message":"","cod":"404"} 45 | http_version: 46 | recorded_at: Thu, 28 Aug 2014 10:50:50 GMT 47 | recorded_with: VCR 2.9.2 48 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/forecast_geocode_invalid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/forecast?lat=181&lon=181 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Thu, 28 Aug 2014 10:50:51 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - back 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"message":"","cod":"404"} 45 | http_version: 46 | recorded_at: Thu, 28 Aug 2014 10:50:50 GMT 47 | recorded_with: VCR 2.9.2 48 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/forecast_invalid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/forecast?q=,Cochiiiiiin,%20In 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Thu, 28 Aug 2014 10:50:50 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - back 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"message":"","cod":"404"} 45 | http_version: 46 | recorded_at: Thu, 28 Aug 2014 10:50:49 GMT 47 | recorded_with: VCR 2.9.2 48 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/history_city_invalid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://history.openweathermap.org/data/2.5/history/city?q=,Cochiiiiiin,%20In 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Thu, 28 Aug 2014 10:50:49 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - back 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"error": "404"} 45 | http_version: 46 | recorded_at: Thu, 28 Aug 2014 10:50:49 GMT 47 | recorded_with: VCR 2.9.2 48 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/history_geocode_invalid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://history.openweathermap.org/data/2.5/history/city?lat=181&lon=181 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Thu, 28 Aug 2014 10:50:49 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - back 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"error": "404"} 45 | http_version: 46 | recorded_at: Thu, 28 Aug 2014 10:50:48 GMT 47 | recorded_with: VCR 2.9.2 48 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/current_city_id_invalid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/weather?q=,invalidid 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Thu, 28 Aug 2014 10:50:49 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - back 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"message":"Error: Not found city","cod":"404"} 45 | http_version: 46 | recorded_at: Thu, 28 Aug 2014 10:50:48 GMT 47 | recorded_with: VCR 2.9.2 48 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/current_city_invalid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/weather?q=,Cochiiiiiin,%20In 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Thu, 28 Aug 2014 10:50:49 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - back 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"message":"Error: Not found city","cod":"404"} 45 | http_version: 46 | recorded_at: Thu, 28 Aug 2014 10:50:48 GMT 47 | recorded_with: VCR 2.9.2 48 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/current_geocode_invalid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/weather?lat=181&lon=181 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Thu, 28 Aug 2014 10:50:49 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - back 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"message":"Error: Not found city","cod":"404"} 45 | http_version: 46 | recorded_at: Thu, 28 Aug 2014 10:50:48 GMT 47 | recorded_with: VCR 2.9.2 48 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/current_rectangle_zone_invalid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/box/city?bbox=-5,-5,-5,-5,-5 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Fri, 04 Sep 2015 14:51:02 GMT 27 | Content-Type: 28 | - application/json; charset=utf8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - back 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"message":"","cod":"200","cnt":0,"list":[]} 45 | http_version: 46 | recorded_at: Fri, 04 Sep 2015 14:51:01 GMT 47 | recorded_with: VCR 2.9.3 48 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/current_circle_zone_invalid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/find?cnt=-10&lat=55.5&lon=37.5 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Fri, 04 Sep 2015 15:03:12 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - redis 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"message":"exception: limit must be >=0","cod":"500"} 45 | http_version: 46 | recorded_at: Fri, 04 Sep 2015 15:03:11 GMT 47 | recorded_with: VCR 2.9.3 48 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/integration/current_not_found_city.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/weather?APPID=1111111111&q=,Berlin,%20DE&units=metric 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Thu, 28 Aug 2014 10:35:16 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - back 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"message":"Error: Not found city","cod":"404"} 45 | http_version: 46 | recorded_at: Thu, 28 Aug 2014 10:35:16 GMT 47 | recorded_with: VCR 2.9.2 48 | -------------------------------------------------------------------------------- /lib/open_weather/base.rb: -------------------------------------------------------------------------------- 1 | require 'net/http' 2 | require 'json' 3 | 4 | module OpenWeather 5 | class Base 6 | 7 | attr_reader :url, :options, :weather_info, :status, :message 8 | 9 | def initialize(url, options) 10 | @status = false 11 | @url = url 12 | @options = extract_options!(options) 13 | end 14 | 15 | def retrieve(url=nil) 16 | response = send_request url unless @options.empty? 17 | parse_response(response) 18 | end 19 | 20 | def success? 21 | @status == 200 22 | end 23 | 24 | private 25 | 26 | def extract_options!(options) 27 | valid_options = [ :id, :lat, :lon, :cnt, :city, :lang, :units, :APPID, 28 | :country, :bbox, :q, :type, :start, :end] 29 | 30 | options.keys.each { |k| options.delete(k) unless valid_options.include?(k) } 31 | 32 | if options[:city] || options[:country] 33 | options[:q] = "#{options[:country]},#{options[:city]}" 34 | options.delete(:city) 35 | options.delete(:country) 36 | end 37 | 38 | options 39 | end 40 | 41 | def parse_response(response) 42 | return if response.nil? 43 | @weather_info = JSON.parse(response) 44 | @status = @weather_info['cod'] 45 | @message = @weather_info['message'] unless @status 46 | @weather_info 47 | end 48 | 49 | def send_request(url=nil) 50 | url = url || @url 51 | uri = URI(url) 52 | uri.query = URI.encode_www_form(options) 53 | Net::HTTP.get(uri) 54 | end 55 | end 56 | end 57 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/integration/current_by_city_id.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/weather?APPID=1111111111&id=524901&units=metric 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Thu, 28 Aug 2014 10:35:16 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - redis 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"coord":{"lon":37.62,"lat":55.75},"sys":{"type":1,"id":7323,"message":0.2126,"country":"RU","sunrise":1409192848,"sunset":1409243632},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"base":"cmc stations","main":{"temp":17.99,"pressure":1004,"humidity":63,"temp_min":16,"temp_max":23.7},"wind":{"speed":6,"deg":200},"clouds":{"all":75},"dt":1409220095,"id":524901,"name":"Moscow","cod":200} 45 | http_version: 46 | recorded_at: Thu, 28 Aug 2014 10:35:16 GMT 47 | recorded_with: VCR 2.9.2 48 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/current_city_id_valid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/weather?id=1273874 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Thu, 28 Aug 2014 10:50:49 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - redis 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"coord":{"lon":76.26,"lat":9.94},"sys":{"message":0.8839,"country":"IN","sunrise":1409186753,"sunset":1409231181},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"base":"cmc stations","main":{"temp":299.941,"temp_min":299.941,"temp_max":299.941,"pressure":1021.68,"sea_level":1023.32,"grnd_level":1021.68,"humidity":100},"wind":{"speed":4.91,"deg":311.006},"clouds":{"all":64},"dt":1409221397,"id":1273874,"name":"Cochin","cod":200} 45 | http_version: 46 | recorded_at: Thu, 28 Aug 2014 10:50:48 GMT 47 | recorded_with: VCR 2.9.2 48 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/current_city_valid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/weather?q=,Cochin,%20In 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Thu, 28 Aug 2014 10:50:48 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - back 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"coord":{"lon":76.26,"lat":9.94},"sys":{"message":0.0191,"country":"India","sunrise":1409186752,"sunset":1409231181},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"base":"cmc stations","main":{"temp":299.793,"temp_min":299.793,"temp_max":299.793,"pressure":1020.95,"sea_level":1021.19,"grnd_level":1020.95,"humidity":99},"wind":{"speed":5.46,"deg":313.001},"clouds":{"all":88},"dt":1409222627,"id":1273874,"name":"Kochi","cod":200} 45 | http_version: 46 | recorded_at: Thu, 28 Aug 2014 10:50:48 GMT 47 | recorded_with: VCR 2.9.2 48 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/integration/current_by_geocode.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/weather?APPID=1111111111&lat=48.140938&lon=11.582005&units=metric 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Thu, 28 Aug 2014 10:35:16 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - redis 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"coord":{"lon":11.58,"lat":48.14},"sys":{"type":1,"id":4887,"message":0.0204,"country":"DE","sunrise":1409199997,"sunset":1409248977},"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03d"}],"base":"cmc stations","main":{"temp":19.46,"pressure":1020,"humidity":72,"temp_min":16.11,"temp_max":23.33},"wind":{"speed":1,"deg":0},"clouds":{"all":40},"dt":1409221509,"id":2867714,"name":"Muenchen","cod":200} 45 | http_version: 46 | recorded_at: Thu, 28 Aug 2014 10:35:16 GMT 47 | recorded_with: VCR 2.9.2 48 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/current_city_imperial_valid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/weather?q=,Cochin,%20In&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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Thu, 28 Aug 2014 10:52:09 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - back 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"coord":{"lon":76.26,"lat":9.94},"sys":{"message":0.0316,"country":"India","sunrise":1409186752,"sunset":1409231181},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"base":"cmc stations","main":{"temp":79.96,"temp_min":79.96,"temp_max":79.96,"pressure":1020.95,"sea_level":1021.19,"grnd_level":1020.95,"humidity":99},"wind":{"speed":11.79,"deg":313.001},"clouds":{"all":88},"dt":1409222765,"id":1273874,"name":"Kochi","cod":200} 45 | http_version: 46 | recorded_at: Thu, 28 Aug 2014 10:52:09 GMT 47 | recorded_with: VCR 2.9.2 48 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/current_city_metric_valid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/weather?q=,Cochin,%20In&units=metric 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Thu, 28 Aug 2014 10:50:49 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - back 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"coord":{"lon":76.26,"lat":9.94},"sys":{"message":0.0191,"country":"India","sunrise":1409186752,"sunset":1409231181},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"base":"cmc stations","main":{"temp":26.643,"temp_min":26.643,"temp_max":26.643,"pressure":1020.95,"sea_level":1021.19,"grnd_level":1020.95,"humidity":99},"wind":{"speed":5.46,"deg":313.001},"clouds":{"all":88},"dt":1409222627,"id":1273874,"name":"Kochi","cod":200} 45 | http_version: 46 | recorded_at: Thu, 28 Aug 2014 10:50:49 GMT 47 | recorded_with: VCR 2.9.2 48 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/integration/current_by_city.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/weather?APPID=1111111111&q=,Berlin,%20DE&units=metric 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Thu, 28 Aug 2014 10:32:37 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - back 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"coord":{"lon":13.38,"lat":52.52},"sys":{"type":1,"id":4892,"message":0.0219,"country":"Germany","sunrise":1409199092,"sunset":1409249019},"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03d"}],"base":"cmc stations","main":{"temp":296.02,"pressure":1018,"humidity":35,"temp_min":294.15,"temp_max":299.26},"wind":{"speed":2.6,"deg":280,"var_beg":260,"var_end":320},"clouds":{"all":40},"dt":1409221912,"id":2822234,"name":"Berlin","cod":200} 45 | http_version: 46 | recorded_at: Thu, 28 Aug 2014 10:32:37 GMT 47 | recorded_with: VCR 2.9.2 48 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/current_geocode_valid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/weather?lat=9.94&lon=76.26 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Thu, 28 Aug 2014 10:50:49 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - back 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: ASCII-8BIT 43 | string: !binary |- 44 | eyJjb29yZCI6eyJsb24iOjc2LjI2LCJsYXQiOjkuOTR9LCJzeXMiOnsibWVz 45 | c2FnZSI6MC4wMTkxLCJjb3VudHJ5IjoiSU4iLCJzdW5yaXNlIjoxNDA5MTg2 46 | NzUzLCJzdW5zZXQiOjE0MDkyMzExODF9LCJ3ZWF0aGVyIjpbeyJpZCI6ODA0 47 | LCJtYWluIjoiQ2xvdWRzIiwiZGVzY3JpcHRpb24iOiJvdmVyY2FzdCBjbG91 48 | ZHMiLCJpY29uIjoiMDRkIn1dLCJiYXNlIjoiY21jIHN0YXRpb25zIiwibWFp 49 | biI6eyJ0ZW1wIjoyOTkuNzkzLCJ0ZW1wX21pbiI6Mjk5Ljc5MywidGVtcF9t 50 | YXgiOjI5OS43OTMsInByZXNzdXJlIjoxMDIwLjk1LCJzZWFfbGV2ZWwiOjEw 51 | MjEuMTksImdybmRfbGV2ZWwiOjEwMjAuOTUsImh1bWlkaXR5Ijo5OX0sIndp 52 | bmQiOnsic3BlZWQiOjUuNDYsImRlZyI6MzEzLjAwMX0sImNsb3VkcyI6eyJh 53 | bGwiOjg4fSwiZHQiOjE0MDkyMjI2MjcsImlkIjoxMjcyMDE4LCJuYW1lIjoi 54 | RXJuxIFrdWxhbSIsImNvZCI6MjAwfQo= 55 | http_version: 56 | recorded_at: Thu, 28 Aug 2014 10:50:48 GMT 57 | recorded_with: VCR 2.9.2 58 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/history_city_id_valid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://history.openweathermap.org/data/2.5/history/city?id=1273874 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Thu, 28 Aug 2014 10:50:49 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - redis 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"message":"","cod":"200","city_id":2885679,"calctime":0.0823,"cnt":3,"list":[{"main":{"temp":266.052,"temp_min":266.052,"temp_max":266.052,"pressure":957.86,"sea_level":1039.34,"grnd_level":957.86,"humidity":90},"wind":{"speed":1.16,"deg":139.502},"clouds":{"all":0},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01n"}],"dt":1485722804},{"main":{"temp":263.847,"temp_min":263.847,"temp_max":263.847,"pressure":955.78,"sea_level":1037.43,"grnd_level":955.78,"humidity":91},"wind":{"speed":1.49,"deg":159},"clouds":{"all":0},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01n"}],"dt":1485749608},{"main":{"temp":274.9,"pressure":1019,"temp_min":274.15,"temp_max":275.15,"humidity":88},"wind":{"speed":1,"deg":0},"clouds":{"all":76},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"dt":1485773778}]} 45 | http_version: 46 | recorded_at: Thu, 28 Aug 2014 10:50:48 GMT 47 | recorded_with: VCR 2.9.2 48 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/history_city_valid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://history.openweathermap.org/data/2.5/history/city?q=,Cochin,%20In 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Thu, 28 Aug 2014 10:50:49 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - back 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"message":"","cod":"200","city_id":2885679,"calctime":0.0823,"cnt":3,"list":[{"main":{"temp":266.052,"temp_min":266.052,"temp_max":266.052,"pressure":957.86,"sea_level":1039.34,"grnd_level":957.86,"humidity":90},"wind":{"speed":1.16,"deg":139.502},"clouds":{"all":0},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01n"}],"dt":1485722804},{"main":{"temp":263.847,"temp_min":263.847,"temp_max":263.847,"pressure":955.78,"sea_level":1037.43,"grnd_level":955.78,"humidity":91},"wind":{"speed":1.49,"deg":159},"clouds":{"all":0},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01n"}],"dt":1485749608},{"main":{"temp":274.9,"pressure":1019,"temp_min":274.15,"temp_max":275.15,"humidity":88},"wind":{"speed":1,"deg":0},"clouds":{"all":76},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"dt":1485773778}]} 45 | http_version: 46 | recorded_at: Thu, 28 Aug 2014 10:50:49 GMT 47 | recorded_with: VCR 2.9.2 48 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/history_geocode_valid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://history.openweathermap.org/data/2.5/history/city?lat=9.94&lon=76.26 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Thu, 28 Aug 2014 10:50:49 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - back 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: ASCII-8BIT 43 | string: | 44 | {"message":"","cod":"200","city_id":4887398,"calctime":0.0863,"cnt":4,"list":[{"main":{"temp":268.987,"temp_min":268.987,"temp_max":268.987,"pressure":1001.11,"sea_level":1024.68,"grnd_level":1001.11,"humidity":100},"wind":{"speed":5.06,"deg":291.002},"clouds":{"all":48},"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03d"}],"dt":1485703465},{"main":{"temp":268.097,"temp_min":268.097,"temp_max":268.097,"pressure":1003.57,"sea_level":1027.08,"grnd_level":1003.57,"humidity":100},"wind":{"speed":8.56,"deg":314.007},"clouds":{"all":44},"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03d"}],"dt":1485730032},{"main":{"temp":266.787,"temp_min":266.787,"temp_max":266.787,"pressure":1005.73,"sea_level":1029.63,"grnd_level":1005.73,"humidity":100},"wind":{"speed":6.79,"deg":316.012},"clouds":{"all":0},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01n"}],"dt":1485755383},{"main":{"temp":263.64,"pressure":1015,"humidity":57,"temp_min":262.15,"temp_max":265.15},"wind":{"speed":2.6,"deg":280},"clouds":{"all":1},"weather":[{"id":800,"main":"Clear","description":"sky is clear","icon":"01n"}],"dt":1485780512}]} 45 | http_version: 46 | recorded_at: Thu, 28 Aug 2014 10:50:48 GMT 47 | recorded_with: VCR 2.9.2 48 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/integration/current_by_cities.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/group?APPID=1111111111&id=524901,703448,2643743&units=metric 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Thu, 03 Sep 2015 18:55:49 GMT 27 | Content-Type: 28 | - application/json; charset=utf8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - back 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"cnt":3,"list":[{"coord":{"lon":37.62,"lat":55.75},"sys":{"type":1,"id":7323,"message":0.0059,"country":"RU","sunrise":1441247914,"sunset":1441297148},"weather":[{"id":520,"main":"Rain","description":"light intensity shower rain","icon":"09n"}],"main":{"temp":13.41,"pressure":1014,"humidity":82,"temp_min":11.11,"temp_max":14.8},"wind":{"speed":3,"deg":110},"clouds":{"all":75},"dt":1441306336,"id":524901,"name":"Moscow"},{"coord":{"lon":30.52,"lat":50.43},"sys":{"type":1,"id":7358,"message":0.0036,"country":"UA","sunrise":1441250136,"sunset":1441298334},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01n"}],"main":{"temp":21.76,"pressure":1013,"humidity":69,"temp_min":21,"temp_max":23},"wind":{"speed":2,"deg":350,"var_beg":300,"var_end":20},"clouds":{"all":0},"dt":1441305454,"id":703448,"name":"Kiev"},{"coord":{"lon":-0.13,"lat":51.51},"sys":{"type":1,"id":5093,"message":0.0037,"country":"GB","sunrise":1441257404,"sunset":1441305770},"weather":[{"id":520,"main":"Rain","description":"light intensity shower rain","icon":"09n"}],"main":{"temp":12.76,"pressure":1016,"humidity":76,"temp_min":11,"temp_max":15},"wind":{"speed":2.6,"deg":10,"var_beg":330,"var_end":40},"clouds":{"all":40},"dt":1441306250,"id":2643743,"name":"London"}]} 45 | http_version: 46 | recorded_at: Thu, 03 Sep 2015 18:55:48 GMT 47 | recorded_with: VCR 2.9.3 48 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/current_cities_valid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/group?id=524901,703448,2643743 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Thu, 03 Sep 2015 18:55:49 GMT 27 | Content-Type: 28 | - application/json; charset=utf8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - redis 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"cnt":3,"list":[{"coord":{"lon":37.62,"lat":55.75},"sys":{"type":1,"id":7323,"message":0.0092,"country":"RU","sunrise":1441247914,"sunset":1441297148},"weather":[{"id":520,"main":"Rain","description":"light intensity shower rain","icon":"09n"}],"main":{"temp":286.95,"pressure":1014,"humidity":82,"temp_min":286.15,"temp_max":287.15},"visibility":10000,"wind":{"speed":3,"deg":110},"clouds":{"all":75},"dt":1441305544,"id":524901,"name":"Moscow"},{"coord":{"lon":30.52,"lat":50.43},"sys":{"type":1,"id":7358,"message":0.0036,"country":"UA","sunrise":1441250136,"sunset":1441298334},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01n"}],"main":{"temp":294.91,"pressure":1013,"humidity":69,"temp_min":294.15,"temp_max":296.15},"wind":{"speed":2,"deg":350,"var_beg":300,"var_end":20},"clouds":{"all":0},"dt":1441305454,"id":703448,"name":"Kiev"},{"coord":{"lon":-0.13,"lat":51.51},"sys":{"type":1,"id":5093,"message":0.0047,"country":"GB","sunrise":1441257404,"sunset":1441305770},"weather":[{"id":520,"main":"Rain","description":"light intensity shower rain","icon":"09d"}],"main":{"temp":285.86,"pressure":1016,"humidity":76,"temp_min":284.15,"temp_max":287.15},"wind":{"speed":2.6,"deg":10,"var_beg":330,"var_end":40},"clouds":{"all":40},"dt":1441305650,"id":2643743,"name":"London"}]} 45 | http_version: 46 | recorded_at: Thu, 03 Sep 2015 18:55:48 GMT 47 | recorded_with: VCR 2.9.3 48 | -------------------------------------------------------------------------------- /lib/open_weather/api.rb: -------------------------------------------------------------------------------- 1 | 2 | module OpenWeather 3 | module ClassMethods 4 | # City format : Eg, Cochin,IN 5 | # Usage: OpenWeather::Current.city('Cochin,In') 6 | def city(city, options = {}) 7 | new(options.merge(city: city)).retrieve 8 | end 9 | 10 | # City Id, an integer value. Eg, 2172797 11 | # Usage: OpenWeather::Current.city_id(2172797) 12 | def city_id(id, options = {}) 13 | new(options.merge(id: id)).retrieve 14 | end 15 | 16 | # City Geographics Cordingates : Eg, lat 35 lon 139 17 | def geocode(lat, lon, options = {}) 18 | new(options.merge(lat: lat, lon: lon)).retrieve 19 | end 20 | end 21 | 22 | module SeveralCitiesClassMethods 23 | # Max amount of city IDs that can be requested at once, 24 | # from http://openweathermap.org/current 25 | LOCATIONS_LIMIT = 20 26 | 27 | # City Ids, an array of integer values. Eg, [2172797, 524901] 28 | # Usage: OpenWeather::Current.cities([2172797, 524901]) 29 | # 30 | # Note that every ID in the array counts as an API call. 31 | # A LocationsLimitExceeded error is raised if the API limit is exceeded. 32 | def cities(ids, options = {}) 33 | if ids.length > SeveralCitiesClassMethods::LOCATIONS_LIMIT 34 | raise LocationsLimitExceeded 35 | end 36 | 37 | url = 'http://api.openweathermap.org/data/2.5/group' 38 | ids = encode_array ids 39 | new(options.merge(id: ids)).retrieve url 40 | end 41 | 42 | # Bounding box (lat and lon of top left and bottom right points, map zoom) 43 | # Usage: OpenWeather::Current.rectangle_zone(12, 32, 15, 37, 10) 44 | def rectangle_zone(top_left_lat, top_left_lon, 45 | bottom_right_lat, bottom_right_lon, 46 | map_zoom, options = {}) 47 | url = 'http://api.openweathermap.org/data/2.5/box/city' 48 | bbox = encode_array [top_left_lat, top_left_lon, bottom_right_lat, 49 | bottom_right_lon, map_zoom] 50 | new(options.merge(bbox: bbox)).retrieve url 51 | end 52 | 53 | # Circle zone (lat, lon and count of cities to return) 54 | # Usage: OpenWeather::Current.circle_zone(55.5, 37.5, 10) 55 | def circle_zone(lat, lon, count, options = {}) 56 | url = 'http://api.openweathermap.org/data/2.5/find' 57 | new(options.merge(lat: lat, lon: lon, cnt: count)).retrieve url 58 | end 59 | 60 | private 61 | # Encodes an array in the format expected by the API (comma-separated list) 62 | def encode_array(arr) 63 | arr.join ',' 64 | end 65 | end 66 | 67 | class Base 68 | extend ClassMethods 69 | end 70 | 71 | class History 72 | extend ClassMethods 73 | end 74 | 75 | class Current 76 | extend SeveralCitiesClassMethods 77 | end 78 | end 79 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/forecast_daily_cnt_6.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/forecast/daily?cnt=6&q=,Cochin,%20In 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Wed, 24 Dec 2014 21:15:16 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - redis 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"cod":"200","message":0.0208,"city":{"id":"1273874","name":"Kochi","coord":{"lon":76.2615,"lat":9.93606},"country":"India","population":0},"cnt":6,"list":[{"dt":1419400800,"temp":{"day":297.85,"min":297.85,"max":297.85,"night":297.85,"eve":297.85,"morn":297.85},"pressure":1021.02,"humidity":95,"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03n"}],"speed":1.32,"deg":253,"clouds":36},{"dt":1419487200,"temp":{"day":303.36,"min":296.48,"max":305.05,"night":298.14,"eve":303.08,"morn":296.48},"pressure":1020,"humidity":67,"weather":[{"id":800,"main":"Clear","description":"sky is clear","icon":"01d"}],"speed":2.19,"deg":46,"clouds":0},{"dt":1419573600,"temp":{"day":303.52,"min":297.32,"max":305.08,"night":299.32,"eve":302.99,"morn":297.32},"pressure":1017.68,"humidity":59,"weather":[{"id":800,"main":"Clear","description":"sky is clear","icon":"01d"}],"speed":3.57,"deg":58,"clouds":0},{"dt":1419660000,"temp":{"day":298.63,"min":296.19,"max":301.16,"night":298.48,"eve":301.16,"morn":297.25},"pressure":1018.07,"humidity":82,"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"speed":5.26,"deg":26,"clouds":88},{"dt":1419746400,"temp":{"day":298.68,"min":298.68,"max":299.72,"night":299.25,"eve":299.72,"morn":299.57},"pressure":1020.98,"humidity":0,"weather":[{"id":502,"main":"Rain","description":"heavy intensity rain","icon":"10d"}],"speed":3.12,"deg":175,"clouds":68,"rain":40.09},{"dt":1419832800,"temp":{"day":299.33,"min":299.08,"max":300.85,"night":300.67,"eve":300.85,"morn":299.08},"pressure":1017.96,"humidity":0,"weather":[{"id":502,"main":"Rain","description":"heavy intensity rain","icon":"10d"}],"speed":4.96,"deg":310,"clouds":51,"rain":20.77}]} 45 | http_version: 46 | recorded_at: Wed, 24 Dec 2014 21:15:16 GMT 47 | recorded_with: VCR 2.9.2 48 | -------------------------------------------------------------------------------- /spec/integration/current_spec.rb: -------------------------------------------------------------------------------- 1 | describe 'Current weather information with APPID' do 2 | let(:options) do 3 | { units: 'metric', APPID: 1111111111 } 4 | end 5 | 6 | describe 'searching by city' do 7 | context 'when the city is found' do 8 | let(:weather) do 9 | VCR.use_cassette('integration/current_by_city') do 10 | OpenWeather::Current.city('Berlin, DE', options) 11 | end 12 | end 13 | 14 | it 'returns results' do 15 | expect(weather).to include('weather') 16 | end 17 | end 18 | 19 | context 'when the city is not found' do 20 | let(:weather) do 21 | VCR.use_cassette('integration/current_not_found_city') do 22 | OpenWeather::Current.city('Berlin, DE', options) 23 | end 24 | end 25 | 26 | it 'returns an attribute with code 404' do 27 | expect(weather['cod']).to eq('404') 28 | end 29 | end 30 | end 31 | 32 | describe 'searching by geolocation' do 33 | let(:weather) do 34 | VCR.use_cassette('integration/current_by_geocode') do 35 | OpenWeather::Current.geocode(48.140938, 11.582005, options) 36 | end 37 | end 38 | 39 | it 'returns results' do 40 | expect(weather).to include('weather') 41 | end 42 | end 43 | 44 | describe 'searching by city_id' do 45 | let(:weather) do 46 | VCR.use_cassette('integration/current_by_city_id') do 47 | OpenWeather::Current.city_id(524901, options) 48 | end 49 | end 50 | 51 | it 'returns results' do 52 | expect(weather).to include('weather') 53 | end 54 | end 55 | 56 | describe 'searching by city ids' do 57 | let(:weather) do 58 | VCR.use_cassette('integration/current_by_cities') do 59 | OpenWeather::Current.cities([524901, 703448, 2643743], options) 60 | end 61 | end 62 | 63 | it 'returns results' do 64 | expect(weather).to include('list') 65 | end 66 | 67 | it 'returns results as an array' do 68 | expect(weather['list']).to be_kind_of(Array) 69 | end 70 | end 71 | 72 | describe 'searching by bounding box' do 73 | let(:weather) do 74 | VCR.use_cassette('integration/current_by_rectangle_zone') do 75 | OpenWeather::Current.rectangle_zone(12, 32, 15, 37, 10, options) 76 | end 77 | end 78 | 79 | it 'returns results' do 80 | expect(weather).to include('list') 81 | end 82 | 83 | it 'returns results as an array' do 84 | expect(weather['list']).to be_kind_of(Array) 85 | end 86 | end 87 | 88 | describe 'searching by cycle' do 89 | let(:weather) do 90 | VCR.use_cassette('integration/current_by_circle_zone') do 91 | OpenWeather::Current.circle_zone(55.5, 37.5, 10, options) 92 | end 93 | end 94 | 95 | it 'returns results' do 96 | expect(weather).to include('list') 97 | end 98 | 99 | it 'returns results as an array' do 100 | expect(weather['list']).to be_kind_of(Array) 101 | end 102 | end 103 | end 104 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/forecast_daily_city_metric_valid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/forecast/daily?q=,Cochin,%20In&units=metric 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Wed, 24 Dec 2014 21:15:15 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - back 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"cod":"200","message":0.0484,"city":{"id":"1273874","name":"Kochi","coord":{"lon":76.2615,"lat":9.93606},"country":"India","population":0},"cnt":7,"list":[{"dt":1419400800,"temp":{"day":26.44,"min":26.44,"max":26.44,"night":26.44,"eve":26.44,"morn":26.44},"pressure":1023.99,"humidity":100,"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"speed":1.22,"deg":179,"clouds":88},{"dt":1419487200,"temp":{"day":25.82,"min":23.55,"max":27.32,"night":26.64,"eve":27.32,"morn":23.87},"pressure":1025.89,"humidity":100,"weather":[{"id":501,"main":"Rain","description":"moderate rain","icon":"10d"}],"speed":3.32,"deg":202,"clouds":0,"rain":5},{"dt":1419573600,"temp":{"day":27.24,"min":26.27,"max":27.98,"night":26.79,"eve":27.7,"morn":26.27},"pressure":1023.35,"humidity":99,"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03d"}],"speed":2.37,"deg":136,"clouds":48},{"dt":1419660000,"temp":{"day":27.51,"min":24.2,"max":28.34,"night":24.24,"eve":28.34,"morn":26.24},"pressure":1021.68,"humidity":94,"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03d"}],"speed":5.21,"deg":357,"clouds":48},{"dt":1419746400,"temp":{"day":27.92,"min":25.04,"max":28.89,"night":27.85,"eve":28.84,"morn":25.04},"pressure":1021.79,"humidity":94,"weather":[{"id":800,"main":"Clear","description":"sky is clear","icon":"02d"}],"speed":2.82,"deg":352,"clouds":8},{"dt":1419832800,"temp":{"day":29.64,"min":29.44,"max":29.64,"night":29.44,"eve":29.54,"morn":29.53},"pressure":1020.3,"humidity":0,"weather":[{"id":800,"main":"Clear","description":"sky is clear","icon":"01d"}],"speed":5.4,"deg":337,"clouds":2},{"dt":1419919200,"temp":{"day":29.32,"min":29.16,"max":29.43,"night":29.29,"eve":29.16,"morn":29.43},"pressure":1018.74,"humidity":0,"weather":[{"id":800,"main":"Clear","description":"sky is clear","icon":"01d"}],"speed":7.94,"deg":329,"clouds":20}]} 45 | http_version: 46 | recorded_at: Wed, 24 Dec 2014 21:15:16 GMT 47 | recorded_with: VCR 2.9.2 48 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/forecast_daily_city_valid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/forecast/daily?q=,Cochin,%20In 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Wed, 24 Dec 2014 21:15:12 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - redis 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"cod":"200","message":0.146,"city":{"id":"1273874","name":"Kochi","coord":{"lon":76.2615,"lat":9.93606},"country":"India","population":0},"cnt":7,"list":[{"dt":1419400800,"temp":{"day":297.44,"min":297.44,"max":297.44,"night":297.44,"eve":297.44,"morn":297.44},"pressure":1021.02,"humidity":95,"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03n"}],"speed":1.32,"deg":253,"clouds":36},{"dt":1419487200,"temp":{"day":301.24,"min":296.09,"max":303.23,"night":296.49,"eve":302.64,"morn":296.09},"pressure":1020.05,"humidity":74,"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"speed":1.97,"deg":87,"clouds":64},{"dt":1419573600,"temp":{"day":303.36,"min":296.29,"max":304.94,"night":299.24,"eve":302.87,"morn":296.29},"pressure":1017.68,"humidity":59,"weather":[{"id":800,"main":"Clear","description":"sky is clear","icon":"01d"}],"speed":3.57,"deg":58,"clouds":0},{"dt":1419660000,"temp":{"day":300.11,"min":294.95,"max":302.01,"night":295.44,"eve":297.64,"morn":297.21},"pressure":1016.74,"humidity":76,"weather":[{"id":501,"main":"Rain","description":"moderate rain","icon":"10d"}],"speed":2.41,"deg":22,"clouds":68,"rain":4},{"dt":1419746400,"temp":{"day":303.14,"min":297.29,"max":303.14,"night":299.4,"eve":301.99,"morn":297.29},"pressure":1016.12,"humidity":68,"weather":[{"id":800,"main":"Clear","description":"sky is clear","icon":"02d"}],"speed":4.82,"deg":16,"clouds":8},{"dt":1419832800,"temp":{"day":303.24,"min":301.13,"max":303.24,"night":301.99,"eve":303.07,"morn":301.13},"pressure":1018.28,"humidity":0,"weather":[{"id":800,"main":"Clear","description":"sky is clear","icon":"01d"}],"speed":5,"deg":329,"clouds":7},{"dt":1419919200,"temp":{"day":302.32,"min":300.79,"max":302.32,"night":300.79,"eve":301.74,"morn":301.23},"pressure":1016.31,"humidity":0,"weather":[{"id":800,"main":"Clear","description":"sky is clear","icon":"01d"}],"speed":8.04,"deg":328,"clouds":6}]} 45 | http_version: 46 | recorded_at: Wed, 24 Dec 2014 21:15:13 GMT 47 | recorded_with: VCR 2.9.2 48 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/forecast_daily_cnt_default.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/forecast/daily?q=,Cochin,%20In 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Wed, 24 Dec 2014 21:15:15 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - redis 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"cod":"200","message":0.146,"city":{"id":"1273874","name":"Kochi","coord":{"lon":76.2615,"lat":9.93606},"country":"India","population":0},"cnt":7,"list":[{"dt":1419400800,"temp":{"day":297.44,"min":297.44,"max":297.44,"night":297.44,"eve":297.44,"morn":297.44},"pressure":1021.02,"humidity":95,"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03n"}],"speed":1.32,"deg":253,"clouds":36},{"dt":1419487200,"temp":{"day":301.24,"min":296.09,"max":303.23,"night":296.49,"eve":302.64,"morn":296.09},"pressure":1020.05,"humidity":74,"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"speed":1.97,"deg":87,"clouds":64},{"dt":1419573600,"temp":{"day":303.36,"min":296.29,"max":304.94,"night":299.24,"eve":302.87,"morn":296.29},"pressure":1017.68,"humidity":59,"weather":[{"id":800,"main":"Clear","description":"sky is clear","icon":"01d"}],"speed":3.57,"deg":58,"clouds":0},{"dt":1419660000,"temp":{"day":300.11,"min":294.95,"max":302.01,"night":295.44,"eve":297.64,"morn":297.21},"pressure":1016.74,"humidity":76,"weather":[{"id":501,"main":"Rain","description":"moderate rain","icon":"10d"}],"speed":2.41,"deg":22,"clouds":68,"rain":4},{"dt":1419746400,"temp":{"day":303.14,"min":297.29,"max":303.14,"night":299.4,"eve":301.99,"morn":297.29},"pressure":1016.12,"humidity":68,"weather":[{"id":800,"main":"Clear","description":"sky is clear","icon":"02d"}],"speed":4.82,"deg":16,"clouds":8},{"dt":1419832800,"temp":{"day":303.24,"min":301.13,"max":303.24,"night":301.99,"eve":303.07,"morn":301.13},"pressure":1018.28,"humidity":0,"weather":[{"id":800,"main":"Clear","description":"sky is clear","icon":"01d"}],"speed":5,"deg":329,"clouds":7},{"dt":1419919200,"temp":{"day":302.32,"min":300.79,"max":302.32,"night":300.79,"eve":301.74,"morn":301.23},"pressure":1016.31,"humidity":0,"weather":[{"id":800,"main":"Clear","description":"sky is clear","icon":"01d"}],"speed":8.04,"deg":328,"clouds":6}]} 45 | http_version: 46 | recorded_at: Wed, 24 Dec 2014 21:15:16 GMT 47 | recorded_with: VCR 2.9.2 48 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/forecast_daily_city_imperial_valid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/forecast/daily?q=,Cochin,%20In&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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Wed, 24 Dec 2014 21:15:15 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - redis 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"cod":"200","message":0.1394,"city":{"id":"1273874","name":"Kochi","coord":{"lon":76.2615,"lat":9.93606},"country":"India","population":0},"cnt":7,"list":[{"dt":1419400800,"temp":{"day":76.46,"min":76.46,"max":76.46,"night":76.46,"eve":76.46,"morn":76.46},"pressure":1021.02,"humidity":95,"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03n"}],"speed":2.85,"deg":253,"clouds":36},{"dt":1419487200,"temp":{"day":86.38,"min":73.99,"max":89.42,"night":76.98,"eve":85.87,"morn":73.99},"pressure":1020,"humidity":67,"weather":[{"id":800,"main":"Clear","description":"sky is clear","icon":"01d"}],"speed":4.73,"deg":46,"clouds":0},{"dt":1419573600,"temp":{"day":86.67,"min":75.51,"max":89.47,"night":79.11,"eve":85.71,"morn":75.51},"pressure":1017.68,"humidity":59,"weather":[{"id":800,"main":"Clear","description":"sky is clear","icon":"01d"}],"speed":7.71,"deg":58,"clouds":0},{"dt":1419660000,"temp":{"day":77.86,"min":73.47,"max":82.42,"night":77.59,"eve":82.42,"morn":75.38},"pressure":1018.07,"humidity":82,"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"speed":11.36,"deg":26,"clouds":88},{"dt":1419746400,"temp":{"day":77.95,"min":77.95,"max":79.83,"night":78.98,"eve":79.83,"morn":79.56},"pressure":1020.98,"humidity":0,"weather":[{"id":502,"main":"Rain","description":"heavy intensity rain","icon":"10d"}],"speed":6.74,"deg":175,"clouds":68,"rain":40.09},{"dt":1419832800,"temp":{"day":79.12,"min":78.67,"max":81.86,"night":81.54,"eve":81.86,"morn":78.67},"pressure":1017.96,"humidity":0,"weather":[{"id":502,"main":"Rain","description":"heavy intensity rain","icon":"10d"}],"speed":10.71,"deg":310,"clouds":51,"rain":20.77},{"dt":1419919200,"temp":{"day":82.87,"min":80.69,"max":83.01,"night":80.69,"eve":83.01,"morn":81.36},"pressure":1017.8,"humidity":0,"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"speed":9.98,"deg":337,"clouds":0,"rain":0.58}]} 45 | http_version: 46 | recorded_at: Wed, 24 Dec 2014 21:15:16 GMT 47 | recorded_with: VCR 2.9.2 48 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/forecast_daily_city_id_valid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/forecast/daily?id=1273874 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Wed, 24 Dec 2014 21:15:12 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - redis 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"cod":"200","message":0.0138,"city":{"id":1273874,"name":"Cochin","coord":{"lon":76.260223,"lat":9.93988},"country":"IN","population":604696},"cnt":7,"list":[{"dt":1419400800,"temp":{"day":297.85,"min":297.85,"max":297.85,"night":297.85,"eve":297.85,"morn":297.85},"pressure":1021.02,"humidity":95,"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03n"}],"speed":1.32,"deg":253,"clouds":36},{"dt":1419487200,"temp":{"day":303.36,"min":296.48,"max":305.05,"night":298.14,"eve":303.08,"morn":296.48},"pressure":1020,"humidity":67,"weather":[{"id":800,"main":"Clear","description":"sky is clear","icon":"01d"}],"speed":2.19,"deg":46,"clouds":0},{"dt":1419573600,"temp":{"day":303.52,"min":297.32,"max":305.08,"night":299.32,"eve":302.99,"morn":297.32},"pressure":1017.68,"humidity":59,"weather":[{"id":800,"main":"Clear","description":"sky is clear","icon":"01d"}],"speed":3.57,"deg":58,"clouds":0},{"dt":1419660000,"temp":{"day":298.63,"min":296.19,"max":301.16,"night":298.48,"eve":301.16,"morn":297.25},"pressure":1018.07,"humidity":82,"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"speed":5.26,"deg":26,"clouds":88},{"dt":1419746400,"temp":{"day":298.68,"min":298.68,"max":299.72,"night":299.25,"eve":299.72,"morn":299.57},"pressure":1020.98,"humidity":0,"weather":[{"id":502,"main":"Rain","description":"heavy intensity rain","icon":"10d"}],"speed":3.12,"deg":175,"clouds":68,"rain":40.09},{"dt":1419832800,"temp":{"day":299.33,"min":299.08,"max":300.85,"night":300.67,"eve":300.85,"morn":299.08},"pressure":1017.96,"humidity":0,"weather":[{"id":502,"main":"Rain","description":"heavy intensity rain","icon":"10d"}],"speed":4.96,"deg":310,"clouds":51,"rain":20.77},{"dt":1419919200,"temp":{"day":301.41,"min":300.2,"max":301.49,"night":300.2,"eve":301.49,"morn":300.57},"pressure":1017.8,"humidity":0,"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"speed":4.62,"deg":337,"clouds":0,"rain":0.58}]} 45 | http_version: 46 | recorded_at: Wed, 24 Dec 2014 21:15:13 GMT 47 | recorded_with: VCR 2.9.2 48 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/forecast_daily_geocode_valid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/forecast/daily?lat=9.94&lon=76.26 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Wed, 24 Dec 2014 21:15:13 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - redis 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"cod":"200","message":0.0021,"city":{"id":1278345,"name":"Arukutti","coord":{"lon":76.349998,"lat":9.86667},"country":"IN","population":0},"cnt":7,"list":[{"dt":1419400800,"temp":{"day":297.85,"min":297.85,"max":297.85,"night":297.85,"eve":297.85,"morn":297.85},"pressure":1021.02,"humidity":95,"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03n"}],"speed":1.32,"deg":253,"clouds":36},{"dt":1419487200,"temp":{"day":303.36,"min":296.48,"max":305.05,"night":298.14,"eve":303.08,"morn":296.48},"pressure":1020,"humidity":67,"weather":[{"id":800,"main":"Clear","description":"sky is clear","icon":"01d"}],"speed":2.19,"deg":46,"clouds":0},{"dt":1419573600,"temp":{"day":303.52,"min":297.32,"max":305.08,"night":299.32,"eve":302.99,"morn":297.32},"pressure":1017.68,"humidity":59,"weather":[{"id":800,"main":"Clear","description":"sky is clear","icon":"01d"}],"speed":3.57,"deg":58,"clouds":0},{"dt":1419660000,"temp":{"day":298.63,"min":296.19,"max":301.16,"night":298.48,"eve":301.16,"morn":297.25},"pressure":1018.07,"humidity":82,"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"speed":5.26,"deg":26,"clouds":88},{"dt":1419746400,"temp":{"day":298.68,"min":298.68,"max":299.72,"night":299.25,"eve":299.72,"morn":299.57},"pressure":1020.98,"humidity":0,"weather":[{"id":502,"main":"Rain","description":"heavy intensity rain","icon":"10d"}],"speed":3.12,"deg":175,"clouds":68,"rain":40.09},{"dt":1419832800,"temp":{"day":299.33,"min":299.08,"max":300.85,"night":300.67,"eve":300.85,"morn":299.08},"pressure":1017.96,"humidity":0,"weather":[{"id":502,"main":"Rain","description":"heavy intensity rain","icon":"10d"}],"speed":4.96,"deg":310,"clouds":51,"rain":20.77},{"dt":1419919200,"temp":{"day":301.41,"min":300.2,"max":301.49,"night":300.2,"eve":301.49,"morn":300.57},"pressure":1017.8,"humidity":0,"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"speed":4.62,"deg":337,"clouds":0,"rain":0.58}]} 45 | http_version: 46 | recorded_at: Wed, 24 Dec 2014 21:15:14 GMT 47 | recorded_with: VCR 2.9.2 48 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Inviting maintainers 2 | 3 | Kindly create an issue and tag me if you wish to become a maintainer. 4 | 5 | 6 | ## A ruby wrapper for Open Weather Map API. 7 | 8 | [![Build Status](https://travis-ci.org/coderhs/ruby_open_weather_map.svg?branch=master)](https://travis-ci.org/coderhs/ruby_open_weather_map) 9 | 10 | ## Installation 11 | 12 | Latest version `0.12.0` 13 | 14 | Add the following to your **Gemfile** 15 | 16 | gem 'open-weather' 17 | 18 | or 19 | 20 | $ gem install open-weather 21 | 22 | ## Usage 23 | 24 | 25 | #### Getting and using the API key 26 | 27 | How to get an API key and tips for an effective usage of the API: 28 | http://openweathermap.org/appid 29 | 30 | 31 | ```ruby 32 | # get current weather by city name 33 | options = { units: "metric", APPID: "1111111111" } 34 | OpenWeather::Current.city("Berlin, DE", options) 35 | ``` 36 | 37 | ### Current weather information API 38 | 39 | 40 | ```ruby 41 | require 'open_weather' 42 | 43 | # get current weather by city name 44 | OpenWeather::Current.city("Cochin, IN", options) 45 | 46 | # get current weather by city id 47 | OpenWeather::Current.city_id("1273874", options) 48 | 49 | # get current weather by geocode. (lat, lon) 50 | OpenWeather::Current.geocode(9.94, 76.26 , options) 51 | 52 | # get current weather for a list of city ids 53 | OpenWeather::Current.cities([524901, 703448, 2643743], options) 54 | 55 | # get current weather for a bounding box 56 | OpenWeather::Current.rectangle_zone(12, 32, 15, 37, 10, options) 57 | 58 | # get current weather for cities around a point 59 | OpenWeather::Current.circle_zone(55.5, 37.5, 10, options) 60 | 61 | # By default temperature is returned in fahrenheit to get the current weather in degrees celsius use unit as follows. 62 | options = { units: "metric", APPID: "1111111111" } 63 | OpenWeather::Current.city("Cochin, IN", options) 64 | ``` 65 | 66 | Documentation about the current weather end-point: 67 | http://openweathermap.org/current 68 | 69 | 70 | ### Weather forecast API 71 | 72 | ```ruby 73 | require 'open_weather' 74 | 75 | # get weather forecast by city name 76 | OpenWeather::Forecast.city("Cochin, IN", options) 77 | 78 | # get weather forecast by city name in fahrenheit 79 | OpenWeather::Forecast.city("Cochin, IN", options) 80 | 81 | # get weather forecast by city id 82 | OpenWeather::Forecast.city_id("1273874", options) 83 | 84 | # get weather forecast by geocode. (lat, lon) 85 | OpenWeather::Forecast.geocode(9.94, 76.26, options) 86 | 87 | # get daily weather forecast by city name 88 | OpenWeather::ForecastDaily.city("Cochin, IN", options) 89 | 90 | # get daily weather forecast by city name in fahrenheit 91 | OpenWeather::ForecastDaily.city("Cochin, IN", options) 92 | 93 | # get daily weather forecast by city id 94 | OpenWeather::ForecastDaily.city_id("1273874", options) 95 | 96 | # get daily weather forecast by geocode. (lat, lon) 97 | OpenWeather::ForecastDaily.geocode(9.94, 76.26, options) 98 | 99 | # get daily weather forecast for 6 days 100 | options[:cnt] = 6 101 | OpenWeather::ForecastDaily.city_id("1273874", options) 102 | ``` 103 | 104 | ### Weather history API 105 | 106 | 107 | ```ruby 108 | require 'open_weather' 109 | 110 | # get weather history by city name 111 | OpenWeather::History.city("Cochin, IN", options) 112 | 113 | # get weather history by city id 114 | OpenWeather::History.city_id("1273874", options) 115 | 116 | # get weather history by geocode. (lat, lon) 117 | OpenWeather::History.geocode(9.94, 76.26, options) 118 | ``` 119 | 120 | Doucumentation about the weather forecast end-point: 121 | http://openweathermap.org/forecast 122 | 123 | 124 | 125 | #### Multilingual support 126 | 127 | ```ruby 128 | # get current weather in german 129 | options[:lang] = "de" 130 | OpenWeather::Current.city("Berlin, DE",options) 131 | ``` 132 | 133 | Available languages are listed at: 134 | http://openweathermap.org/current#multi 135 | 136 | 137 | ## Contributing 138 | 139 | Fork it 140 | 141 | Create your feature branch (git checkout -b my-new-feature) 142 | 143 | Commit your changes (git commit -am 'Added some feature') 144 | 145 | Push to the branch (git push origin my-new-feature) 146 | 147 | Create new Pull Request 148 | 149 | -------- 150 | 151 | **This gem was created during the Hacker Saturdays hosted by [Kerala/Kochi Ruby Users Group](https://krug.github.io)** 152 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/current_rectangle_zone_valid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/box/city?bbox=12,32,15,37,10 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Fri, 04 Sep 2015 14:51:02 GMT 27 | Content-Type: 28 | - application/json; charset=utf8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - back 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"cod":"200","calctime":0.52,"cnt":15,"list":[{"id":2208791,"name":"Yafran","coord":{"lon":12.52859,"lat":32.06329},"main":{"temp":39.75,"temp_min":39.747,"temp_max":39.747,"pressure":1006.69,"sea_level":1026.3,"grnd_level":1006.69,"humidity":21},"dt":1441374580,"wind":{"speed":2.71,"deg":38.5002},"clouds":{"all":0},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01d"}]},{"id":2208425,"name":"Zuwarah","coord":{"lon":12.08199,"lat":32.931198},"main":{"temp":35.42,"temp_min":35.416,"temp_max":35.416,"pressure":1024.08,"sea_level":1025.06,"grnd_level":1024.08,"humidity":45},"dt":1441374579,"wind":{"speed":4.27,"deg":91.0012},"clouds":{"all":36},"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03d"}]},{"id":2212771,"name":"Sabratah","coord":{"lon":12.48845,"lat":32.79335},"main":{"temp":39.75,"temp_min":39.747,"temp_max":39.747,"pressure":1006.69,"sea_level":1026.3,"grnd_level":1006.69,"humidity":21},"dt":1441374580,"wind":{"speed":2.71,"deg":38.5002},"clouds":{"all":0},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01d"}]},{"id":2217362,"name":"Gharyan","coord":{"lon":13.02028,"lat":32.172218},"main":{"temp":38.82,"temp_min":38.816,"temp_max":38.816,"pressure":994.49,"sea_level":1025.88,"grnd_level":994.49,"humidity":18},"dt":1441374580,"wind":{"speed":1.67,"deg":202.001},"clouds":{"all":20},"weather":[{"id":801,"main":"Clouds","description":"few clouds","icon":"02d"}]},{"id":2216885,"name":"Zawiya","coord":{"lon":12.72778,"lat":32.75222},"main":{"temp":39.75,"temp_min":39.747,"temp_max":39.747,"pressure":1006.69,"sea_level":1026.3,"grnd_level":1006.69,"humidity":21},"dt":1441374580,"wind":{"speed":2.71,"deg":38.5002},"clouds":{"all":0},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01d"}]},{"id":2210247,"name":"Tripoli","coord":{"lon":13.18746,"lat":32.875191},"main":{"temp":30.87,"temp_min":30.866,"temp_max":30.866,"pressure":1024.65,"sea_level":1025.96,"grnd_level":1024.65,"humidity":80},"dt":1441374580,"wind":{"speed":7.87,"deg":75.0012},"clouds":{"all":0},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01d"}]},{"id":2210221,"name":"Tarhuna","coord":{"lon":13.6332,"lat":32.43502},"main":{"temp":39.37,"temp_min":39.366,"temp_max":39.366,"pressure":994.33,"sea_level":1026.32,"grnd_level":994.33,"humidity":16},"dt":1441374580,"wind":{"speed":2.82,"deg":135.501},"clouds":{"all":0},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01d"}]},{"id":2215163,"name":"Masallatah","coord":{"lon":14,"lat":32.616669},"main":{"temp":37.6,"temp_min":37.597,"temp_max":37.597,"pressure":1014.56,"sea_level":1027.72,"grnd_level":1014.56,"humidity":23},"dt":1441374580,"wind":{"speed":4.06,"deg":81.0002},"clouds":{"all":0},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01d"}]},{"id":2219905,"name":"Al Khums","coord":{"lon":14.26191,"lat":32.648609},"main":{"temp":37.6,"temp_min":37.597,"temp_max":37.597,"pressure":1014.56,"sea_level":1027.72,"grnd_level":1014.56,"humidity":23},"dt":1441374581,"wind":{"speed":4.06,"deg":81.0002},"clouds":{"all":0},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01d"}]},{"id":2208485,"name":"Zlitan","coord":{"lon":14.56874,"lat":32.467381},"main":{"temp":38.22,"temp_min":38.216,"temp_max":38.216,"pressure":1013.62,"sea_level":1026.85,"grnd_level":1013.62,"humidity":24},"dt":1441374580,"wind":{"speed":3.87,"deg":91.5012},"clouds":{"all":0},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01d"}]},{"id":2563191,"name":"Birkirkara","coord":{"lon":14.46111,"lat":35.897221},"main":{"temp":33.65,"pressure":1015,"humidity":36,"temp_min":32.6,"temp_max":34.44},"dt":1441374636,"wind":{"speed":3.1,"deg":240,"var_beg":190,"var_end":270},"clouds":{"all":0},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01d"}]},{"id":2523650,"name":"Ragusa","coord":{"lon":14.71719,"lat":36.928242},"main":{"temp":34.26,"pressure":1013,"humidity":35,"temp_min":31,"temp_max":37},"dt":1441374630,"wind":{"speed":6.2,"deg":60},"clouds":{"all":0},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01d"}]},{"id":2523693,"name":"Pozzallo","coord":{"lon":14.84989,"lat":36.730541},"main":{"temp":28.35,"temp_min":28.347,"temp_max":28.347,"pressure":1026.39,"sea_level":1028.41,"grnd_level":1026.39,"humidity":94},"dt":1441374630,"wind":{"speed":4.11,"deg":242.5},"clouds":{"all":0},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01d"}]},{"id":2524119,"name":"Modica","coord":{"lon":14.77399,"lat":36.84594},"main":{"temp":28.35,"temp_min":28.347,"temp_max":28.347,"pressure":1026.39,"sea_level":1028.41,"grnd_level":1026.39,"humidity":94},"dt":1441374631,"wind":{"speed":4.11,"deg":242.5},"clouds":{"all":0},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01d"}]},{"id":2523581,"name":"Rosolini","coord":{"lon":14.94779,"lat":36.824242},"main":{"temp":28.35,"temp_min":28.347,"temp_max":28.347,"pressure":1026.39,"sea_level":1028.41,"grnd_level":1026.39,"humidity":94},"dt":1441374630,"wind":{"speed":4.11,"deg":242.5},"clouds":{"all":0},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01d"}]}]} 45 | http_version: 46 | recorded_at: Fri, 04 Sep 2015 14:51:01 GMT 47 | recorded_with: VCR 2.9.3 48 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/integration/current_by_circle_zone.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/find?APPID=1111111111&cnt=10&lat=55.5&lon=37.5&units=metric 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Fri, 04 Sep 2015 15:08:59 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - back 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: ASCII-8BIT 43 | string: !binary |- 44 | eyJtZXNzYWdlIjoiYWNjdXJhdGUiLCJjb2QiOiIyMDAiLCJjb3VudCI6MTAs 45 | Imxpc3QiOlt7ImlkIjo0OTUyNjAsIm5hbWUiOiJTaGNoZXJiaW5rYSIsImNv 46 | b3JkIjp7ImxvbiI6MzcuNTU5NzE5LCJsYXQiOjU1LjQ5OTcyMn0sIm1haW4i 47 | OnsidGVtcCI6MTUuNjcsInByZXNzdXJlIjoxMDEyLCJodW1pZGl0eSI6Nzcs 48 | InRlbXBfbWluIjoxNC40NCwidGVtcF9tYXgiOjE3fSwiZHQiOjE0NDEzNzkw 49 | MjgsIndpbmQiOnsic3BlZWQiOjMsImRlZyI6MzIwfSwic3lzIjp7ImNvdW50 50 | cnkiOiIifSwiY2xvdWRzIjp7ImFsbCI6NzV9LCJ3ZWF0aGVyIjpbeyJpZCI6 51 | ODAzLCJtYWluIjoiQ2xvdWRzIiwiZGVzY3JpcHRpb24iOiJicm9rZW4gY2xv 52 | dWRzIiwiaWNvbiI6IjA0ZCJ9XX0seyJpZCI6NTY0NTE3LCJuYW1lIjoiRHVi 53 | cm92aXRzeSIsImNvb3JkIjp7ImxvbiI6MzcuNDg2Njk4LCJsYXQiOjU1LjQz 54 | OTY5fSwibWFpbiI6eyJ0ZW1wIjoxNS40NiwicHJlc3N1cmUiOjEwMTIsImh1 55 | bWlkaXR5Ijo3NywidGVtcF9taW4iOjExLjExLCJ0ZW1wX21heCI6MTcuNH0s 56 | ImR0IjoxNDQxMzc4NTQzLCJ3aW5kIjp7InNwZWVkIjozLCJkZWciOjMyMH0s 57 | InN5cyI6eyJjb3VudHJ5IjoiIn0sImNsb3VkcyI6eyJhbGwiOjc1fSwid2Vh 58 | dGhlciI6W3siaWQiOjgwMywibWFpbiI6IkNsb3VkcyIsImRlc2NyaXB0aW9u 59 | IjoiYnJva2VuIGNsb3VkcyIsImljb24iOiIwNGQifV19LHsiaWQiOjU3MDU3 60 | OCwibmFtZSI6IkJ1dG92byIsImNvb3JkIjp7ImxvbiI6MzcuNTc5NzIsImxh 61 | dCI6NTUuNTQ4MzI4fSwibWFpbiI6eyJ0ZW1wIjoxNS42NywicHJlc3N1cmUi 62 | OjEwMTIsImh1bWlkaXR5Ijo3NywidGVtcF9taW4iOjE0LjQ0LCJ0ZW1wX21h 63 | eCI6MTd9LCJkdCI6MTQ0MTM3OTAyOCwid2luZCI6eyJzcGVlZCI6MywiZGVn 64 | IjozMjB9LCJzeXMiOnsiY291bnRyeSI6IiJ9LCJjbG91ZHMiOnsiYWxsIjo3 65 | NX0sIndlYXRoZXIiOlt7ImlkIjo4MDMsIm1haW4iOiJDbG91ZHMiLCJkZXNj 66 | cmlwdGlvbiI6ImJyb2tlbiBjbG91ZHMiLCJpY29uIjoiMDRkIn1dfSx7Imlk 67 | Ijo1NDU3ODIsIm5hbWUiOiJLb21tdW5hcmthIiwiY29vcmQiOnsibG9uIjoz 68 | Ny40ODkzMTksImxhdCI6NTUuNTY5NTE5fSwibWFpbiI6eyJ0ZW1wIjoxNS40 69 | NiwicHJlc3N1cmUiOjEwMTIsImh1bWlkaXR5Ijo3NywidGVtcF9taW4iOjEx 70 | LjExLCJ0ZW1wX21heCI6MTcuNH0sImR0IjoxNDQxMzc5MDI4LCJ3aW5kIjp7 71 | InNwZWVkIjozLCJkZWciOjMyMH0sInN5cyI6eyJjb3VudHJ5IjoiIn0sImNs 72 | b3VkcyI6eyJhbGwiOjc1fSwid2VhdGhlciI6W3siaWQiOjgwMywibWFpbiI6 73 | IkNsb3VkcyIsImRlc2NyaXB0aW9uIjoiYnJva2VuIGNsb3VkcyIsImljb24i 74 | OiIwNGQifV19LHsiaWQiOjY0MTc0OTAsIm5hbWUiOiJMZXNwYXJra2hveiIs 75 | ImNvb3JkIjp7ImxvbiI6MzcuNjAxMzkxLCJsYXQiOjU1LjU0MzA2fSwibWFp 76 | biI6eyJ0ZW1wIjoxNS42NywicHJlc3N1cmUiOjEwMTIsImh1bWlkaXR5Ijo3 77 | NywidGVtcF9taW4iOjE0LjQ0LCJ0ZW1wX21heCI6MTd9LCJkdCI6MTQ0MTM3 78 | OTAyOCwid2luZCI6eyJzcGVlZCI6MywiZGVnIjozMjB9LCJzeXMiOnsiY291 79 | bnRyeSI6IiJ9LCJjbG91ZHMiOnsiYWxsIjo3NX0sIndlYXRoZXIiOlt7Imlk 80 | Ijo4MDMsIm1haW4iOiJDbG91ZHMiLCJkZXNjcmlwdGlvbiI6ImJyb2tlbiBj 81 | bG91ZHMiLCJpY29uIjoiMDRkIn1dfSx7ImlkIjo1MjY3MzYsIm5hbWUiOiJT 82 | ZWTigJltb3kgTWlrcm9yYXlvbiIsImNvb3JkIjp7ImxvbiI6MzcuNTc5NzIs 83 | ImxhdCI6NTUuNTYyMjIyfSwibWFpbiI6eyJ0ZW1wIjoxNS42NywicHJlc3N1 84 | cmUiOjEwMTIsImh1bWlkaXR5Ijo3NywidGVtcF9taW4iOjE0LjQ0LCJ0ZW1w 85 | X21heCI6MTd9LCJkdCI6MTQ0MTM3OTAyOCwid2luZCI6eyJzcGVlZCI6Mywi 86 | ZGVnIjozMjB9LCJzeXMiOnsiY291bnRyeSI6IiJ9LCJjbG91ZHMiOnsiYWxs 87 | Ijo3NX0sIndlYXRoZXIiOlt7ImlkIjo4MDMsIm1haW4iOiJDbG91ZHMiLCJk 88 | ZXNjcmlwdGlvbiI6ImJyb2tlbiBjbG91ZHMiLCJpY29uIjoiMDRkIn1dfSx7 89 | ImlkIjo0NzMwNTEsIm5hbWUiOiJWbGFz4oCZeWV2byIsImNvb3JkIjp7Imxv 90 | biI6MzcuMzc5NDQ0LCJsYXQiOjU1LjQ2MDI3OH0sIm1haW4iOnsidGVtcCI6 91 | MTYuMDIsInByZXNzdXJlIjoxMDEyLCJodW1pZGl0eSI6NzcsInRlbXBfbWlu 92 | IjoxNC40NCwidGVtcF9tYXgiOjE3LjR9LCJkdCI6MTQ0MTM3OTAyOCwid2lu 93 | ZCI6eyJzcGVlZCI6MywiZGVnIjozMjB9LCJzeXMiOnsiY291bnRyeSI6IiJ9 94 | LCJjbG91ZHMiOnsiYWxsIjo3NX0sIndlYXRoZXIiOlt7ImlkIjo4MDMsIm1h 95 | aW4iOiJDbG91ZHMiLCJkZXNjcmlwdGlvbiI6ImJyb2tlbiBjbG91ZHMiLCJp 96 | Y29uIjoiMDRkIn1dfSx7ImlkIjo1Nzg2ODAsIm5hbWUiOiJCYWNodXJpbm8i 97 | LCJjb29yZCI6eyJsb24iOjM3LjUyLCJsYXQiOjU1LjU4MDAwMn0sIm1haW4i 98 | OnsidGVtcCI6MTUuNjcsInByZXNzdXJlIjoxMDEyLCJodW1pZGl0eSI6Nzcs 99 | InRlbXBfbWluIjoxNC40NCwidGVtcF9tYXgiOjE3fSwiZHQiOjE0NDEzNzkw 100 | MjgsIndpbmQiOnsic3BlZWQiOjMsImRlZyI6MzIwfSwic3lzIjp7ImNvdW50 101 | cnkiOiIifSwiY2xvdWRzIjp7ImFsbCI6NzV9LCJ3ZWF0aGVyIjpbeyJpZCI6 102 | ODAzLCJtYWluIjoiQ2xvdWRzIiwiZGVzY3JpcHRpb24iOiJicm9rZW4gY2xv 103 | dWRzIiwiaWNvbiI6IjA0ZCJ9XX0seyJpZCI6NTU0NjI5LCJuYW1lIjoiU2hl 104 | c3RveSBNaWtyb3JheW9uIiwiY29vcmQiOnsibG9uIjozNy41ODMzMjgsImxh 105 | dCI6NTUuNTY2NjY5fSwibWFpbiI6eyJ0ZW1wIjoxNS4zNywicHJlc3N1cmUi 106 | OjEwMTIsImh1bWlkaXR5Ijo3NywidGVtcF9taW4iOjExLjExLCJ0ZW1wX21h 107 | eCI6MTcuNH0sImR0IjoxNDQxMzc5MTU2LCJ3aW5kIjp7InNwZWVkIjozLCJk 108 | ZWciOjMyMH0sInN5cyI6eyJjb3VudHJ5IjoiIn0sImNsb3VkcyI6eyJhbGwi 109 | Ojc1fSwid2VhdGhlciI6W3siaWQiOjgwMywibWFpbiI6IkNsb3VkcyIsImRl 110 | c2NyaXB0aW9uIjoiYnJva2VuIGNsb3VkcyIsImljb24iOiIwNGQifV19LHsi 111 | aWQiOjUwODEwMSwibmFtZSI6IlBvZG9sc2siLCJjb29yZCI6eyJsb24iOjM3 112 | LjU1NDcyMiwibGF0Ijo1NS40MjQxNzl9LCJtYWluIjp7InRlbXAiOjE1LjY2 113 | LCJwcmVzc3VyZSI6MTAxMiwiaHVtaWRpdHkiOjc3LCJ0ZW1wX21pbiI6MTEu 114 | MTEsInRlbXBfbWF4IjoxNy40fSwiZHQiOjE0NDEzNzg2MjEsIndpbmQiOnsi 115 | c3BlZWQiOjMsImRlZyI6MzIwfSwic3lzIjp7ImNvdW50cnkiOiIifSwiY2xv 116 | dWRzIjp7ImFsbCI6NzV9LCJ3ZWF0aGVyIjpbeyJpZCI6ODAzLCJtYWluIjoi 117 | Q2xvdWRzIiwiZGVzY3JpcHRpb24iOiJicm9rZW4gY2xvdWRzIiwiaWNvbiI6 118 | IjA0ZCJ9XX1dfQo= 119 | http_version: 120 | recorded_at: Fri, 04 Sep 2015 15:08:58 GMT 121 | recorded_with: VCR 2.9.3 122 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/current_circle_zone_valid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/find?cnt=10&lat=55.5&lon=37.5 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Fri, 04 Sep 2015 15:03:12 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - redis 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: ASCII-8BIT 43 | string: !binary |- 44 | eyJtZXNzYWdlIjoiYWNjdXJhdGUiLCJjb2QiOiIyMDAiLCJjb3VudCI6MTAs 45 | Imxpc3QiOlt7ImlkIjo0OTUyNjAsIm5hbWUiOiJTaGNoZXJiaW5rYSIsImNv 46 | b3JkIjp7ImxvbiI6MzcuNTU5NzE5LCJsYXQiOjU1LjQ5OTcyMn0sIm1haW4i 47 | OnsidGVtcCI6Mjg4LjY4LCJwcmVzc3VyZSI6MTAxMywiaHVtaWRpdHkiOjgy 48 | LCJ0ZW1wX21pbiI6Mjg0LjI2LCJ0ZW1wX21heCI6MjkxLjc1fSwiZHQiOjE0 49 | NDEzNzU2MzUsIndpbmQiOnsic3BlZWQiOjMsImRlZyI6MjkwfSwic3lzIjp7 50 | ImNvdW50cnkiOiIifSwiY2xvdWRzIjp7ImFsbCI6NzV9LCJ3ZWF0aGVyIjpb 51 | eyJpZCI6ODAzLCJtYWluIjoiQ2xvdWRzIiwiZGVzY3JpcHRpb24iOiJicm9r 52 | ZW4gY2xvdWRzIiwiaWNvbiI6IjA0ZCJ9XX0seyJpZCI6NTY0NTE3LCJuYW1l 53 | IjoiRHVicm92aXRzeSIsImNvb3JkIjp7ImxvbiI6MzcuNDg2Njk4LCJsYXQi 54 | OjU1LjQzOTY5fSwibWFpbiI6eyJ0ZW1wIjoyODguNjgsInByZXNzdXJlIjox 55 | MDEzLCJodW1pZGl0eSI6ODIsInRlbXBfbWluIjoyODQuMjYsInRlbXBfbWF4 56 | IjoyOTEuNzV9LCJkdCI6MTQ0MTM3NTYzNSwid2luZCI6eyJzcGVlZCI6Mywi 57 | ZGVnIjoyOTB9LCJzeXMiOnsiY291bnRyeSI6IiJ9LCJjbG91ZHMiOnsiYWxs 58 | Ijo3NX0sIndlYXRoZXIiOlt7ImlkIjo4MDMsIm1haW4iOiJDbG91ZHMiLCJk 59 | ZXNjcmlwdGlvbiI6ImJyb2tlbiBjbG91ZHMiLCJpY29uIjoiMDRkIn1dfSx7 60 | ImlkIjo1NzA1NzgsIm5hbWUiOiJCdXRvdm8iLCJjb29yZCI6eyJsb24iOjM3 61 | LjU3OTcyLCJsYXQiOjU1LjU0ODMyOH0sIm1haW4iOnsidGVtcCI6Mjg4Ljcy 62 | LCJwcmVzc3VyZSI6MTAxMywiaHVtaWRpdHkiOjgyLCJ0ZW1wX21pbiI6Mjg3 63 | LjA0LCJ0ZW1wX21heCI6MjkwLjE1fSwiZHQiOjE0NDEzNzU2MzUsIndpbmQi 64 | Onsic3BlZWQiOjMsImRlZyI6MjkwfSwic3lzIjp7ImNvdW50cnkiOiIifSwi 65 | Y2xvdWRzIjp7ImFsbCI6NzV9LCJ3ZWF0aGVyIjpbeyJpZCI6ODAzLCJtYWlu 66 | IjoiQ2xvdWRzIiwiZGVzY3JpcHRpb24iOiJicm9rZW4gY2xvdWRzIiwiaWNv 67 | biI6IjA0ZCJ9XX0seyJpZCI6NTQ1NzgyLCJuYW1lIjoiS29tbXVuYXJrYSIs 68 | ImNvb3JkIjp7ImxvbiI6MzcuNDg5MzE5LCJsYXQiOjU1LjU2OTUxOX0sIm1h 69 | aW4iOnsidGVtcCI6Mjg4LjY3LCJwcmVzc3VyZSI6MTAxMywiaHVtaWRpdHki 70 | OjgyLCJ0ZW1wX21pbiI6Mjg0LjI2LCJ0ZW1wX21heCI6MjkxLjc1fSwiZHQi 71 | OjE0NDEzNzU2MzUsIndpbmQiOnsic3BlZWQiOjMsImRlZyI6MjkwfSwic3lz 72 | Ijp7ImNvdW50cnkiOiIifSwiY2xvdWRzIjp7ImFsbCI6NzV9LCJ3ZWF0aGVy 73 | IjpbeyJpZCI6ODAzLCJtYWluIjoiQ2xvdWRzIiwiZGVzY3JpcHRpb24iOiJi 74 | cm9rZW4gY2xvdWRzIiwiaWNvbiI6IjA0ZCJ9XX0seyJpZCI6NjQxNzQ5MCwi 75 | bmFtZSI6Ikxlc3BhcmtraG96IiwiY29vcmQiOnsibG9uIjozNy42MDEzOTEs 76 | ImxhdCI6NTUuNTQzMDZ9LCJtYWluIjp7InRlbXAiOjI4OC43MiwicHJlc3N1 77 | cmUiOjEwMTMsImh1bWlkaXR5Ijo4MiwidGVtcF9taW4iOjI4Ny4wNCwidGVt 78 | cF9tYXgiOjI5MC4xNX0sImR0IjoxNDQxMzc1NjM1LCJ3aW5kIjp7InNwZWVk 79 | IjozLCJkZWciOjI5MH0sInN5cyI6eyJjb3VudHJ5IjoiIn0sImNsb3VkcyI6 80 | eyJhbGwiOjc1fSwid2VhdGhlciI6W3siaWQiOjgwMywibWFpbiI6IkNsb3Vk 81 | cyIsImRlc2NyaXB0aW9uIjoiYnJva2VuIGNsb3VkcyIsImljb24iOiIwNGQi 82 | fV19LHsiaWQiOjUyNjczNiwibmFtZSI6IlNlZOKAmW1veSBNaWtyb3JheW9u 83 | IiwiY29vcmQiOnsibG9uIjozNy41Nzk3MiwibGF0Ijo1NS41NjIyMjJ9LCJt 84 | YWluIjp7InRlbXAiOjI4OC42OCwicHJlc3N1cmUiOjEwMTMsImh1bWlkaXR5 85 | Ijo4MiwidGVtcF9taW4iOjI4Ny4wNCwidGVtcF9tYXgiOjI5MC4xNX0sImR0 86 | IjoxNDQxMzc1MDM2LCJ3aW5kIjp7InNwZWVkIjozLCJkZWciOjI5MH0sInN5 87 | cyI6eyJjb3VudHJ5IjoiIn0sImNsb3VkcyI6eyJhbGwiOjc1fSwid2VhdGhl 88 | ciI6W3siaWQiOjgwMywibWFpbiI6IkNsb3VkcyIsImRlc2NyaXB0aW9uIjoi 89 | YnJva2VuIGNsb3VkcyIsImljb24iOiIwNGQifV19LHsiaWQiOjQ3MzA1MSwi 90 | bmFtZSI6IlZsYXPigJl5ZXZvIiwiY29vcmQiOnsibG9uIjozNy4zNzk0NDQs 91 | ImxhdCI6NTUuNDYwMjc4fSwibWFpbiI6eyJ0ZW1wIjoyODkuMjQsInByZXNz 92 | dXJlIjoxMDEzLCJodW1pZGl0eSI6ODIsInRlbXBfbWluIjoyODcuMDQsInRl 93 | bXBfbWF4IjoyOTEuNzV9LCJkdCI6MTQ0MTM3NTU2NSwid2luZCI6eyJzcGVl 94 | ZCI6MywiZGVnIjoyOTB9LCJzeXMiOnsiY291bnRyeSI6IiJ9LCJjbG91ZHMi 95 | OnsiYWxsIjo3NX0sIndlYXRoZXIiOlt7ImlkIjo4MDMsIm1haW4iOiJDbG91 96 | ZHMiLCJkZXNjcmlwdGlvbiI6ImJyb2tlbiBjbG91ZHMiLCJpY29uIjoiMDRk 97 | In1dfSx7ImlkIjo1Nzg2ODAsIm5hbWUiOiJCYWNodXJpbm8iLCJjb29yZCI6 98 | eyJsb24iOjM3LjUyLCJsYXQiOjU1LjU4MDAwMn0sIm1haW4iOnsidGVtcCI6 99 | Mjg4LjcsInByZXNzdXJlIjoxMDEzLCJodW1pZGl0eSI6ODIsInRlbXBfbWlu 100 | IjoyODQuMjYsInRlbXBfbWF4IjoyOTIuMzV9LCJkdCI6MTQ0MTM3NTI2Nywi 101 | d2luZCI6eyJzcGVlZCI6MywiZGVnIjoyOTB9LCJzeXMiOnsiY291bnRyeSI6 102 | IiJ9LCJjbG91ZHMiOnsiYWxsIjo3NX0sIndlYXRoZXIiOlt7ImlkIjo4MDMs 103 | Im1haW4iOiJDbG91ZHMiLCJkZXNjcmlwdGlvbiI6ImJyb2tlbiBjbG91ZHMi 104 | LCJpY29uIjoiMDRkIn1dfSx7ImlkIjo1NTQ2MjksIm5hbWUiOiJTaGVzdG95 105 | IE1pa3JvcmF5b24iLCJjb29yZCI6eyJsb24iOjM3LjU4MzMyOCwibGF0Ijo1 106 | NS41NjY2Njl9LCJtYWluIjp7InRlbXAiOjI4OC43MiwicHJlc3N1cmUiOjEw 107 | MTMsImh1bWlkaXR5Ijo4MiwidGVtcF9taW4iOjI4Ny4wNCwidGVtcF9tYXgi 108 | OjI5MC4xNX0sImR0IjoxNDQxMzc1NjM1LCJ3aW5kIjp7InNwZWVkIjozLCJk 109 | ZWciOjI5MH0sInN5cyI6eyJjb3VudHJ5IjoiIn0sImNsb3VkcyI6eyJhbGwi 110 | Ojc1fSwid2VhdGhlciI6W3siaWQiOjgwMywibWFpbiI6IkNsb3VkcyIsImRl 111 | c2NyaXB0aW9uIjoiYnJva2VuIGNsb3VkcyIsImljb24iOiIwNGQifV19LHsi 112 | aWQiOjUwODEwMSwibmFtZSI6IlBvZG9sc2siLCJjb29yZCI6eyJsb24iOjM3 113 | LjU1NDcyMiwibGF0Ijo1NS40MjQxNzl9LCJtYWluIjp7InRlbXAiOjI4OC42 114 | NywicHJlc3N1cmUiOjEwMTMsImh1bWlkaXR5Ijo4MiwidGVtcF9taW4iOjI4 115 | Ny4wNCwidGVtcF9tYXgiOjI5MC4xNX0sImR0IjoxNDQxMzc1MTI1LCJ3aW5k 116 | Ijp7InNwZWVkIjozLCJkZWciOjI5MH0sInN5cyI6eyJjb3VudHJ5IjoiIn0s 117 | ImNsb3VkcyI6eyJhbGwiOjc1fSwid2VhdGhlciI6W3siaWQiOjgwMywibWFp 118 | biI6IkNsb3VkcyIsImRlc2NyaXB0aW9uIjoiYnJva2VuIGNsb3VkcyIsImlj 119 | b24iOiIwNGQifV19XX0K 120 | http_version: 121 | recorded_at: Fri, 04 Sep 2015 15:03:11 GMT 122 | recorded_with: VCR 2.9.3 123 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/integration/current_by_rectangle_zone.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/box/city?APPID=1111111111&units=metric 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Fri, 04 Sep 2015 14:48:25 GMT 27 | Content-Type: 28 | - application/json; charset=utf8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - redis 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"message":"","cod":"500"} 45 | http_version: 46 | recorded_at: Fri, 04 Sep 2015 14:48:24 GMT 47 | - request: 48 | method: get 49 | uri: http://api.openweathermap.org/data/2.5/box/city?APPID=1111111111&bbox=12,32,15,37,10&units=metric 50 | body: 51 | encoding: US-ASCII 52 | string: '' 53 | headers: 54 | Accept-Encoding: 55 | - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 56 | Accept: 57 | - "*/*" 58 | User-Agent: 59 | - Ruby 60 | Host: 61 | - api.openweathermap.org 62 | response: 63 | status: 64 | code: 200 65 | message: OK 66 | headers: 67 | Server: 68 | - nginx 69 | Date: 70 | - Fri, 04 Sep 2015 14:51:01 GMT 71 | Content-Type: 72 | - application/json; charset=utf8 73 | Transfer-Encoding: 74 | - chunked 75 | Connection: 76 | - keep-alive 77 | X-Source: 78 | - back 79 | Access-Control-Allow-Origin: 80 | - "*" 81 | Access-Control-Allow-Credentials: 82 | - 'true' 83 | Access-Control-Allow-Methods: 84 | - GET, POST 85 | body: 86 | encoding: UTF-8 87 | string: | 88 | {"cod":"200","calctime":1.152,"cnt":15,"list":[{"id":2208791,"name":"Yafran","coord":{"lon":12.52859,"lat":32.06329},"main":{"temp":39.75,"temp_min":39.747,"temp_max":39.747,"pressure":1006.69,"sea_level":1026.3,"grnd_level":1006.69,"humidity":21},"dt":1441374580,"wind":{"speed":2.71,"deg":38.5002},"clouds":{"all":0},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01d"}]},{"id":2208425,"name":"Zuwarah","coord":{"lon":12.08199,"lat":32.931198},"main":{"temp":35.42,"temp_min":35.416,"temp_max":35.416,"pressure":1024.08,"sea_level":1025.06,"grnd_level":1024.08,"humidity":45},"dt":1441374579,"wind":{"speed":4.27,"deg":91.0012},"clouds":{"all":36},"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03d"}]},{"id":2212771,"name":"Sabratah","coord":{"lon":12.48845,"lat":32.79335},"main":{"temp":39.75,"temp_min":39.747,"temp_max":39.747,"pressure":1006.69,"sea_level":1026.3,"grnd_level":1006.69,"humidity":21},"dt":1441374580,"wind":{"speed":2.71,"deg":38.5002},"clouds":{"all":0},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01d"}]},{"id":2217362,"name":"Gharyan","coord":{"lon":13.02028,"lat":32.172218},"main":{"temp":38.82,"temp_min":38.816,"temp_max":38.816,"pressure":994.49,"sea_level":1025.88,"grnd_level":994.49,"humidity":18},"dt":1441374580,"wind":{"speed":1.67,"deg":202.001},"clouds":{"all":20},"weather":[{"id":801,"main":"Clouds","description":"few clouds","icon":"02d"}]},{"id":2216885,"name":"Zawiya","coord":{"lon":12.72778,"lat":32.75222},"main":{"temp":39.75,"temp_min":39.747,"temp_max":39.747,"pressure":1006.69,"sea_level":1026.3,"grnd_level":1006.69,"humidity":21},"dt":1441374580,"wind":{"speed":2.71,"deg":38.5002},"clouds":{"all":0},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01d"}]},{"id":2210247,"name":"Tripoli","coord":{"lon":13.18746,"lat":32.875191},"main":{"temp":30.87,"temp_min":30.866,"temp_max":30.866,"pressure":1024.65,"sea_level":1025.96,"grnd_level":1024.65,"humidity":80},"dt":1441374580,"wind":{"speed":7.87,"deg":75.0012},"clouds":{"all":0},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01d"}]},{"id":2210221,"name":"Tarhuna","coord":{"lon":13.6332,"lat":32.43502},"main":{"temp":39.37,"temp_min":39.366,"temp_max":39.366,"pressure":994.33,"sea_level":1026.32,"grnd_level":994.33,"humidity":16},"dt":1441374580,"wind":{"speed":2.82,"deg":135.501},"clouds":{"all":0},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01d"}]},{"id":2215163,"name":"Masallatah","coord":{"lon":14,"lat":32.616669},"main":{"temp":37.6,"temp_min":37.597,"temp_max":37.597,"pressure":1014.56,"sea_level":1027.72,"grnd_level":1014.56,"humidity":23},"dt":1441374580,"wind":{"speed":4.06,"deg":81.0002},"clouds":{"all":0},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01d"}]},{"id":2219905,"name":"Al Khums","coord":{"lon":14.26191,"lat":32.648609},"main":{"temp":37.6,"temp_min":37.597,"temp_max":37.597,"pressure":1014.56,"sea_level":1027.72,"grnd_level":1014.56,"humidity":23},"dt":1441374581,"wind":{"speed":4.06,"deg":81.0002},"clouds":{"all":0},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01d"}]},{"id":2208485,"name":"Zlitan","coord":{"lon":14.56874,"lat":32.467381},"main":{"temp":38.22,"temp_min":38.216,"temp_max":38.216,"pressure":1013.62,"sea_level":1026.85,"grnd_level":1013.62,"humidity":24},"dt":1441374580,"wind":{"speed":3.87,"deg":91.5012},"clouds":{"all":0},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01d"}]},{"id":2563191,"name":"Birkirkara","coord":{"lon":14.46111,"lat":35.897221},"main":{"temp":33.65,"pressure":1015,"humidity":36,"temp_min":32.6,"temp_max":34.44},"dt":1441374636,"wind":{"speed":3.1,"deg":240,"var_beg":190,"var_end":270},"clouds":{"all":0},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01d"}]},{"id":2523650,"name":"Ragusa","coord":{"lon":14.71719,"lat":36.928242},"main":{"temp":34.26,"pressure":1013,"humidity":35,"temp_min":31,"temp_max":37},"dt":1441374630,"wind":{"speed":6.2,"deg":60},"clouds":{"all":0},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01d"}]},{"id":2523693,"name":"Pozzallo","coord":{"lon":14.84989,"lat":36.730541},"main":{"temp":28.35,"temp_min":28.347,"temp_max":28.347,"pressure":1026.39,"sea_level":1028.41,"grnd_level":1026.39,"humidity":94},"dt":1441374630,"wind":{"speed":4.11,"deg":242.5},"clouds":{"all":0},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01d"}]},{"id":2524119,"name":"Modica","coord":{"lon":14.77399,"lat":36.84594},"main":{"temp":28.35,"temp_min":28.347,"temp_max":28.347,"pressure":1026.39,"sea_level":1028.41,"grnd_level":1026.39,"humidity":94},"dt":1441374631,"wind":{"speed":4.11,"deg":242.5},"clouds":{"all":0},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01d"}]},{"id":2523581,"name":"Rosolini","coord":{"lon":14.94779,"lat":36.824242},"main":{"temp":28.35,"temp_min":28.347,"temp_max":28.347,"pressure":1026.39,"sea_level":1028.41,"grnd_level":1026.39,"humidity":94},"dt":1441374630,"wind":{"speed":4.11,"deg":242.5},"clouds":{"all":0},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01d"}]}]} 89 | http_version: 90 | recorded_at: Fri, 04 Sep 2015 14:51:00 GMT 91 | recorded_with: VCR 2.9.3 92 | -------------------------------------------------------------------------------- /spec/open_weather/api_spec.rb: -------------------------------------------------------------------------------- 1 | describe 'Open weather Current API' do 2 | context '.city' do 3 | it 'return current weather for cochi' do 4 | response = VCR.use_cassette('api/current_city_valid') do 5 | OpenWeather::Current.city('Cochin, In') 6 | end 7 | response['cod'].should eq(200) 8 | end 9 | 10 | it 'returns error if the city is invalid' do 11 | response = VCR.use_cassette('api/current_city_invalid') do 12 | OpenWeather::Current.city('Cochiiiiiin, In') 13 | end 14 | response['cod'].should eq('404') 15 | end 16 | end 17 | 18 | context '.city_id' do 19 | it 'return current weather for city id of cochi' do 20 | response = VCR.use_cassette('api/current_city_id_valid') do 21 | OpenWeather::Current.city_id('1273874') 22 | end 23 | response['cod'].should eq(200) 24 | end 25 | 26 | it 'returns error if the city id is invalid' do 27 | response = VCR.use_cassette('api/current_city_id_invalid') do 28 | OpenWeather::Current.city('invalidid') 29 | end 30 | response['cod'].should eq('404') 31 | end 32 | end 33 | 34 | context '.geocode' do 35 | it 'return current weather for geocode of cochi' do 36 | response = VCR.use_cassette('api/current_geocode_valid') do 37 | OpenWeather::Current.geocode('9.94', '76.26') 38 | end 39 | response['cod'].should eq(200) 40 | end 41 | 42 | it 'returns error if the geocode is invalid' do 43 | response = VCR.use_cassette('api/current_geocode_invalid') do 44 | OpenWeather::Current.geocode('181', '181') 45 | end 46 | response['cod'].should eq('404') 47 | end 48 | end 49 | 50 | context '.cities' do 51 | it 'return current weather for list of cities' do 52 | response = VCR.use_cassette('api/current_cities_valid') do 53 | OpenWeather::Current.cities([524901, 703448, 2643743]) 54 | end 55 | response['list'].count.should eq(3) 56 | end 57 | 58 | it 'return empty list if cities are invalid' do 59 | response = VCR.use_cassette('api/current_cities_invalid') do 60 | OpenWeather::Current.cities([42, 1000]) 61 | end 62 | response['list'].count.should eq(0) 63 | end 64 | 65 | it 'raises a LocationsLimitExceeded exception with too many city IDs' do 66 | expect { 67 | OpenWeather::Current.cities([0] * 1000) 68 | }.to raise_error OpenWeather::LocationsLimitExceeded 69 | end 70 | end 71 | 72 | context '.rectangle_zone' do 73 | it 'return current weather for the cities in a bounding box' do 74 | response = VCR.use_cassette('api/current_rectangle_zone_valid') do 75 | OpenWeather::Current.rectangle_zone(12, 32, 15, 37, 10) 76 | end 77 | response['list'].count.should eq(15) 78 | end 79 | 80 | it 'return empty list if bounding box is invalid' do 81 | response = VCR.use_cassette('api/current_rectangle_zone_invalid') do 82 | OpenWeather::Current.rectangle_zone(-5, -5, -5, -5, -5) 83 | end 84 | response['list'].count.should eq(0) 85 | end 86 | end 87 | 88 | context '.circle_zone' do 89 | it 'return current weather for the cities in cycle' do 90 | response = VCR.use_cassette('api/current_circle_zone_valid') do 91 | OpenWeather::Current.circle_zone(55.5, 37.5, 10) 92 | end 93 | response['list'].count.should eq(10) 94 | end 95 | 96 | it 'return error if count is negative' do 97 | response = VCR.use_cassette('api/current_circle_zone_invalid') do 98 | OpenWeather::Current.circle_zone(55.5, 37.5, -10) 99 | end 100 | response['cod'].should eq("500") 101 | end 102 | end 103 | 104 | context 'units option' do 105 | it 'returns the current temperature in requested units' do 106 | response = VCR.use_cassette('api/current_city_metric_valid') do 107 | OpenWeather::Current.city('Cochin, In', units: 'metric') 108 | end 109 | temp_metric = response['main']['temp'] 110 | 111 | response = VCR.use_cassette('api/current_city_imperial_valid') do 112 | OpenWeather::Current.city('Cochin, In', units: 'imperial') 113 | end 114 | temp_imperial = response['main']['temp'] 115 | farenheit_to_celsius = ((temp_imperial - 32) / 1.8000) 116 | 117 | expect(farenheit_to_celsius).to be_within(0.01).of(temp_metric) 118 | end 119 | end 120 | end 121 | 122 | describe 'Open weather Forecast API' do 123 | context '.city' do 124 | it 'return forecast weather for cochi' do 125 | response = VCR.use_cassette('api/forecast_city_valid') do 126 | OpenWeather::Forecast.city('Cochin, In') 127 | end 128 | response['cod'].to_s.should eq('200') 129 | end 130 | 131 | it 'returns error if the city is invalid' do 132 | response = VCR.use_cassette('api/forecast_invalid') do 133 | OpenWeather::Forecast.city('Cochiiiiiin, In') 134 | end 135 | response['cod'].to_s.should eq('404') 136 | end 137 | end 138 | 139 | context '.city_id' do 140 | it 'return forecast weather for city id of cochi' do 141 | response = VCR.use_cassette('api/forecast_city_id_valid') do 142 | OpenWeather::Forecast.city_id('1273874') 143 | end 144 | response['cod'].to_s.should eq('200') 145 | end 146 | 147 | it 'returns error if the city id is invalid' do 148 | response = VCR.use_cassette('api/forecast_city_id_invalid') do 149 | OpenWeather::Forecast.city('invalidid') 150 | end 151 | response['cod'].to_s.should eq('404') 152 | end 153 | end 154 | 155 | context '.geocode' do 156 | it 'return forecast weather for geocode of cochi' do 157 | response = VCR.use_cassette('api/forecast_geocode_valid') do 158 | OpenWeather::Forecast.geocode('9.94', '76.26') 159 | end 160 | response['cod'].to_s.should eq('200') 161 | end 162 | 163 | it 'returns error if the geocode is invalid' do 164 | response = VCR.use_cassette('api/forecast_geocode_invalid') do 165 | OpenWeather::Forecast.geocode('181', '181') 166 | end 167 | response['cod'].to_s.should eq('404') 168 | end 169 | end 170 | 171 | context 'units option' do 172 | it 'returns the forecast in requested units' do 173 | response = VCR.use_cassette('api/forecast_city_metric_valid') do 174 | OpenWeather::Forecast.city('Cochin, In', units: 'metric') 175 | end 176 | temp_metric = response['list'].first['main']['temp'] 177 | 178 | response = VCR.use_cassette('api/forecast_city_imperial_valid') do 179 | OpenWeather::Forecast.city('Cochin, In', units: 'imperial') 180 | end 181 | temp_imperial = response['list'].first['main']['temp'] 182 | farenheit_to_celsius = ((temp_imperial - 32) / 1.8000) 183 | 184 | expect(farenheit_to_celsius).to be_within(temp_metric-1).of(temp_metric+1) 185 | end 186 | end 187 | end 188 | 189 | describe 'Open weather Forecast Daily API' do 190 | context '.city' do 191 | it 'return forecast weather for cochi' do 192 | response = VCR.use_cassette('api/forecast_daily_city_valid') do 193 | OpenWeather::ForecastDaily.city('Cochin, In') 194 | end 195 | response['cod'].to_s.should eq('200') 196 | end 197 | 198 | it 'returns error if the city is invalid' do 199 | response = VCR.use_cassette('api/forecast_daily_invalid') do 200 | OpenWeather::ForecastDaily.city('Cochiiiiiin, In') 201 | end 202 | response['cod'].to_s.should eq('404') 203 | end 204 | end 205 | 206 | context '.city_id' do 207 | it 'return forecast weather for city id of cochi' do 208 | response = VCR.use_cassette('api/forecast_daily_city_id_valid') do 209 | OpenWeather::ForecastDaily.city_id('1273874') 210 | end 211 | response['cod'].to_s.should eq('200') 212 | end 213 | 214 | it 'returns error if the city id is invalid' do 215 | response = VCR.use_cassette('api/forecast_daily_city_id_invalid') do 216 | OpenWeather::ForecastDaily.city('invalidid') 217 | end 218 | response['cod'].to_s.should eq('404') 219 | end 220 | end 221 | 222 | context '.geocode' do 223 | it 'return forecast weather for geocode of cochi' do 224 | response = VCR.use_cassette('api/forecast_daily_geocode_valid') do 225 | OpenWeather::ForecastDaily.geocode('9.94', '76.26') 226 | end 227 | response['cod'].to_s.should eq('200') 228 | end 229 | 230 | it 'returns error if the geocode is invalid' do 231 | response = VCR.use_cassette('api/forecast_daily_geocode_invalid') do 232 | OpenWeather::ForecastDaily.geocode('181', '181') 233 | end 234 | response['cod'].to_s.should eq('404') 235 | end 236 | end 237 | 238 | context 'units option' do 239 | it 'returns the forecast in requested units' do 240 | response = VCR.use_cassette('api/forecast_daily_city_metric_valid') do 241 | OpenWeather::ForecastDaily.city('Cochin, In', units: 'metric') 242 | end 243 | temp_metric = response['list'].first['temp']['day'] 244 | 245 | response = VCR.use_cassette('api/forecast_daily_city_imperial_valid') do 246 | OpenWeather::ForecastDaily.city('Cochin, In', units: 'imperial') 247 | end 248 | temp_imperial = response['list'].first['temp']['day'] 249 | farenheit_to_celsius = ((temp_imperial - 32) / 1.8000) 250 | 251 | expect(farenheit_to_celsius).to be_within(temp_metric-1).of(temp_metric+1) 252 | end 253 | end 254 | 255 | context 'cnt option' do 256 | it 'returns the forecast for N days' do 257 | response = VCR.use_cassette('api/forecast_daily_cnt_default') do 258 | OpenWeather::ForecastDaily.city('Cochin, In') 259 | end 260 | response['list'].count.should eq(7) 261 | 262 | response = VCR.use_cassette('api/forecast_daily_cnt_6') do 263 | OpenWeather::ForecastDaily.city('Cochin, In', cnt: 6) 264 | end 265 | response['list'].count.should eq(6) 266 | end 267 | end 268 | end 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | describe 'Open weather History API' do 285 | context '.city' do 286 | it 'return current weather for cochi' do 287 | response = VCR.use_cassette('api/history_city_valid') do 288 | OpenWeather::History.city('Cochin, In') 289 | end 290 | response['cod'].should eq('200') 291 | 292 | end 293 | 294 | it 'returns error if the city is invalid' do 295 | response = VCR.use_cassette('api/history_city_invalid') do 296 | OpenWeather::History.city('Cochiiiiiin, In') 297 | end 298 | response['error'].should eq('404') 299 | end 300 | end 301 | 302 | context '.city_id' do 303 | it 'return current weather for city id of cochi' do 304 | response = VCR.use_cassette('api/history_city_id_valid') do 305 | OpenWeather::History.city_id('1273874') 306 | end 307 | response['cod'].should eq('200') 308 | end 309 | 310 | it 'returns error if the city id is invalid' do 311 | response = VCR.use_cassette('api/history_city_id_invalid') do 312 | OpenWeather::History.city('invalidid') 313 | end 314 | response['error'].should eq('404') 315 | end 316 | end 317 | 318 | context '.geocode' do 319 | it 'return current weather for geocode of cochi' do 320 | response = VCR.use_cassette('api/history_geocode_valid') do 321 | OpenWeather::History.geocode('9.94', '76.26') 322 | end 323 | response['cod'].should eq('200') 324 | end 325 | 326 | it 'returns error if the geocode is invalid' do 327 | response = VCR.use_cassette('api/history_geocode_invalid') do 328 | OpenWeather::History.geocode('181', '181') 329 | end 330 | response['error'].should eq('404') 331 | end 332 | end 333 | end 334 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/forecast_city_imperial_valid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/forecast?q=,Cochin,%20In&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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Thu, 28 Aug 2014 10:52:10 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - back 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"cod":"200","message":0.0501,"city":{"id":"1273874","name":"Kochi","coord":{"lon":76.2615,"lat":9.93606},"country":"India","population":0},"cnt":33,"list":[{"dt":1409216400,"main":{"temp":80.22,"temp_min":80.22,"temp_max":80.22,"pressure":1021.68,"sea_level":1023.32,"grnd_level":1021.68,"humidity":100,"temp_kf":0},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":64},"wind":{"speed":10.61,"deg":311.006},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-28 09:00:00"},{"dt":1409227200,"main":{"temp":79.95,"temp_min":79.95,"temp_max":79.96,"pressure":1020.95,"sea_level":1021.19,"grnd_level":1020.95,"humidity":99,"temp_kf":0},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"clouds":{"all":88},"wind":{"speed":11.79,"deg":313.001},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-28 12:00:00"},{"dt":1409238000,"main":{"temp":79.03,"temp_min":79.03,"temp_max":79.04,"pressure":1022.42,"sea_level":1022.56,"grnd_level":1022.42,"humidity":100,"temp_kf":0},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":92},"wind":{"speed":9.44,"deg":307.003},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-28 15:00:00"},{"dt":1409248800,"main":{"temp":79.29,"temp_min":79.29,"temp_max":79.29,"pressure":1023.02,"sea_level":1023.2,"grnd_level":1023.02,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":10.39,"deg":306},"rain":{"3h":2},"sys":{"pod":"n"},"dt_txt":"2014-08-28 18:00:00"},{"dt":1409259600,"main":{"temp":78.08,"temp_min":78.08,"temp_max":78.08,"pressure":1021.07,"sea_level":1021.13,"grnd_level":1021.07,"humidity":100,"temp_kf":0},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":88},"wind":{"speed":10.61,"deg":290.001},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-28 21:00:00"},{"dt":1409270400,"main":{"temp":78.08,"temp_min":78.08,"temp_max":78.09,"pressure":1020.65,"sea_level":1021.13,"grnd_level":1020.65,"humidity":100,"temp_kf":0},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04n"}],"clouds":{"all":80},"wind":{"speed":10.28,"deg":269.003},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-29 00:00:00"},{"dt":1409281200,"main":{"temp":75.25,"temp_min":75.25,"temp_max":75.25,"pressure":1023.24,"sea_level":1023.35,"grnd_level":1023.24,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"clouds":{"all":92},"wind":{"speed":10.61,"deg":291.504},"rain":{"3h":3},"sys":{"pod":"d"},"dt_txt":"2014-08-29 03:00:00"},{"dt":1409292000,"main":{"temp":79.18,"temp_min":79.18,"temp_max":79.18,"pressure":1022.36,"sea_level":1022.51,"grnd_level":1022.36,"humidity":100,"temp_kf":0},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":80},"wind":{"speed":14.73,"deg":259.5},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-29 06:00:00"},{"dt":1409302800,"main":{"temp":75.43,"temp_min":75.43,"temp_max":75.43,"pressure":1021.65,"sea_level":1021.58,"grnd_level":1021.65,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"clouds":{"all":92},"wind":{"speed":15.16,"deg":291.501},"rain":{"3h":1},"sys":{"pod":"d"},"dt_txt":"2014-08-29 09:00:00"},{"dt":1409313600,"main":{"temp":77.04,"temp_min":77.04,"temp_max":77.04,"pressure":1021.1,"sea_level":1021.13,"grnd_level":1021.1,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"clouds":{"all":92},"wind":{"speed":11.79,"deg":278.5},"rain":{"3h":2},"sys":{"pod":"d"},"dt_txt":"2014-08-29 12:00:00"},{"dt":1409324400,"main":{"temp":77.22,"temp_min":77.22,"temp_max":77.22,"pressure":1022.64,"sea_level":1022.83,"grnd_level":1022.64,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":14.06,"deg":289.007},"rain":{"3h":1},"sys":{"pod":"n"},"dt_txt":"2014-08-29 15:00:00"},{"dt":1409335200,"main":{"temp":76.48,"temp_min":76.47,"temp_max":76.48,"pressure":1023.36,"sea_level":1023.67,"grnd_level":1023.36,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":13.52,"deg":282.503},"rain":{"3h":1.5},"sys":{"pod":"n"},"dt_txt":"2014-08-29 18:00:00"},{"dt":1409346000,"main":{"temp":73.89,"temp_min":73.89,"temp_max":73.89,"pressure":1022.33,"sea_level":1022.47,"grnd_level":1022.33,"humidity":100,"temp_kf":0},"weather":[{"id":501,"main":"Rain","description":"moderate rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":5.62,"deg":304.001},"rain":{"3h":4},"sys":{"pod":"n"},"dt_txt":"2014-08-29 21:00:00"},{"dt":1409356800,"main":{"temp":72.97,"temp_min":72.97,"temp_max":72.97,"pressure":1022.67,"sea_level":1022.74,"grnd_level":1022.67,"humidity":100,"temp_kf":0},"weather":[{"id":501,"main":"Rain","description":"moderate rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":5.77,"deg":316.502},"rain":{"3h":7.5},"sys":{"pod":"n"},"dt_txt":"2014-08-30 00:00:00"},{"dt":1409367600,"main":{"temp":74.73,"temp_min":74.73,"temp_max":74.73,"pressure":1024.19,"sea_level":1024.21,"grnd_level":1024.19,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"clouds":{"all":68},"wind":{"speed":6.31,"deg":266.001},"rain":{"3h":1},"sys":{"pod":"d"},"dt_txt":"2014-08-30 03:00:00"},{"dt":1409378400,"main":{"temp":77.81,"temp_min":77.8,"temp_max":77.81,"pressure":1024.08,"sea_level":1024.16,"grnd_level":1024.08,"humidity":100,"temp_kf":0},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":68},"wind":{"speed":9.83,"deg":272.506},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-30 06:00:00"},{"dt":1409389200,"main":{"temp":79.99,"temp_min":79.98,"temp_max":79.99,"pressure":1022.18,"sea_level":1022.12,"grnd_level":1022.18,"humidity":100,"temp_kf":0},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":76},"wind":{"speed":13.24,"deg":277.514},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-30 09:00:00"},{"dt":1409400000,"main":{"temp":78.28,"temp_min":78.27,"temp_max":78.28,"pressure":1021.87,"sea_level":1021.83,"grnd_level":1021.87,"humidity":100,"temp_kf":0},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"clouds":{"all":92},"wind":{"speed":15.23,"deg":293.501},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-30 12:00:00"},{"dt":1409410800,"main":{"temp":77.56,"temp_min":77.56,"temp_max":77.56,"pressure":1023,"sea_level":1023.22,"grnd_level":1023,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":10.5,"deg":306.009},"rain":{"3h":1},"sys":{"pod":"n"},"dt_txt":"2014-08-30 15:00:00"},{"dt":1409421600,"main":{"temp":75.47,"temp_min":75.47,"temp_max":75.47,"pressure":1024.61,"sea_level":1024.74,"grnd_level":1024.61,"humidity":100,"temp_kf":0},"weather":[{"id":502,"main":"Rain","description":"heavy intensity rain","icon":"10n"}],"clouds":{"all":68},"wind":{"speed":2.96,"deg":292.501},"rain":{"3h":15},"sys":{"pod":"n"},"dt_txt":"2014-08-30 18:00:00"},{"dt":1409432400,"main":{"temp":77.06,"temp_min":77.06,"temp_max":77.06,"pressure":1021.74,"sea_level":1021.79,"grnd_level":1021.74,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":92},"wind":{"speed":10.71,"deg":302.002},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-30 21:00:00"},{"dt":1409443200,"main":{"temp":77.59,"temp_min":77.59,"temp_max":77.59,"pressure":1021.76,"sea_level":1021.68,"grnd_level":1021.76,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":92},"wind":{"speed":8.9,"deg":292.5},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-31 00:00:00"},{"dt":1409454000,"main":{"temp":78.31,"temp_min":78.31,"temp_max":78.31,"pressure":1022.79,"sea_level":1022.82,"grnd_level":1022.79,"humidity":100},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":64},"wind":{"speed":9.87,"deg":288.51},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-31 03:00:00"},{"dt":1409464800,"main":{"temp":80.87,"temp_min":80.87,"temp_max":80.87,"pressure":1022.96,"sea_level":1022.97,"grnd_level":1022.96,"humidity":99},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":68},"wind":{"speed":13.52,"deg":289.501},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-31 06:00:00"},{"dt":1409475600,"main":{"temp":80.95,"temp_min":80.95,"temp_max":80.95,"pressure":1021.04,"sea_level":1021.29,"grnd_level":1021.04,"humidity":98},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":76},"wind":{"speed":15.49,"deg":289.502},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-31 09:00:00"},{"dt":1409486400,"main":{"temp":80.45,"temp_min":80.45,"temp_max":80.45,"pressure":1020.53,"sea_level":1020.77,"grnd_level":1020.53,"humidity":98},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"clouds":{"all":92},"wind":{"speed":15.57,"deg":292.502},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-31 12:00:00"},{"dt":1409497200,"main":{"temp":78.85,"temp_min":78.85,"temp_max":78.85,"pressure":1021.93,"sea_level":1022.17,"grnd_level":1021.93,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":92},"wind":{"speed":12.68,"deg":291.5},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-31 15:00:00"},{"dt":1409508000,"main":{"temp":74.29,"temp_min":74.29,"temp_max":74.29,"pressure":1022.6,"sea_level":1022.54,"grnd_level":1022.6,"humidity":100},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04n"}],"clouds":{"all":68},"wind":{"speed":9.63,"deg":289.001},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-31 18:00:00"},{"dt":1409518800,"main":{"temp":75.86,"temp_min":75.86,"temp_max":75.86,"pressure":1020.54,"sea_level":1020.5,"grnd_level":1020.54,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":92},"wind":{"speed":9.12,"deg":285.502},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-31 21:00:00"},{"dt":1409529600,"main":{"temp":74.34,"temp_min":74.34,"temp_max":74.34,"pressure":1020.44,"sea_level":1020.69,"grnd_level":1020.44,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":88},"wind":{"speed":4.99,"deg":289.5},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-09-01 00:00:00"},{"dt":1409540400,"main":{"temp":74.71,"temp_min":74.71,"temp_max":74.71,"pressure":1022.21,"sea_level":1022.31,"grnd_level":1022.21,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"clouds":{"all":92},"wind":{"speed":7.71,"deg":254.503},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-09-01 03:00:00"},{"dt":1409551200,"main":{"temp":75.64,"temp_min":75.64,"temp_max":75.64,"pressure":1022.39,"sea_level":1022.46,"grnd_level":1022.39,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"clouds":{"all":92},"wind":{"speed":11.25,"deg":254.002},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-09-01 06:00:00"},{"dt":1409605200,"main":{"temp":73.5,"temp_min":73.5,"temp_max":73.5,"pressure":1020.41,"sea_level":1020.63,"grnd_level":1020.41,"humidity":100},"weather":[{"id":501,"main":"Rain","description":"moderate rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":7.37,"deg":195.001},"rain":{"3h":6},"sys":{"pod":"n"},"dt_txt":"2014-09-01 21:00:00"}]} 45 | http_version: 46 | recorded_at: Thu, 28 Aug 2014 10:52:09 GMT 47 | recorded_with: VCR 2.9.2 48 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/forecast_city_metric_invalid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/forecast?q=,Cochin,%20In&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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Thu, 28 Aug 2014 10:53:21 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - redis 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"cod":"200","message":0.0501,"city":{"id":"1273874","name":"Kochi","coord":{"lon":76.2615,"lat":9.93606},"country":"India","population":0},"cnt":33,"list":[{"dt":1409216400,"main":{"temp":80.22,"temp_min":80.22,"temp_max":80.22,"pressure":1021.68,"sea_level":1023.32,"grnd_level":1021.68,"humidity":100,"temp_kf":0},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":64},"wind":{"speed":10.61,"deg":311.006},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-28 09:00:00"},{"dt":1409227200,"main":{"temp":79.95,"temp_min":79.95,"temp_max":79.96,"pressure":1020.95,"sea_level":1021.19,"grnd_level":1020.95,"humidity":99,"temp_kf":0},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"clouds":{"all":88},"wind":{"speed":11.79,"deg":313.001},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-28 12:00:00"},{"dt":1409238000,"main":{"temp":79.03,"temp_min":79.03,"temp_max":79.04,"pressure":1022.42,"sea_level":1022.56,"grnd_level":1022.42,"humidity":100,"temp_kf":0},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":92},"wind":{"speed":9.44,"deg":307.003},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-28 15:00:00"},{"dt":1409248800,"main":{"temp":79.29,"temp_min":79.29,"temp_max":79.29,"pressure":1023.02,"sea_level":1023.2,"grnd_level":1023.02,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":10.39,"deg":306},"rain":{"3h":2},"sys":{"pod":"n"},"dt_txt":"2014-08-28 18:00:00"},{"dt":1409259600,"main":{"temp":78.08,"temp_min":78.08,"temp_max":78.08,"pressure":1021.07,"sea_level":1021.13,"grnd_level":1021.07,"humidity":100,"temp_kf":0},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":88},"wind":{"speed":10.61,"deg":290.001},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-28 21:00:00"},{"dt":1409270400,"main":{"temp":78.08,"temp_min":78.08,"temp_max":78.09,"pressure":1020.65,"sea_level":1021.13,"grnd_level":1020.65,"humidity":100,"temp_kf":0},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04n"}],"clouds":{"all":80},"wind":{"speed":10.28,"deg":269.003},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-29 00:00:00"},{"dt":1409281200,"main":{"temp":75.25,"temp_min":75.25,"temp_max":75.25,"pressure":1023.24,"sea_level":1023.35,"grnd_level":1023.24,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"clouds":{"all":92},"wind":{"speed":10.61,"deg":291.504},"rain":{"3h":3},"sys":{"pod":"d"},"dt_txt":"2014-08-29 03:00:00"},{"dt":1409292000,"main":{"temp":79.18,"temp_min":79.18,"temp_max":79.18,"pressure":1022.36,"sea_level":1022.51,"grnd_level":1022.36,"humidity":100,"temp_kf":0},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":80},"wind":{"speed":14.73,"deg":259.5},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-29 06:00:00"},{"dt":1409302800,"main":{"temp":75.43,"temp_min":75.43,"temp_max":75.43,"pressure":1021.65,"sea_level":1021.58,"grnd_level":1021.65,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"clouds":{"all":92},"wind":{"speed":15.16,"deg":291.501},"rain":{"3h":1},"sys":{"pod":"d"},"dt_txt":"2014-08-29 09:00:00"},{"dt":1409313600,"main":{"temp":77.04,"temp_min":77.04,"temp_max":77.04,"pressure":1021.1,"sea_level":1021.13,"grnd_level":1021.1,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"clouds":{"all":92},"wind":{"speed":11.79,"deg":278.5},"rain":{"3h":2},"sys":{"pod":"d"},"dt_txt":"2014-08-29 12:00:00"},{"dt":1409324400,"main":{"temp":77.22,"temp_min":77.22,"temp_max":77.22,"pressure":1022.64,"sea_level":1022.83,"grnd_level":1022.64,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":14.06,"deg":289.007},"rain":{"3h":1},"sys":{"pod":"n"},"dt_txt":"2014-08-29 15:00:00"},{"dt":1409335200,"main":{"temp":76.48,"temp_min":76.47,"temp_max":76.48,"pressure":1023.36,"sea_level":1023.67,"grnd_level":1023.36,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":13.52,"deg":282.503},"rain":{"3h":1.5},"sys":{"pod":"n"},"dt_txt":"2014-08-29 18:00:00"},{"dt":1409346000,"main":{"temp":73.89,"temp_min":73.89,"temp_max":73.89,"pressure":1022.33,"sea_level":1022.47,"grnd_level":1022.33,"humidity":100,"temp_kf":0},"weather":[{"id":501,"main":"Rain","description":"moderate rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":5.62,"deg":304.001},"rain":{"3h":4},"sys":{"pod":"n"},"dt_txt":"2014-08-29 21:00:00"},{"dt":1409356800,"main":{"temp":72.97,"temp_min":72.97,"temp_max":72.97,"pressure":1022.67,"sea_level":1022.74,"grnd_level":1022.67,"humidity":100,"temp_kf":0},"weather":[{"id":501,"main":"Rain","description":"moderate rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":5.77,"deg":316.502},"rain":{"3h":7.5},"sys":{"pod":"n"},"dt_txt":"2014-08-30 00:00:00"},{"dt":1409367600,"main":{"temp":74.73,"temp_min":74.73,"temp_max":74.73,"pressure":1024.19,"sea_level":1024.21,"grnd_level":1024.19,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"clouds":{"all":68},"wind":{"speed":6.31,"deg":266.001},"rain":{"3h":1},"sys":{"pod":"d"},"dt_txt":"2014-08-30 03:00:00"},{"dt":1409378400,"main":{"temp":77.81,"temp_min":77.8,"temp_max":77.81,"pressure":1024.08,"sea_level":1024.16,"grnd_level":1024.08,"humidity":100,"temp_kf":0},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":68},"wind":{"speed":9.83,"deg":272.506},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-30 06:00:00"},{"dt":1409389200,"main":{"temp":79.99,"temp_min":79.98,"temp_max":79.99,"pressure":1022.18,"sea_level":1022.12,"grnd_level":1022.18,"humidity":100,"temp_kf":0},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":76},"wind":{"speed":13.24,"deg":277.514},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-30 09:00:00"},{"dt":1409400000,"main":{"temp":78.28,"temp_min":78.27,"temp_max":78.28,"pressure":1021.87,"sea_level":1021.83,"grnd_level":1021.87,"humidity":100,"temp_kf":0},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"clouds":{"all":92},"wind":{"speed":15.23,"deg":293.501},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-30 12:00:00"},{"dt":1409410800,"main":{"temp":77.56,"temp_min":77.56,"temp_max":77.56,"pressure":1023,"sea_level":1023.22,"grnd_level":1023,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":10.5,"deg":306.009},"rain":{"3h":1},"sys":{"pod":"n"},"dt_txt":"2014-08-30 15:00:00"},{"dt":1409421600,"main":{"temp":75.47,"temp_min":75.47,"temp_max":75.47,"pressure":1024.61,"sea_level":1024.74,"grnd_level":1024.61,"humidity":100,"temp_kf":0},"weather":[{"id":502,"main":"Rain","description":"heavy intensity rain","icon":"10n"}],"clouds":{"all":68},"wind":{"speed":2.96,"deg":292.501},"rain":{"3h":15},"sys":{"pod":"n"},"dt_txt":"2014-08-30 18:00:00"},{"dt":1409432400,"main":{"temp":77.06,"temp_min":77.06,"temp_max":77.06,"pressure":1021.74,"sea_level":1021.79,"grnd_level":1021.74,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":92},"wind":{"speed":10.71,"deg":302.002},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-30 21:00:00"},{"dt":1409443200,"main":{"temp":77.59,"temp_min":77.59,"temp_max":77.59,"pressure":1021.76,"sea_level":1021.68,"grnd_level":1021.76,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":92},"wind":{"speed":8.9,"deg":292.5},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-31 00:00:00"},{"dt":1409454000,"main":{"temp":78.31,"temp_min":78.31,"temp_max":78.31,"pressure":1022.79,"sea_level":1022.82,"grnd_level":1022.79,"humidity":100},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":64},"wind":{"speed":9.87,"deg":288.51},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-31 03:00:00"},{"dt":1409464800,"main":{"temp":80.87,"temp_min":80.87,"temp_max":80.87,"pressure":1022.96,"sea_level":1022.97,"grnd_level":1022.96,"humidity":99},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":68},"wind":{"speed":13.52,"deg":289.501},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-31 06:00:00"},{"dt":1409475600,"main":{"temp":80.95,"temp_min":80.95,"temp_max":80.95,"pressure":1021.04,"sea_level":1021.29,"grnd_level":1021.04,"humidity":98},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":76},"wind":{"speed":15.49,"deg":289.502},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-31 09:00:00"},{"dt":1409486400,"main":{"temp":80.45,"temp_min":80.45,"temp_max":80.45,"pressure":1020.53,"sea_level":1020.77,"grnd_level":1020.53,"humidity":98},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"clouds":{"all":92},"wind":{"speed":15.57,"deg":292.502},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-31 12:00:00"},{"dt":1409497200,"main":{"temp":78.85,"temp_min":78.85,"temp_max":78.85,"pressure":1021.93,"sea_level":1022.17,"grnd_level":1021.93,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":92},"wind":{"speed":12.68,"deg":291.5},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-31 15:00:00"},{"dt":1409508000,"main":{"temp":74.29,"temp_min":74.29,"temp_max":74.29,"pressure":1022.6,"sea_level":1022.54,"grnd_level":1022.6,"humidity":100},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04n"}],"clouds":{"all":68},"wind":{"speed":9.63,"deg":289.001},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-31 18:00:00"},{"dt":1409518800,"main":{"temp":75.86,"temp_min":75.86,"temp_max":75.86,"pressure":1020.54,"sea_level":1020.5,"grnd_level":1020.54,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":92},"wind":{"speed":9.12,"deg":285.502},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-31 21:00:00"},{"dt":1409529600,"main":{"temp":74.34,"temp_min":74.34,"temp_max":74.34,"pressure":1020.44,"sea_level":1020.69,"grnd_level":1020.44,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":88},"wind":{"speed":4.99,"deg":289.5},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-09-01 00:00:00"},{"dt":1409540400,"main":{"temp":74.71,"temp_min":74.71,"temp_max":74.71,"pressure":1022.21,"sea_level":1022.31,"grnd_level":1022.21,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"clouds":{"all":92},"wind":{"speed":7.71,"deg":254.503},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-09-01 03:00:00"},{"dt":1409551200,"main":{"temp":75.64,"temp_min":75.64,"temp_max":75.64,"pressure":1022.39,"sea_level":1022.46,"grnd_level":1022.39,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"clouds":{"all":92},"wind":{"speed":11.25,"deg":254.002},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-09-01 06:00:00"},{"dt":1409605200,"main":{"temp":73.5,"temp_min":73.5,"temp_max":73.5,"pressure":1020.41,"sea_level":1020.63,"grnd_level":1020.41,"humidity":100},"weather":[{"id":501,"main":"Rain","description":"moderate rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":7.37,"deg":195.001},"rain":{"3h":6},"sys":{"pod":"n"},"dt_txt":"2014-09-01 21:00:00"}]} 45 | http_version: 46 | recorded_at: Thu, 28 Aug 2014 10:53:20 GMT 47 | recorded_with: VCR 2.9.2 48 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/forecast_city_metric_valid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/forecast?q=,Cochin,%20In&units=metric 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Thu, 28 Aug 2014 10:50:51 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - back 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"cod":"200","message":0.0093,"city":{"id":"1273874","name":"Kochi","coord":{"lon":76.2615,"lat":9.93606},"country":"India","population":0},"cnt":33,"list":[{"dt":1409216400,"main":{"temp":26.64,"temp_min":26.64,"temp_max":26.79,"pressure":1021.68,"sea_level":1023.32,"grnd_level":1021.68,"humidity":100,"temp_kf":-0.15},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":64},"wind":{"speed":4.91,"deg":311.006},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-28 09:00:00"},{"dt":1409227200,"main":{"temp":26.5,"temp_min":26.5,"temp_max":26.64,"pressure":1020.95,"sea_level":1021.19,"grnd_level":1020.95,"humidity":99,"temp_kf":-0.14},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"clouds":{"all":88},"wind":{"speed":5.46,"deg":313.001},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-28 12:00:00"},{"dt":1409238000,"main":{"temp":26,"temp_min":26,"temp_max":26.13,"pressure":1022.42,"sea_level":1022.56,"grnd_level":1022.42,"humidity":100,"temp_kf":-0.13},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":92},"wind":{"speed":4.37,"deg":307.003},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-28 15:00:00"},{"dt":1409248800,"main":{"temp":26.15,"temp_min":26.15,"temp_max":26.27,"pressure":1023.02,"sea_level":1023.2,"grnd_level":1023.02,"humidity":100,"temp_kf":-0.13},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":4.81,"deg":306},"rain":{"3h":2},"sys":{"pod":"n"},"dt_txt":"2014-08-28 18:00:00"},{"dt":1409259600,"main":{"temp":25.48,"temp_min":25.48,"temp_max":25.6,"pressure":1021.07,"sea_level":1021.13,"grnd_level":1021.07,"humidity":100,"temp_kf":-0.12},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":88},"wind":{"speed":4.91,"deg":290.001},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-28 21:00:00"},{"dt":1409270400,"main":{"temp":25.49,"temp_min":25.49,"temp_max":25.6,"pressure":1020.65,"sea_level":1021.13,"grnd_level":1020.65,"humidity":100,"temp_kf":-0.11},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04n"}],"clouds":{"all":80},"wind":{"speed":4.76,"deg":269.003},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-29 00:00:00"},{"dt":1409281200,"main":{"temp":23.92,"temp_min":23.92,"temp_max":24.03,"pressure":1023.24,"sea_level":1023.35,"grnd_level":1023.24,"humidity":100,"temp_kf":-0.1},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"clouds":{"all":92},"wind":{"speed":4.91,"deg":291.504},"rain":{"3h":3},"sys":{"pod":"d"},"dt_txt":"2014-08-29 03:00:00"},{"dt":1409292000,"main":{"temp":26.11,"temp_min":26.11,"temp_max":26.21,"pressure":1022.36,"sea_level":1022.51,"grnd_level":1022.36,"humidity":100,"temp_kf":-0.1},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":80},"wind":{"speed":6.82,"deg":259.5},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-29 06:00:00"},{"dt":1409302800,"main":{"temp":24.04,"temp_min":24.04,"temp_max":24.13,"pressure":1021.65,"sea_level":1021.58,"grnd_level":1021.65,"humidity":100,"temp_kf":-0.09},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"clouds":{"all":92},"wind":{"speed":7.02,"deg":291.501},"rain":{"3h":1},"sys":{"pod":"d"},"dt_txt":"2014-08-29 09:00:00"},{"dt":1409313600,"main":{"temp":24.94,"temp_min":24.94,"temp_max":25.02,"pressure":1021.1,"sea_level":1021.13,"grnd_level":1021.1,"humidity":100,"temp_kf":-0.08},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"clouds":{"all":92},"wind":{"speed":5.46,"deg":278.5},"rain":{"3h":2},"sys":{"pod":"d"},"dt_txt":"2014-08-29 12:00:00"},{"dt":1409324400,"main":{"temp":25.05,"temp_min":25.05,"temp_max":25.12,"pressure":1022.64,"sea_level":1022.83,"grnd_level":1022.64,"humidity":100,"temp_kf":-0.07},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":6.51,"deg":289.007},"rain":{"3h":1},"sys":{"pod":"n"},"dt_txt":"2014-08-29 15:00:00"},{"dt":1409335200,"main":{"temp":24.64,"temp_min":24.64,"temp_max":24.71,"pressure":1023.36,"sea_level":1023.67,"grnd_level":1023.36,"humidity":100,"temp_kf":-0.07},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":6.26,"deg":282.503},"rain":{"3h":1.5},"sys":{"pod":"n"},"dt_txt":"2014-08-29 18:00:00"},{"dt":1409346000,"main":{"temp":23.21,"temp_min":23.21,"temp_max":23.27,"pressure":1022.33,"sea_level":1022.47,"grnd_level":1022.33,"humidity":100,"temp_kf":-0.06},"weather":[{"id":501,"main":"Rain","description":"moderate rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":2.6,"deg":304.001},"rain":{"3h":4},"sys":{"pod":"n"},"dt_txt":"2014-08-29 21:00:00"},{"dt":1409356800,"main":{"temp":22.71,"temp_min":22.71,"temp_max":22.76,"pressure":1022.67,"sea_level":1022.74,"grnd_level":1022.67,"humidity":100,"temp_kf":-0.05},"weather":[{"id":501,"main":"Rain","description":"moderate rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":2.67,"deg":316.502},"rain":{"3h":7.5},"sys":{"pod":"n"},"dt_txt":"2014-08-30 00:00:00"},{"dt":1409367600,"main":{"temp":23.69,"temp_min":23.69,"temp_max":23.74,"pressure":1024.19,"sea_level":1024.21,"grnd_level":1024.19,"humidity":100,"temp_kf":-0.04},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"clouds":{"all":68},"wind":{"speed":2.92,"deg":266.001},"rain":{"3h":1},"sys":{"pod":"d"},"dt_txt":"2014-08-30 03:00:00"},{"dt":1409378400,"main":{"temp":25.41,"temp_min":25.41,"temp_max":25.45,"pressure":1024.08,"sea_level":1024.16,"grnd_level":1024.08,"humidity":100,"temp_kf":-0.04},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":68},"wind":{"speed":4.55,"deg":272.506},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-30 06:00:00"},{"dt":1409389200,"main":{"temp":26.63,"temp_min":26.63,"temp_max":26.66,"pressure":1022.18,"sea_level":1022.12,"grnd_level":1022.18,"humidity":100,"temp_kf":-0.03},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":76},"wind":{"speed":6.13,"deg":277.514},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-30 09:00:00"},{"dt":1409400000,"main":{"temp":25.69,"temp_min":25.69,"temp_max":25.71,"pressure":1021.87,"sea_level":1021.83,"grnd_level":1021.87,"humidity":100,"temp_kf":-0.02},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"clouds":{"all":92},"wind":{"speed":7.05,"deg":293.501},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-30 12:00:00"},{"dt":1409410800,"main":{"temp":25.3,"temp_min":25.3,"temp_max":25.31,"pressure":1023,"sea_level":1023.22,"grnd_level":1023,"humidity":100,"temp_kf":-0.01},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":4.86,"deg":306.009},"rain":{"3h":1},"sys":{"pod":"n"},"dt_txt":"2014-08-30 15:00:00"},{"dt":1409421600,"main":{"temp":24.14,"temp_min":24.14,"temp_max":24.15,"pressure":1024.61,"sea_level":1024.74,"grnd_level":1024.61,"humidity":100,"temp_kf":-0.01},"weather":[{"id":502,"main":"Rain","description":"heavy intensity rain","icon":"10n"}],"clouds":{"all":68},"wind":{"speed":1.37,"deg":292.501},"rain":{"3h":15},"sys":{"pod":"n"},"dt_txt":"2014-08-30 18:00:00"},{"dt":1409432400,"main":{"temp":25.04,"temp_min":25.04,"temp_max":25.04,"pressure":1021.74,"sea_level":1021.79,"grnd_level":1021.74,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":92},"wind":{"speed":4.96,"deg":302.002},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-30 21:00:00"},{"dt":1409443200,"main":{"temp":25.33,"temp_min":25.33,"temp_max":25.33,"pressure":1021.76,"sea_level":1021.68,"grnd_level":1021.76,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":92},"wind":{"speed":4.12,"deg":292.5},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-31 00:00:00"},{"dt":1409454000,"main":{"temp":25.73,"temp_min":25.73,"temp_max":25.73,"pressure":1022.79,"sea_level":1022.82,"grnd_level":1022.79,"humidity":100},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":64},"wind":{"speed":4.57,"deg":288.51},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-31 03:00:00"},{"dt":1409464800,"main":{"temp":27.15,"temp_min":27.15,"temp_max":27.15,"pressure":1022.96,"sea_level":1022.97,"grnd_level":1022.96,"humidity":99},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":68},"wind":{"speed":6.26,"deg":289.501},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-31 06:00:00"},{"dt":1409475600,"main":{"temp":27.2,"temp_min":27.2,"temp_max":27.2,"pressure":1021.04,"sea_level":1021.29,"grnd_level":1021.04,"humidity":98},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":76},"wind":{"speed":7.17,"deg":289.502},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-31 09:00:00"},{"dt":1409486400,"main":{"temp":26.92,"temp_min":26.92,"temp_max":26.92,"pressure":1020.53,"sea_level":1020.77,"grnd_level":1020.53,"humidity":98},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"clouds":{"all":92},"wind":{"speed":7.21,"deg":292.502},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-31 12:00:00"},{"dt":1409497200,"main":{"temp":26.03,"temp_min":26.03,"temp_max":26.03,"pressure":1021.93,"sea_level":1022.17,"grnd_level":1021.93,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":92},"wind":{"speed":5.87,"deg":291.5},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-31 15:00:00"},{"dt":1409508000,"main":{"temp":23.49,"temp_min":23.49,"temp_max":23.49,"pressure":1022.6,"sea_level":1022.54,"grnd_level":1022.6,"humidity":100},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04n"}],"clouds":{"all":68},"wind":{"speed":4.46,"deg":289.001},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-31 18:00:00"},{"dt":1409518800,"main":{"temp":24.36,"temp_min":24.36,"temp_max":24.36,"pressure":1020.54,"sea_level":1020.5,"grnd_level":1020.54,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":92},"wind":{"speed":4.22,"deg":285.502},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-31 21:00:00"},{"dt":1409529600,"main":{"temp":23.52,"temp_min":23.52,"temp_max":23.52,"pressure":1020.44,"sea_level":1020.69,"grnd_level":1020.44,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":88},"wind":{"speed":2.31,"deg":289.5},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-09-01 00:00:00"},{"dt":1409540400,"main":{"temp":23.73,"temp_min":23.73,"temp_max":23.73,"pressure":1022.21,"sea_level":1022.31,"grnd_level":1022.21,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"clouds":{"all":92},"wind":{"speed":3.57,"deg":254.503},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-09-01 03:00:00"},{"dt":1409551200,"main":{"temp":24.24,"temp_min":24.24,"temp_max":24.24,"pressure":1022.39,"sea_level":1022.46,"grnd_level":1022.39,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"clouds":{"all":92},"wind":{"speed":5.21,"deg":254.002},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-09-01 06:00:00"},{"dt":1409605200,"main":{"temp":23.05,"temp_min":23.05,"temp_max":23.05,"pressure":1020.41,"sea_level":1020.63,"grnd_level":1020.41,"humidity":100},"weather":[{"id":501,"main":"Rain","description":"moderate rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":3.41,"deg":195.001},"rain":{"3h":6},"sys":{"pod":"n"},"dt_txt":"2014-09-01 21:00:00"}]} 45 | http_version: 46 | recorded_at: Thu, 28 Aug 2014 10:50:50 GMT 47 | recorded_with: VCR 2.9.2 48 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/forecast_city_valid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/forecast?q=,Cochin,%20In 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Thu, 28 Aug 2014 10:50:50 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - back 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"cod":"200","message":0.0986,"city":{"id":"1273874","name":"Kochi","coord":{"lon":76.2615,"lat":9.93606},"country":"India","population":0},"cnt":33,"list":[{"dt":1409216400,"main":{"temp":299.94,"temp_min":299.94,"temp_max":299.941,"pressure":1021.68,"sea_level":1023.32,"grnd_level":1021.68,"humidity":100,"temp_kf":0},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":64},"wind":{"speed":4.91,"deg":311.006},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-28 09:00:00"},{"dt":1409227200,"main":{"temp":299.79,"temp_min":299.79,"temp_max":299.793,"pressure":1020.95,"sea_level":1021.19,"grnd_level":1020.95,"humidity":99,"temp_kf":0},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"clouds":{"all":88},"wind":{"speed":5.46,"deg":313.001},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-28 12:00:00"},{"dt":1409238000,"main":{"temp":299.28,"temp_min":299.28,"temp_max":299.284,"pressure":1022.42,"sea_level":1022.56,"grnd_level":1022.42,"humidity":100,"temp_kf":0},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":92},"wind":{"speed":4.37,"deg":307.003},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-28 15:00:00"},{"dt":1409248800,"main":{"temp":299.42,"temp_min":299.42,"temp_max":299.423,"pressure":1023.02,"sea_level":1023.2,"grnd_level":1023.02,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":4.81,"deg":306},"rain":{"3h":2},"sys":{"pod":"n"},"dt_txt":"2014-08-28 18:00:00"},{"dt":1409259600,"main":{"temp":298.75,"temp_min":298.748,"temp_max":298.75,"pressure":1021.07,"sea_level":1021.13,"grnd_level":1021.07,"humidity":100,"temp_kf":0},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":88},"wind":{"speed":4.91,"deg":290.001},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-28 21:00:00"},{"dt":1409270400,"main":{"temp":298.75,"temp_min":298.75,"temp_max":298.753,"pressure":1020.65,"sea_level":1021.13,"grnd_level":1020.65,"humidity":100,"temp_kf":0},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04n"}],"clouds":{"all":80},"wind":{"speed":4.76,"deg":269.003},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-29 00:00:00"},{"dt":1409281200,"main":{"temp":297.18,"temp_min":297.177,"temp_max":297.18,"pressure":1023.24,"sea_level":1023.35,"grnd_level":1023.24,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"clouds":{"all":92},"wind":{"speed":4.91,"deg":291.504},"rain":{"3h":3},"sys":{"pod":"d"},"dt_txt":"2014-08-29 03:00:00"},{"dt":1409292000,"main":{"temp":299.36,"temp_min":299.36,"temp_max":299.36,"pressure":1022.36,"sea_level":1022.51,"grnd_level":1022.36,"humidity":100,"temp_kf":0},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":80},"wind":{"speed":6.82,"deg":259.5},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-29 06:00:00"},{"dt":1409302800,"main":{"temp":297.28,"temp_min":297.275,"temp_max":297.28,"pressure":1021.65,"sea_level":1021.58,"grnd_level":1021.65,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"clouds":{"all":92},"wind":{"speed":7.02,"deg":291.501},"rain":{"3h":1},"sys":{"pod":"d"},"dt_txt":"2014-08-29 09:00:00"},{"dt":1409313600,"main":{"temp":298.17,"temp_min":298.17,"temp_max":298.171,"pressure":1021.1,"sea_level":1021.13,"grnd_level":1021.1,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"clouds":{"all":92},"wind":{"speed":5.46,"deg":278.5},"rain":{"3h":2},"sys":{"pod":"d"},"dt_txt":"2014-08-29 12:00:00"},{"dt":1409324400,"main":{"temp":298.27,"temp_min":298.27,"temp_max":298.274,"pressure":1022.64,"sea_level":1022.83,"grnd_level":1022.64,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":6.51,"deg":289.007},"rain":{"3h":1},"sys":{"pod":"n"},"dt_txt":"2014-08-29 15:00:00"},{"dt":1409335200,"main":{"temp":297.86,"temp_min":297.857,"temp_max":297.86,"pressure":1023.36,"sea_level":1023.67,"grnd_level":1023.36,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":6.26,"deg":282.503},"rain":{"3h":1.5},"sys":{"pod":"n"},"dt_txt":"2014-08-29 18:00:00"},{"dt":1409346000,"main":{"temp":296.42,"temp_min":296.42,"temp_max":296.424,"pressure":1022.33,"sea_level":1022.47,"grnd_level":1022.33,"humidity":100,"temp_kf":0},"weather":[{"id":501,"main":"Rain","description":"moderate rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":2.6,"deg":304.001},"rain":{"3h":4},"sys":{"pod":"n"},"dt_txt":"2014-08-29 21:00:00"},{"dt":1409356800,"main":{"temp":295.91,"temp_min":295.91,"temp_max":295.913,"pressure":1022.67,"sea_level":1022.74,"grnd_level":1022.67,"humidity":100,"temp_kf":0},"weather":[{"id":501,"main":"Rain","description":"moderate rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":2.67,"deg":316.502},"rain":{"3h":7.5},"sys":{"pod":"n"},"dt_txt":"2014-08-30 00:00:00"},{"dt":1409367600,"main":{"temp":296.89,"temp_min":296.887,"temp_max":296.89,"pressure":1024.19,"sea_level":1024.21,"grnd_level":1024.19,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"clouds":{"all":68},"wind":{"speed":2.92,"deg":266.001},"rain":{"3h":1},"sys":{"pod":"d"},"dt_txt":"2014-08-30 03:00:00"},{"dt":1409378400,"main":{"temp":298.6,"temp_min":298.596,"temp_max":298.6,"pressure":1024.08,"sea_level":1024.16,"grnd_level":1024.08,"humidity":100,"temp_kf":0},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":68},"wind":{"speed":4.55,"deg":272.506},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-30 06:00:00"},{"dt":1409389200,"main":{"temp":299.81,"temp_min":299.805,"temp_max":299.81,"pressure":1022.18,"sea_level":1022.12,"grnd_level":1022.18,"humidity":100,"temp_kf":0},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":76},"wind":{"speed":6.13,"deg":277.514},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-30 09:00:00"},{"dt":1409400000,"main":{"temp":298.86,"temp_min":298.858,"temp_max":298.86,"pressure":1021.87,"sea_level":1021.83,"grnd_level":1021.87,"humidity":100,"temp_kf":0},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"clouds":{"all":92},"wind":{"speed":7.05,"deg":293.501},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-30 12:00:00"},{"dt":1409410800,"main":{"temp":298.46,"temp_min":298.46,"temp_max":298.46,"pressure":1023,"sea_level":1023.22,"grnd_level":1023,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":4.86,"deg":306.009},"rain":{"3h":1},"sys":{"pod":"n"},"dt_txt":"2014-08-30 15:00:00"},{"dt":1409421600,"main":{"temp":297.3,"temp_min":297.299,"temp_max":297.3,"pressure":1024.61,"sea_level":1024.74,"grnd_level":1024.61,"humidity":100,"temp_kf":0},"weather":[{"id":502,"main":"Rain","description":"heavy intensity rain","icon":"10n"}],"clouds":{"all":68},"wind":{"speed":1.37,"deg":292.501},"rain":{"3h":15},"sys":{"pod":"n"},"dt_txt":"2014-08-30 18:00:00"},{"dt":1409432400,"main":{"temp":298.185,"temp_min":298.185,"temp_max":298.185,"pressure":1021.74,"sea_level":1021.79,"grnd_level":1021.74,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":92},"wind":{"speed":4.96,"deg":302.002},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-30 21:00:00"},{"dt":1409443200,"main":{"temp":298.475,"temp_min":298.475,"temp_max":298.475,"pressure":1021.76,"sea_level":1021.68,"grnd_level":1021.76,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":92},"wind":{"speed":4.12,"deg":292.5},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-31 00:00:00"},{"dt":1409454000,"main":{"temp":298.88,"temp_min":298.88,"temp_max":298.88,"pressure":1022.79,"sea_level":1022.82,"grnd_level":1022.79,"humidity":100},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":64},"wind":{"speed":4.57,"deg":288.51},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-31 03:00:00"},{"dt":1409464800,"main":{"temp":300.302,"temp_min":300.302,"temp_max":300.302,"pressure":1022.96,"sea_level":1022.97,"grnd_level":1022.96,"humidity":99},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":68},"wind":{"speed":6.26,"deg":289.501},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-31 06:00:00"},{"dt":1409475600,"main":{"temp":300.346,"temp_min":300.346,"temp_max":300.346,"pressure":1021.04,"sea_level":1021.29,"grnd_level":1021.04,"humidity":98},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":76},"wind":{"speed":7.17,"deg":289.502},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-31 09:00:00"},{"dt":1409486400,"main":{"temp":300.066,"temp_min":300.066,"temp_max":300.066,"pressure":1020.53,"sea_level":1020.77,"grnd_level":1020.53,"humidity":98},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"clouds":{"all":92},"wind":{"speed":7.21,"deg":292.502},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-31 12:00:00"},{"dt":1409497200,"main":{"temp":299.175,"temp_min":299.175,"temp_max":299.175,"pressure":1021.93,"sea_level":1022.17,"grnd_level":1021.93,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":92},"wind":{"speed":5.87,"deg":291.5},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-31 15:00:00"},{"dt":1409508000,"main":{"temp":296.642,"temp_min":296.642,"temp_max":296.642,"pressure":1022.6,"sea_level":1022.54,"grnd_level":1022.6,"humidity":100},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04n"}],"clouds":{"all":68},"wind":{"speed":4.46,"deg":289.001},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-31 18:00:00"},{"dt":1409518800,"main":{"temp":297.514,"temp_min":297.514,"temp_max":297.514,"pressure":1020.54,"sea_level":1020.5,"grnd_level":1020.54,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":92},"wind":{"speed":4.22,"deg":285.502},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-31 21:00:00"},{"dt":1409529600,"main":{"temp":296.673,"temp_min":296.673,"temp_max":296.673,"pressure":1020.44,"sea_level":1020.69,"grnd_level":1020.44,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":88},"wind":{"speed":2.31,"deg":289.5},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-09-01 00:00:00"},{"dt":1409540400,"main":{"temp":296.879,"temp_min":296.879,"temp_max":296.879,"pressure":1022.21,"sea_level":1022.31,"grnd_level":1022.21,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"clouds":{"all":92},"wind":{"speed":3.57,"deg":254.503},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-09-01 03:00:00"},{"dt":1409551200,"main":{"temp":297.394,"temp_min":297.394,"temp_max":297.394,"pressure":1022.39,"sea_level":1022.46,"grnd_level":1022.39,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"clouds":{"all":92},"wind":{"speed":5.21,"deg":254.002},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-09-01 06:00:00"},{"dt":1409605200,"main":{"temp":296.203,"temp_min":296.203,"temp_max":296.203,"pressure":1020.41,"sea_level":1020.63,"grnd_level":1020.41,"humidity":100},"weather":[{"id":501,"main":"Rain","description":"moderate rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":3.41,"deg":195.001},"rain":{"3h":6},"sys":{"pod":"n"},"dt_txt":"2014-09-01 21:00:00"}]} 45 | http_version: 46 | recorded_at: Thu, 28 Aug 2014 10:50:49 GMT 47 | recorded_with: VCR 2.9.2 48 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/forecast_geocode_valid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/forecast?lat=9.94&lon=76.26 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Thu, 28 Aug 2014 10:50:50 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - back 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"cod":"200","message":0.0387,"city":{"id":1273874,"name":"Cochin","coord":{"lon":76.260223,"lat":9.93988},"country":"IN","population":0},"cnt":33,"list":[{"dt":1409216400,"main":{"temp":299.94,"temp_min":299.94,"temp_max":299.941,"pressure":1021.68,"sea_level":1023.32,"grnd_level":1021.68,"humidity":100,"temp_kf":0},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":64},"wind":{"speed":4.91,"deg":311.006},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-28 09:00:00"},{"dt":1409227200,"main":{"temp":299.79,"temp_min":299.79,"temp_max":299.793,"pressure":1020.95,"sea_level":1021.19,"grnd_level":1020.95,"humidity":99,"temp_kf":0},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"clouds":{"all":88},"wind":{"speed":5.46,"deg":313.001},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-28 12:00:00"},{"dt":1409238000,"main":{"temp":299.28,"temp_min":299.28,"temp_max":299.284,"pressure":1022.42,"sea_level":1022.56,"grnd_level":1022.42,"humidity":100,"temp_kf":0},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":92},"wind":{"speed":4.37,"deg":307.003},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-28 15:00:00"},{"dt":1409248800,"main":{"temp":299.42,"temp_min":299.42,"temp_max":299.423,"pressure":1023.02,"sea_level":1023.2,"grnd_level":1023.02,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":4.81,"deg":306},"rain":{"3h":2},"sys":{"pod":"n"},"dt_txt":"2014-08-28 18:00:00"},{"dt":1409259600,"main":{"temp":298.75,"temp_min":298.748,"temp_max":298.75,"pressure":1021.07,"sea_level":1021.13,"grnd_level":1021.07,"humidity":100,"temp_kf":0},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":88},"wind":{"speed":4.91,"deg":290.001},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-28 21:00:00"},{"dt":1409270400,"main":{"temp":298.75,"temp_min":298.75,"temp_max":298.753,"pressure":1020.65,"sea_level":1021.13,"grnd_level":1020.65,"humidity":100,"temp_kf":0},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04n"}],"clouds":{"all":80},"wind":{"speed":4.76,"deg":269.003},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-29 00:00:00"},{"dt":1409281200,"main":{"temp":297.18,"temp_min":297.177,"temp_max":297.18,"pressure":1023.24,"sea_level":1023.35,"grnd_level":1023.24,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"clouds":{"all":92},"wind":{"speed":4.91,"deg":291.504},"rain":{"3h":3},"sys":{"pod":"d"},"dt_txt":"2014-08-29 03:00:00"},{"dt":1409292000,"main":{"temp":299.36,"temp_min":299.36,"temp_max":299.36,"pressure":1022.36,"sea_level":1022.51,"grnd_level":1022.36,"humidity":100,"temp_kf":0},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":80},"wind":{"speed":6.82,"deg":259.5},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-29 06:00:00"},{"dt":1409302800,"main":{"temp":297.28,"temp_min":297.275,"temp_max":297.28,"pressure":1021.65,"sea_level":1021.58,"grnd_level":1021.65,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"clouds":{"all":92},"wind":{"speed":7.02,"deg":291.501},"rain":{"3h":1},"sys":{"pod":"d"},"dt_txt":"2014-08-29 09:00:00"},{"dt":1409313600,"main":{"temp":298.17,"temp_min":298.17,"temp_max":298.171,"pressure":1021.1,"sea_level":1021.13,"grnd_level":1021.1,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"clouds":{"all":92},"wind":{"speed":5.46,"deg":278.5},"rain":{"3h":2},"sys":{"pod":"d"},"dt_txt":"2014-08-29 12:00:00"},{"dt":1409324400,"main":{"temp":298.27,"temp_min":298.27,"temp_max":298.274,"pressure":1022.64,"sea_level":1022.83,"grnd_level":1022.64,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":6.51,"deg":289.007},"rain":{"3h":1},"sys":{"pod":"n"},"dt_txt":"2014-08-29 15:00:00"},{"dt":1409335200,"main":{"temp":297.86,"temp_min":297.857,"temp_max":297.86,"pressure":1023.36,"sea_level":1023.67,"grnd_level":1023.36,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":6.26,"deg":282.503},"rain":{"3h":1.5},"sys":{"pod":"n"},"dt_txt":"2014-08-29 18:00:00"},{"dt":1409346000,"main":{"temp":296.42,"temp_min":296.42,"temp_max":296.424,"pressure":1022.33,"sea_level":1022.47,"grnd_level":1022.33,"humidity":100,"temp_kf":0},"weather":[{"id":501,"main":"Rain","description":"moderate rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":2.6,"deg":304.001},"rain":{"3h":4},"sys":{"pod":"n"},"dt_txt":"2014-08-29 21:00:00"},{"dt":1409356800,"main":{"temp":295.91,"temp_min":295.91,"temp_max":295.913,"pressure":1022.67,"sea_level":1022.74,"grnd_level":1022.67,"humidity":100,"temp_kf":0},"weather":[{"id":501,"main":"Rain","description":"moderate rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":2.67,"deg":316.502},"rain":{"3h":7.5},"sys":{"pod":"n"},"dt_txt":"2014-08-30 00:00:00"},{"dt":1409367600,"main":{"temp":296.89,"temp_min":296.887,"temp_max":296.89,"pressure":1024.19,"sea_level":1024.21,"grnd_level":1024.19,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"clouds":{"all":68},"wind":{"speed":2.92,"deg":266.001},"rain":{"3h":1},"sys":{"pod":"d"},"dt_txt":"2014-08-30 03:00:00"},{"dt":1409378400,"main":{"temp":298.6,"temp_min":298.596,"temp_max":298.6,"pressure":1024.08,"sea_level":1024.16,"grnd_level":1024.08,"humidity":100,"temp_kf":0},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":68},"wind":{"speed":4.55,"deg":272.506},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-30 06:00:00"},{"dt":1409389200,"main":{"temp":299.81,"temp_min":299.805,"temp_max":299.81,"pressure":1022.18,"sea_level":1022.12,"grnd_level":1022.18,"humidity":100,"temp_kf":0},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":76},"wind":{"speed":6.13,"deg":277.514},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-30 09:00:00"},{"dt":1409400000,"main":{"temp":298.86,"temp_min":298.858,"temp_max":298.86,"pressure":1021.87,"sea_level":1021.83,"grnd_level":1021.87,"humidity":100,"temp_kf":0},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"clouds":{"all":92},"wind":{"speed":7.05,"deg":293.501},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-30 12:00:00"},{"dt":1409410800,"main":{"temp":298.46,"temp_min":298.46,"temp_max":298.46,"pressure":1023,"sea_level":1023.22,"grnd_level":1023,"humidity":100,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":4.86,"deg":306.009},"rain":{"3h":1},"sys":{"pod":"n"},"dt_txt":"2014-08-30 15:00:00"},{"dt":1409421600,"main":{"temp":297.3,"temp_min":297.299,"temp_max":297.3,"pressure":1024.61,"sea_level":1024.74,"grnd_level":1024.61,"humidity":100,"temp_kf":0},"weather":[{"id":502,"main":"Rain","description":"heavy intensity rain","icon":"10n"}],"clouds":{"all":68},"wind":{"speed":1.37,"deg":292.501},"rain":{"3h":15},"sys":{"pod":"n"},"dt_txt":"2014-08-30 18:00:00"},{"dt":1409432400,"main":{"temp":298.185,"temp_min":298.185,"temp_max":298.185,"pressure":1021.74,"sea_level":1021.79,"grnd_level":1021.74,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":92},"wind":{"speed":4.96,"deg":302.002},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-30 21:00:00"},{"dt":1409443200,"main":{"temp":298.475,"temp_min":298.475,"temp_max":298.475,"pressure":1021.76,"sea_level":1021.68,"grnd_level":1021.76,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":92},"wind":{"speed":4.12,"deg":292.5},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-31 00:00:00"},{"dt":1409454000,"main":{"temp":298.88,"temp_min":298.88,"temp_max":298.88,"pressure":1022.79,"sea_level":1022.82,"grnd_level":1022.79,"humidity":100},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":64},"wind":{"speed":4.57,"deg":288.51},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-31 03:00:00"},{"dt":1409464800,"main":{"temp":300.302,"temp_min":300.302,"temp_max":300.302,"pressure":1022.96,"sea_level":1022.97,"grnd_level":1022.96,"humidity":99},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":68},"wind":{"speed":6.26,"deg":289.501},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-31 06:00:00"},{"dt":1409475600,"main":{"temp":300.346,"temp_min":300.346,"temp_max":300.346,"pressure":1021.04,"sea_level":1021.29,"grnd_level":1021.04,"humidity":98},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":76},"wind":{"speed":7.17,"deg":289.502},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-31 09:00:00"},{"dt":1409486400,"main":{"temp":300.066,"temp_min":300.066,"temp_max":300.066,"pressure":1020.53,"sea_level":1020.77,"grnd_level":1020.53,"humidity":98},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"clouds":{"all":92},"wind":{"speed":7.21,"deg":292.502},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-31 12:00:00"},{"dt":1409497200,"main":{"temp":299.175,"temp_min":299.175,"temp_max":299.175,"pressure":1021.93,"sea_level":1022.17,"grnd_level":1021.93,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":92},"wind":{"speed":5.87,"deg":291.5},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-31 15:00:00"},{"dt":1409508000,"main":{"temp":296.642,"temp_min":296.642,"temp_max":296.642,"pressure":1022.6,"sea_level":1022.54,"grnd_level":1022.6,"humidity":100},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04n"}],"clouds":{"all":68},"wind":{"speed":4.46,"deg":289.001},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-31 18:00:00"},{"dt":1409518800,"main":{"temp":297.514,"temp_min":297.514,"temp_max":297.514,"pressure":1020.54,"sea_level":1020.5,"grnd_level":1020.54,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":92},"wind":{"speed":4.22,"deg":285.502},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-31 21:00:00"},{"dt":1409529600,"main":{"temp":296.673,"temp_min":296.673,"temp_max":296.673,"pressure":1020.44,"sea_level":1020.69,"grnd_level":1020.44,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":88},"wind":{"speed":2.31,"deg":289.5},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-09-01 00:00:00"},{"dt":1409540400,"main":{"temp":296.879,"temp_min":296.879,"temp_max":296.879,"pressure":1022.21,"sea_level":1022.31,"grnd_level":1022.21,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"clouds":{"all":92},"wind":{"speed":3.57,"deg":254.503},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-09-01 03:00:00"},{"dt":1409551200,"main":{"temp":297.394,"temp_min":297.394,"temp_max":297.394,"pressure":1022.39,"sea_level":1022.46,"grnd_level":1022.39,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"clouds":{"all":92},"wind":{"speed":5.21,"deg":254.002},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-09-01 06:00:00"},{"dt":1409605200,"main":{"temp":296.203,"temp_min":296.203,"temp_max":296.203,"pressure":1020.41,"sea_level":1020.63,"grnd_level":1020.41,"humidity":100},"weather":[{"id":501,"main":"Rain","description":"moderate rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":3.41,"deg":195.001},"rain":{"3h":6},"sys":{"pod":"n"},"dt_txt":"2014-09-01 21:00:00"}]} 45 | http_version: 46 | recorded_at: Thu, 28 Aug 2014 10:50:50 GMT 47 | recorded_with: VCR 2.9.2 48 | -------------------------------------------------------------------------------- /spec/fixtures/cassettes/api/forecast_city_id_valid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://api.openweathermap.org/data/2.5/forecast?id=1273874 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 | Host: 17 | - api.openweathermap.org 18 | response: 19 | status: 20 | code: 200 21 | message: OK 22 | headers: 23 | Server: 24 | - nginx 25 | Date: 26 | - Thu, 28 Aug 2014 10:50:50 GMT 27 | Content-Type: 28 | - application/json; charset=utf-8 29 | Transfer-Encoding: 30 | - chunked 31 | Connection: 32 | - keep-alive 33 | X-Source: 34 | - back 35 | Access-Control-Allow-Origin: 36 | - "*" 37 | Access-Control-Allow-Credentials: 38 | - 'true' 39 | Access-Control-Allow-Methods: 40 | - GET, POST 41 | body: 42 | encoding: UTF-8 43 | string: | 44 | {"cod":"200","message":0.0726,"city":{"id":1273874,"name":"Cochin","coord":{"lon":76.260223,"lat":9.93988},"country":"IN","population":604696},"cnt":33,"list":[{"dt":1409216400,"main":{"temp":299.79,"temp_min":299.79,"temp_max":299.941,"pressure":1021.68,"sea_level":1023.32,"grnd_level":1021.68,"humidity":100,"temp_kf":-0.15},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":64},"wind":{"speed":4.91,"deg":311.006},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-28 09:00:00"},{"dt":1409227200,"main":{"temp":299.65,"temp_min":299.65,"temp_max":299.793,"pressure":1020.95,"sea_level":1021.19,"grnd_level":1020.95,"humidity":99,"temp_kf":-0.14},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"clouds":{"all":88},"wind":{"speed":5.46,"deg":313.001},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-28 12:00:00"},{"dt":1409238000,"main":{"temp":299.15,"temp_min":299.15,"temp_max":299.284,"pressure":1022.42,"sea_level":1022.56,"grnd_level":1022.42,"humidity":100,"temp_kf":-0.13},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":92},"wind":{"speed":4.37,"deg":307.003},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-28 15:00:00"},{"dt":1409248800,"main":{"temp":299.3,"temp_min":299.3,"temp_max":299.423,"pressure":1023.02,"sea_level":1023.2,"grnd_level":1023.02,"humidity":100,"temp_kf":-0.13},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":4.81,"deg":306},"rain":{"3h":2},"sys":{"pod":"n"},"dt_txt":"2014-08-28 18:00:00"},{"dt":1409259600,"main":{"temp":298.63,"temp_min":298.63,"temp_max":298.748,"pressure":1021.07,"sea_level":1021.13,"grnd_level":1021.07,"humidity":100,"temp_kf":-0.12},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":88},"wind":{"speed":4.91,"deg":290.001},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-28 21:00:00"},{"dt":1409270400,"main":{"temp":298.64,"temp_min":298.64,"temp_max":298.753,"pressure":1020.65,"sea_level":1021.13,"grnd_level":1020.65,"humidity":100,"temp_kf":-0.11},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04n"}],"clouds":{"all":80},"wind":{"speed":4.76,"deg":269.003},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-29 00:00:00"},{"dt":1409281200,"main":{"temp":297.07,"temp_min":297.07,"temp_max":297.177,"pressure":1023.24,"sea_level":1023.35,"grnd_level":1023.24,"humidity":100,"temp_kf":-0.1},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"clouds":{"all":92},"wind":{"speed":4.91,"deg":291.504},"rain":{"3h":3},"sys":{"pod":"d"},"dt_txt":"2014-08-29 03:00:00"},{"dt":1409292000,"main":{"temp":299.26,"temp_min":299.26,"temp_max":299.36,"pressure":1022.36,"sea_level":1022.51,"grnd_level":1022.36,"humidity":100,"temp_kf":-0.1},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":80},"wind":{"speed":6.82,"deg":259.5},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-29 06:00:00"},{"dt":1409302800,"main":{"temp":297.19,"temp_min":297.19,"temp_max":297.275,"pressure":1021.65,"sea_level":1021.58,"grnd_level":1021.65,"humidity":100,"temp_kf":-0.09},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"clouds":{"all":92},"wind":{"speed":7.02,"deg":291.501},"rain":{"3h":1},"sys":{"pod":"d"},"dt_txt":"2014-08-29 09:00:00"},{"dt":1409313600,"main":{"temp":298.09,"temp_min":298.09,"temp_max":298.171,"pressure":1021.1,"sea_level":1021.13,"grnd_level":1021.1,"humidity":100,"temp_kf":-0.08},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"clouds":{"all":92},"wind":{"speed":5.46,"deg":278.5},"rain":{"3h":2},"sys":{"pod":"d"},"dt_txt":"2014-08-29 12:00:00"},{"dt":1409324400,"main":{"temp":298.2,"temp_min":298.2,"temp_max":298.274,"pressure":1022.64,"sea_level":1022.83,"grnd_level":1022.64,"humidity":100,"temp_kf":-0.07},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":6.51,"deg":289.007},"rain":{"3h":1},"sys":{"pod":"n"},"dt_txt":"2014-08-29 15:00:00"},{"dt":1409335200,"main":{"temp":297.79,"temp_min":297.79,"temp_max":297.857,"pressure":1023.36,"sea_level":1023.67,"grnd_level":1023.36,"humidity":100,"temp_kf":-0.07},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":6.26,"deg":282.503},"rain":{"3h":1.5},"sys":{"pod":"n"},"dt_txt":"2014-08-29 18:00:00"},{"dt":1409346000,"main":{"temp":296.36,"temp_min":296.36,"temp_max":296.424,"pressure":1022.33,"sea_level":1022.47,"grnd_level":1022.33,"humidity":100,"temp_kf":-0.06},"weather":[{"id":501,"main":"Rain","description":"moderate rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":2.6,"deg":304.001},"rain":{"3h":4},"sys":{"pod":"n"},"dt_txt":"2014-08-29 21:00:00"},{"dt":1409356800,"main":{"temp":295.86,"temp_min":295.86,"temp_max":295.913,"pressure":1022.67,"sea_level":1022.74,"grnd_level":1022.67,"humidity":100,"temp_kf":-0.05},"weather":[{"id":501,"main":"Rain","description":"moderate rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":2.67,"deg":316.502},"rain":{"3h":7.5},"sys":{"pod":"n"},"dt_txt":"2014-08-30 00:00:00"},{"dt":1409367600,"main":{"temp":296.84,"temp_min":296.84,"temp_max":296.887,"pressure":1024.19,"sea_level":1024.21,"grnd_level":1024.19,"humidity":100,"temp_kf":-0.04},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"clouds":{"all":68},"wind":{"speed":2.92,"deg":266.001},"rain":{"3h":1},"sys":{"pod":"d"},"dt_txt":"2014-08-30 03:00:00"},{"dt":1409378400,"main":{"temp":298.56,"temp_min":298.56,"temp_max":298.596,"pressure":1024.08,"sea_level":1024.16,"grnd_level":1024.08,"humidity":100,"temp_kf":-0.04},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":68},"wind":{"speed":4.55,"deg":272.506},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-30 06:00:00"},{"dt":1409389200,"main":{"temp":299.78,"temp_min":299.78,"temp_max":299.805,"pressure":1022.18,"sea_level":1022.12,"grnd_level":1022.18,"humidity":100,"temp_kf":-0.03},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":76},"wind":{"speed":6.13,"deg":277.514},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-30 09:00:00"},{"dt":1409400000,"main":{"temp":298.84,"temp_min":298.84,"temp_max":298.858,"pressure":1021.87,"sea_level":1021.83,"grnd_level":1021.87,"humidity":100,"temp_kf":-0.02},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"clouds":{"all":92},"wind":{"speed":7.05,"deg":293.501},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-30 12:00:00"},{"dt":1409410800,"main":{"temp":298.45,"temp_min":298.45,"temp_max":298.46,"pressure":1023,"sea_level":1023.22,"grnd_level":1023,"humidity":100,"temp_kf":-0.01},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":4.86,"deg":306.009},"rain":{"3h":1},"sys":{"pod":"n"},"dt_txt":"2014-08-30 15:00:00"},{"dt":1409421600,"main":{"temp":297.29,"temp_min":297.29,"temp_max":297.299,"pressure":1024.61,"sea_level":1024.74,"grnd_level":1024.61,"humidity":100,"temp_kf":-0.01},"weather":[{"id":502,"main":"Rain","description":"heavy intensity rain","icon":"10n"}],"clouds":{"all":68},"wind":{"speed":1.37,"deg":292.501},"rain":{"3h":15},"sys":{"pod":"n"},"dt_txt":"2014-08-30 18:00:00"},{"dt":1409432400,"main":{"temp":298.185,"temp_min":298.185,"temp_max":298.185,"pressure":1021.74,"sea_level":1021.79,"grnd_level":1021.74,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":92},"wind":{"speed":4.96,"deg":302.002},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-30 21:00:00"},{"dt":1409443200,"main":{"temp":298.475,"temp_min":298.475,"temp_max":298.475,"pressure":1021.76,"sea_level":1021.68,"grnd_level":1021.76,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":92},"wind":{"speed":4.12,"deg":292.5},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-31 00:00:00"},{"dt":1409454000,"main":{"temp":298.88,"temp_min":298.88,"temp_max":298.88,"pressure":1022.79,"sea_level":1022.82,"grnd_level":1022.79,"humidity":100},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":64},"wind":{"speed":4.57,"deg":288.51},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-31 03:00:00"},{"dt":1409464800,"main":{"temp":300.302,"temp_min":300.302,"temp_max":300.302,"pressure":1022.96,"sea_level":1022.97,"grnd_level":1022.96,"humidity":99},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":68},"wind":{"speed":6.26,"deg":289.501},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-31 06:00:00"},{"dt":1409475600,"main":{"temp":300.346,"temp_min":300.346,"temp_max":300.346,"pressure":1021.04,"sea_level":1021.29,"grnd_level":1021.04,"humidity":98},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"clouds":{"all":76},"wind":{"speed":7.17,"deg":289.502},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-31 09:00:00"},{"dt":1409486400,"main":{"temp":300.066,"temp_min":300.066,"temp_max":300.066,"pressure":1020.53,"sea_level":1020.77,"grnd_level":1020.53,"humidity":98},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"clouds":{"all":92},"wind":{"speed":7.21,"deg":292.502},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-08-31 12:00:00"},{"dt":1409497200,"main":{"temp":299.175,"temp_min":299.175,"temp_max":299.175,"pressure":1021.93,"sea_level":1022.17,"grnd_level":1021.93,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":92},"wind":{"speed":5.87,"deg":291.5},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-31 15:00:00"},{"dt":1409508000,"main":{"temp":296.642,"temp_min":296.642,"temp_max":296.642,"pressure":1022.6,"sea_level":1022.54,"grnd_level":1022.6,"humidity":100},"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04n"}],"clouds":{"all":68},"wind":{"speed":4.46,"deg":289.001},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-31 18:00:00"},{"dt":1409518800,"main":{"temp":297.514,"temp_min":297.514,"temp_max":297.514,"pressure":1020.54,"sea_level":1020.5,"grnd_level":1020.54,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":92},"wind":{"speed":4.22,"deg":285.502},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-08-31 21:00:00"},{"dt":1409529600,"main":{"temp":296.673,"temp_min":296.673,"temp_max":296.673,"pressure":1020.44,"sea_level":1020.69,"grnd_level":1020.44,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":88},"wind":{"speed":2.31,"deg":289.5},"rain":{"3h":0},"sys":{"pod":"n"},"dt_txt":"2014-09-01 00:00:00"},{"dt":1409540400,"main":{"temp":296.879,"temp_min":296.879,"temp_max":296.879,"pressure":1022.21,"sea_level":1022.31,"grnd_level":1022.21,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"clouds":{"all":92},"wind":{"speed":3.57,"deg":254.503},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-09-01 03:00:00"},{"dt":1409551200,"main":{"temp":297.394,"temp_min":297.394,"temp_max":297.394,"pressure":1022.39,"sea_level":1022.46,"grnd_level":1022.39,"humidity":100},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"clouds":{"all":92},"wind":{"speed":5.21,"deg":254.002},"rain":{"3h":0},"sys":{"pod":"d"},"dt_txt":"2014-09-01 06:00:00"},{"dt":1409605200,"main":{"temp":296.203,"temp_min":296.203,"temp_max":296.203,"pressure":1020.41,"sea_level":1020.63,"grnd_level":1020.41,"humidity":100},"weather":[{"id":501,"main":"Rain","description":"moderate rain","icon":"10n"}],"clouds":{"all":92},"wind":{"speed":3.41,"deg":195.001},"rain":{"3h":6},"sys":{"pod":"n"},"dt_txt":"2014-09-01 21:00:00"}]} 45 | http_version: 46 | recorded_at: Thu, 28 Aug 2014 10:50:49 GMT 47 | recorded_with: VCR 2.9.2 48 | --------------------------------------------------------------------------------