diff --git a/lib/open_weather/connection.rb b/lib/open_weather/connection.rb index aba20a4..74965bc 100644 --- a/lib/open_weather/connection.rb +++ b/lib/open_weather/connection.rb @@ -19,7 +19,7 @@ def connection options[:headers]['User-Agent'] = user_agent if user_agent options[:proxy] = proxy if proxy - options[:ssl] = { ca_path:, ca_file: } if ca_path || ca_file + options[:ssl] = { ca_path: ca_path, ca_file: ca_file } if ca_path || ca_file request_options = {} request_options[:timeout] = timeout if timeout diff --git a/lib/open_weather/endpoints/current.rb b/lib/open_weather/endpoints/current.rb index d09f75d..cebb705 100644 --- a/lib/open_weather/endpoints/current.rb +++ b/lib/open_weather/endpoints/current.rb @@ -4,22 +4,22 @@ module OpenWeather module Endpoints module Current def current_zip(code, country = nil, options = {}) - options = code.is_a?(Hash) ? options.merge(code) : options.merge(zip: code, country:) + options = code.is_a?(Hash) ? options.merge(code) : options.merge(zip: code, country: country) current_weather(options) end def current_geo(lat, lon = nil, options = {}) - options = lat.is_a?(Hash) ? options.merge(lat) : options.merge(lat:, lon:) + options = lat.is_a?(Hash) ? options.merge(lat) : options.merge(lat: lat, lon: lon) current_weather(options) end def current_city(name, state = nil, country = nil, options = {}) - options = name.is_a?(Hash) ? options.merge(name) : options.merge(city: name, state:, country:) + options = name.is_a?(Hash) ? options.merge(name) : options.merge(city: name, state: state, country: country) current_weather(options) end def current_city_id(id, options = {}) - options = id.is_a?(Hash) ? options.merge(id) : options.merge(id:) + options = id.is_a?(Hash) ? options.merge(id) : options.merge(id: id) current_weather(options) end diff --git a/lib/open_weather/endpoints/hourly.rb b/lib/open_weather/endpoints/hourly.rb index 3bf2cef..8ab9463 100644 --- a/lib/open_weather/endpoints/hourly.rb +++ b/lib/open_weather/endpoints/hourly.rb @@ -6,9 +6,9 @@ module Hourly def hourly(lat, lon = nil, options = {}) # default to the pro endpoint if not specified endpoint = options.delete(:endpoint) || pro_endpoint - options = options.merge(endpoint:) + options = options.merge(endpoint: endpoint) - options = lat.is_a?(Hash) ? options.merge(lat) : options.merge(lat:, lon:) + options = lat.is_a?(Hash) ? options.merge(lat) : options.merge(lat: lat, lon: lon) OpenWeather::Models::Forecast::Hourly.new(get('2.5/forecast/hourly', options), options) end end diff --git a/lib/open_weather/endpoints/one_call.rb b/lib/open_weather/endpoints/one_call.rb index 8310932..38c793a 100644 --- a/lib/open_weather/endpoints/one_call.rb +++ b/lib/open_weather/endpoints/one_call.rb @@ -4,7 +4,7 @@ module OpenWeather module Endpoints module OneCall def one_call(lat, lon = nil, options = {}) - options = lat.is_a?(Hash) ? options.merge(lat) : options.merge(lat:, lon:) + options = lat.is_a?(Hash) ? options.merge(lat) : options.merge(lat: lat, lon: lon) options[:exclude] = options[:exclude].join(',') if options[:exclude].is_a?(Array) options[:dt] = options[:dt].to_i if options[:dt].is_a?(Time) path = options.key?(:dt) ? '3.0/onecall/timemachine' : '3.0/onecall' diff --git a/lib/open_weather/raise_error.rb b/lib/open_weather/raise_error.rb index 5dbcba0..6677953 100644 --- a/lib/open_weather/raise_error.rb +++ b/lib/open_weather/raise_error.rb @@ -10,7 +10,7 @@ def on_complete(env) when 407 # mimic the behavior that we get with proxy requests with HTTPS raise Faraday::ConnectionFailed, %(407 "Proxy Authentication Required ") - when (400...600) + when (400...600).freeze raise OpenWeather::Errors::Fault, response_values(env) end end diff --git a/spec/lib/open_weather/models/station_spec.rb b/spec/lib/open_weather/models/station_spec.rb index d013f25..a4f78fc 100644 --- a/spec/lib/open_weather/models/station_spec.rb +++ b/spec/lib/open_weather/models/station_spec.rb @@ -60,7 +60,7 @@ .with(id) .and_call_original - model = OpenWeather::Models::Station.new(id:) + model = OpenWeather::Models::Station.new(id: id) result = model.delete! expect(result).to be_nil end