Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using TLS connection #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/open_weather/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def cities(ids, options = {})
raise LocationsLimitExceeded
end

url = 'http://api.openweathermap.org/data/2.5/group'
url = Base::API_URL + '/group'
ids = encode_array ids
new(options.merge(id: ids)).retrieve url
end
Expand All @@ -44,7 +44,7 @@ def cities(ids, options = {})
def rectangle_zone(top_left_lat, top_left_lon,
bottom_right_lat, bottom_right_lon,
map_zoom, options = {})
url = 'http://api.openweathermap.org/data/2.5/box/city'
url = Base::API_URL + '/box/city'
bbox = encode_array [top_left_lat, top_left_lon, bottom_right_lat,
bottom_right_lon, map_zoom]
new(options.merge(bbox: bbox)).retrieve url
Expand All @@ -53,7 +53,7 @@ def rectangle_zone(top_left_lat, top_left_lon,
# Circle zone (lat, lon and count of cities to return)
# Usage: OpenWeather::Current.circle_zone(55.5, 37.5, 10)
def circle_zone(lat, lon, count, options = {})
url = 'http://api.openweathermap.org/data/2.5/find'
url = Base::API_URL + '/find'
new(options.merge(lat: lat, lon: lon, cnt: count)).retrieve url
end

Expand Down
3 changes: 2 additions & 1 deletion lib/open_weather/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

module OpenWeather
class Base

API_URL = 'https://api.openweathermap.org/data/2.5'

attr_reader :url, :options, :weather_info, :status, :message

def initialize(url, options)
Expand Down
2 changes: 1 addition & 1 deletion lib/open_weather/current.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module OpenWeather
class Current < Base
def initialize(options = {})
super('http://api.openweathermap.org/data/2.5/weather', options)
super(API_URL + '/weather', options)
end
end
end
2 changes: 1 addition & 1 deletion lib/open_weather/find.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module OpenWeather
class Find < Base
def initialize(options = {})
super('http://api.openweathermap.org/data/2.5/find', options)
super(API_URL + '/find', options)
end

def self.like(q, options = {})
Expand Down
2 changes: 1 addition & 1 deletion lib/open_weather/forecast.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module OpenWeather
class Forecast < Base
def initialize options = {}
super('http://api.openweathermap.org/data/2.5/forecast', options)
super(API_URL + '/forecast', options)
end
end
end
2 changes: 1 addition & 1 deletion lib/open_weather/forecast_daily.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module OpenWeather
class ForecastDaily < Base
def initialize options = {}
super('http://api.openweathermap.org/data/2.5/forecast/daily', options)
super(API_URL + '/forecast/daily', options)
end
end
end