From 6a044fc4a90fc7053ad7d788ad38e5ed9477a346 Mon Sep 17 00:00:00 2001 From: Troy Anderson Date: Tue, 2 Jul 2024 15:56:10 -0700 Subject: [PATCH] Rubocop autocorrections --- lib/open_weather/connection.rb | 2 +- lib/open_weather/endpoints/current.rb | 8 ++++---- lib/open_weather/endpoints/one_call.rb | 2 +- lib/open_weather/raise_error.rb | 2 +- spec/lib/open_weather/models/station_spec.rb | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/open_weather/connection.rb b/lib/open_weather/connection.rb index 74965bc..aba20a4 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_path, ca_file: ca_file } if ca_path || ca_file + options[:ssl] = { ca_path:, 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 cebb705..d09f75d 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: country) + options = code.is_a?(Hash) ? options.merge(code) : options.merge(zip: code, country:) current_weather(options) end def current_geo(lat, lon = nil, options = {}) - options = lat.is_a?(Hash) ? options.merge(lat) : options.merge(lat: lat, lon: lon) + options = lat.is_a?(Hash) ? options.merge(lat) : options.merge(lat:, 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: state, country: country) + options = name.is_a?(Hash) ? options.merge(name) : options.merge(city: name, state:, country:) current_weather(options) end def current_city_id(id, options = {}) - options = id.is_a?(Hash) ? options.merge(id) : options.merge(id: id) + options = id.is_a?(Hash) ? options.merge(id) : options.merge(id:) current_weather(options) end diff --git a/lib/open_weather/endpoints/one_call.rb b/lib/open_weather/endpoints/one_call.rb index 38c793a..8310932 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: lat, lon: lon) + options = lat.is_a?(Hash) ? options.merge(lat) : options.merge(lat:, 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 6677953..5dbcba0 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).freeze + when (400...600) 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 a4f78fc..d013f25 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: id) + model = OpenWeather::Models::Station.new(id:) result = model.delete! expect(result).to be_nil end