From a7fb78c16c5236802aa76f21e84edde9809fafa1 Mon Sep 17 00:00:00 2001 From: Sunny Ripert Date: Mon, 20 Mar 2023 11:00:34 +0100 Subject: [PATCH 01/11] Move CI to GitHub Actions --- .github/workflows/danger.yml | 19 +++++++++++++++++++ .github/workflows/rubocop.yml | 15 +++++++++++++++ .github/workflows/test.yml | 25 +++++++++++++++++++++++++ .rubocop_todo.yml | 33 ++++++++++++++++++++++++++++----- .travis.yml | 9 --------- CONTRIBUTING.md | 2 +- Gemfile | 2 +- README.md | 1 - RELEASING.md | 2 +- 9 files changed, 90 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/danger.yml create mode 100644 .github/workflows/rubocop.yml create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml new file mode 100644 index 0000000..9198446 --- /dev/null +++ b/.github/workflows/danger.yml @@ -0,0 +1,19 @@ +name: PR Linter +on: [pull_request] +jobs: + danger: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + ruby-version: 3.1 + - run: | + # the personal token is public, this is ok, base64 encode to avoid tripping Github + TOKEN=$(echo -n NWY1ZmM5MzEyMzNlYWY4OTZiOGU3MmI3MWQ3Mzk0MzgxMWE4OGVmYwo= | base64 --decode) + DANGER_GITHUB_API_TOKEN=$TOKEN bundle exec danger --verbose + diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml new file mode 100644 index 0000000..571aa08 --- /dev/null +++ b/.github/workflows/rubocop.yml @@ -0,0 +1,15 @@ +name: RuboCop +on: [push, pull_request] +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.1 + bundler-cache: true + - name: Run RuboCop + run: bundle exec rubocop + diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..a8f74bc --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,25 @@ +name: Tests +on: [push, pull_request] +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + entry: + - { ruby: "2.7" } + - { ruby: "3.0" } + - { ruby: "3.1" } + - { ruby: ruby-head, ignore: true } + - { ruby: jruby-head, ignore: true } + name: Test (ruby=${{ matrix.entry.ruby }}) + steps: + - uses: actions/checkout@v2 + - name: Install Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + ruby-version: ${{ matrix.entry.ruby }} + - name: Run Tests + continue-on-error: ${{ matrix.entry.ignore || false }} + run: bundle exec rspec + diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 3552c84..d65d3e8 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,21 +1,44 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2020-05-15 23:25:38 -0400 using RuboCop version 0.81.0. +# on 2023-03-20 09:58:58 UTC using RuboCop version 1.48.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. # Offense count: 1 -# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms. +# Configuration parameters: Severity, Include. +# Include: **/*.gemspec +Gemspec/RequiredRubyVersion: + Exclude: + - 'open-weather-ruby-client.gemspec' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: AllowedMethods. +# AllowedMethods: instance_of?, kind_of?, is_a?, eql?, respond_to?, equal? +Lint/RedundantSafeNavigation: + Exclude: + - 'lib/open_weather/endpoints/stations.rb' + +# Offense count: 1 +# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms. +# CheckDefinitionPathHierarchyRoots: lib, spec, test, src # AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS Naming/FileName: Exclude: - 'lib/open-weather-ruby-client.rb' -# Offense count: 76 -# Cop supports --auto-correct. -# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. +# Offense count: 2 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/GlobalStdStream: + Exclude: + - 'lib/open_weather/logger.rb' + - 'spec/open_weather/client_spec.rb' + +# Offense count: 7 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. # URISchemes: http, https Layout/LineLength: Max: 181 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8882f18..0000000 --- a/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -language: ruby - -cache: bundler - -rvm: - - 2.6.6 - -before_script: - - bundle exec danger diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6a7d61b..e27623d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -114,7 +114,7 @@ git push origin my-feature-branch -f ### Check on Your Pull Request -Go back to your pull request after a few minutes and see whether it passed muster with Travis-CI. Everything should look green, otherwise fix issues and amend your commit as described above. +Go back to your pull request after a few minutes and see whether it passed muster with GitHub Actions. Everything should look green, otherwise fix issues and amend your commit as described above. ### Be Patient diff --git a/Gemfile b/Gemfile index f83280a..0a417e0 100644 --- a/Gemfile +++ b/Gemfile @@ -11,7 +11,7 @@ group :development, :test do gem 'pry' gem 'rake' gem 'rspec' - gem 'rubocop', '~> 0.81.0' + gem 'rubocop', '~> 1.48.1' gem 'vcr' gem 'webmock' end diff --git a/README.md b/README.md index c7573d9..abe3f0f 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,6 @@ OpenWeather Ruby Client ======================= [![Gem Version](https://badge.fury.io/rb/open-weather-ruby-client.svg)](https://badge.fury.io/rb/open-weather-ruby-client) -[![Build Status](https://travis-ci.org/dblock/open-weather-ruby-client.svg?branch=master)](https://travis-ci.org/dblock/open-weather-ruby-client) A Ruby client for the [OpenWeather API v2.5 and v3.0](https://openweathermap.org/api). diff --git a/RELEASING.md b/RELEASING.md index 9de534a..bda68ae 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -11,7 +11,7 @@ bundle install rake ``` -Check that the last build succeeded in [Travis CI](https://travis-ci.org/dblock/open-weather-ruby-client) for all supported platforms. +Check that the last build succeeded in GitHub Actions for all supported platforms. Change "Next" in [CHANGELOG.md](CHANGELOG.md) to the current date. From f727b8155801f40a9cb2776cfce14ea41c66ce1e Mon Sep 17 00:00:00 2001 From: Sunny Ripert Date: Mon, 20 Mar 2023 11:11:17 +0100 Subject: [PATCH 02/11] Missing params in spec --- spec/open_weather/endpoints/stations_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/open_weather/endpoints/stations_spec.rb b/spec/open_weather/endpoints/stations_spec.rb index 1ad56bb..f25fb22 100644 --- a/spec/open_weather/endpoints/stations_spec.rb +++ b/spec/open_weather/endpoints/stations_spec.rb @@ -114,7 +114,7 @@ } expect(client).to receive(:post) - .with('3.0/measurements', body: [create_params]) + .with('3.0/measurements', { body: [create_params] }) .and_call_original data = client.create_measurements([create_params]) From 7d5573a40abb1bc705f4b171185735f1fb0ec967 Mon Sep 17 00:00:00 2001 From: Sunny Ripert Date: Mon, 20 Mar 2023 17:58:38 +0100 Subject: [PATCH 03/11] Add GitHub actions badge to README https://github.com/dblock/open-weather-ruby-client/pull/28/files#r1142334268 --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index abe3f0f..77dd57b 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ OpenWeather Ruby Client ======================= [![Gem Version](https://badge.fury.io/rb/open-weather-ruby-client.svg)](https://badge.fury.io/rb/open-weather-ruby-client) +[![Tests Status](https://github.com/dblock/open-weather-ruby-client/actions/workflows/test.yml/badge.svg)](https://github.com/dblock/open-weather-ruby-client/actions) A Ruby client for the [OpenWeather API v2.5 and v3.0](https://openweathermap.org/api). From edc10e36ed0ff29beeb12f51184dadf74f08d29d Mon Sep 17 00:00:00 2001 From: Sunny Ripert Date: Sat, 18 Mar 2023 11:02:40 +0100 Subject: [PATCH 04/11] =?UTF-8?q?Removes=20default=20values=20for=20Farada?= =?UTF-8?q?y=E2=80=99s=20SSL=20settings=20`ca=5Ffile`=20and=20`ca=5Fpath`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 12 +++++++++++- lib/open_weather/config.rb | 4 ++-- lib/open_weather/version.rb | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 84f81d6..02e3d3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ -### 0.2.1 (Next) +### 0.3.0 (Next) +* Removes default values for Faraday’s SSL settings `ca_file` and `ca_path`. + + If you previously relied on `OpenSSL::X509::DEFAULT_CERT_FILE` or `OpenSSL::X509::DEFAULT_CERT_DIR` to set these values you must now do so explicitly. E.g.: + + ```ruby + OpenWeather::Client.configure do |config| + config.ca_path = OpenSSL::X509::DEFAULT_CERT_DIR + config.ca_file = OpenSSL::X509::DEFAULT_CERT_FILE + end + ``` * [#21](https://github.com/dblock/open-weather-ruby-client/pull/21), [#20](https://github.com/dblock/open-weather-ruby-client/pull/20), [#19](https://github.com/dblock/open-weather-ruby-client/pull/19), [#18](https://github.com/dblock/open-weather-ruby-client/pull/18): Added support for Stations API - [@wasabigeek](https://github.com/wasabigeek). * [#22](https://github.com/dblock/open-weather-ruby-client/pull/23): Removed API version from `Config#endpoint` - [@dblock](https://github.com/dblock). * Your contribution here. diff --git a/lib/open_weather/config.rb b/lib/open_weather/config.rb index bde8814..7a51e29 100644 --- a/lib/open_weather/config.rb +++ b/lib/open_weather/config.rb @@ -24,8 +24,8 @@ def reset self.endpoint = 'https://api.openweathermap.org/data' self.api_key = nil self.user_agent = "OpenWeather Ruby Client/#{OpenWeather::VERSION}" - self.ca_path = defined?(OpenSSL) ? OpenSSL::X509::DEFAULT_CERT_DIR : nil - self.ca_file = defined?(OpenSSL) ? OpenSSL::X509::DEFAULT_CERT_FILE : nil + self.ca_path = nil + self.ca_file = nil self.proxy = nil self.logger = nil self.timeout = nil diff --git a/lib/open_weather/version.rb b/lib/open_weather/version.rb index 575b7e5..1412498 100644 --- a/lib/open_weather/version.rb +++ b/lib/open_weather/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module OpenWeather - VERSION = '0.2.1' + VERSION = '0.3.0' end From c0158dec5d7613cbd6b078e13c8eab90151d0409 Mon Sep 17 00:00:00 2001 From: Sunny Ripert Date: Mon, 20 Mar 2023 18:08:59 +0100 Subject: [PATCH 05/11] Update Danger token --- .github/workflows/danger.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml index 9198446..14e5879 100644 --- a/.github/workflows/danger.yml +++ b/.github/workflows/danger.yml @@ -14,6 +14,6 @@ jobs: ruby-version: 3.1 - run: | # the personal token is public, this is ok, base64 encode to avoid tripping Github - TOKEN=$(echo -n NWY1ZmM5MzEyMzNlYWY4OTZiOGU3MmI3MWQ3Mzk0MzgxMWE4OGVmYwo= | base64 --decode) + TOKEN=$(echo -n Z2hwX0xNQ3VmanBFeTBvYkZVTWh6NVNqVFFBOEUxU25abzBqRUVuaAo= | base64 --decode) DANGER_GITHUB_API_TOKEN=$TOKEN bundle exec danger --verbose From 78f60f664fb2ef09cc05ee31c8c16fc37d7595d6 Mon Sep 17 00:00:00 2001 From: Peter Goldstein Date: Fri, 24 Mar 2023 11:15:54 -0400 Subject: [PATCH 06/11] Add Ruby 3.2 to CI. Update checkout action versions. (#30) * Add Ruby 3.2 to CI. Update checkout action versions. * Address CHANGELOG issues and add an UPGRADING * Add authors --- .github/workflows/danger.yml | 2 +- .github/workflows/test.yml | 3 ++- CHANGELOG.md | 12 ++---------- UPGRADING.md | 15 +++++++++++++++ 4 files changed, 20 insertions(+), 12 deletions(-) create mode 100644 UPGRADING.md diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml index 14e5879..5a4dba5 100644 --- a/.github/workflows/danger.yml +++ b/.github/workflows/danger.yml @@ -4,7 +4,7 @@ jobs: danger: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - name: Set up Ruby diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a8f74bc..d98b39b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,11 +9,12 @@ jobs: - { ruby: "2.7" } - { ruby: "3.0" } - { ruby: "3.1" } + - { ruby: "3.2" } - { ruby: ruby-head, ignore: true } - { ruby: jruby-head, ignore: true } name: Test (ruby=${{ matrix.entry.ruby }}) steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install Ruby uses: ruby/setup-ruby@v1 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index 02e3d3a..f486c2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,15 +1,7 @@ ### 0.3.0 (Next) -* Removes default values for Faraday’s SSL settings `ca_file` and `ca_path`. - - If you previously relied on `OpenSSL::X509::DEFAULT_CERT_FILE` or `OpenSSL::X509::DEFAULT_CERT_DIR` to set these values you must now do so explicitly. E.g.: - - ```ruby - OpenWeather::Client.configure do |config| - config.ca_path = OpenSSL::X509::DEFAULT_CERT_DIR - config.ca_file = OpenSSL::X509::DEFAULT_CERT_FILE - end - ``` +* [#30](https://github.com/dblock/open-weather-ruby-client/pull/30): Added support for Ruby 3.2 - [@petergoldstein](https://github.com/petergoldstein). +* [#27](https://github.com/dblock/open-weather-ruby-client/pull/27): Removed default values for Faraday’s SSL settings ca_file and ca_path - [@sunny](https://github.com/sunny). * [#21](https://github.com/dblock/open-weather-ruby-client/pull/21), [#20](https://github.com/dblock/open-weather-ruby-client/pull/20), [#19](https://github.com/dblock/open-weather-ruby-client/pull/19), [#18](https://github.com/dblock/open-weather-ruby-client/pull/18): Added support for Stations API - [@wasabigeek](https://github.com/wasabigeek). * [#22](https://github.com/dblock/open-weather-ruby-client/pull/23): Removed API version from `Config#endpoint` - [@dblock](https://github.com/dblock). * Your contribution here. diff --git a/UPGRADING.md b/UPGRADING.md new file mode 100644 index 0000000..aaddaaf --- /dev/null +++ b/UPGRADING.md @@ -0,0 +1,15 @@ +Upgrading OpenWeather Ruby Client +================================= + +### Upgrading to >= 0.3.0 + +[#27](https://github.com/dblock/open-weather-ruby-client/pull/27) Removes default values for Faraday's SSL settings `ca_file` and `ca_path`. + +If you previously relied on `OpenSSL::X509::DEFAULT_CERT_FILE` or `OpenSSL::X509::DEFAULT_CERT_DIR` to set these values you must now do so explicitly. E.g.: + +```ruby +OpenWeather::Client.configure do |config| + config.ca_path = OpenSSL::X509::DEFAULT_CERT_DIR + config.ca_file = OpenSSL::X509::DEFAULT_CERT_FILE +end +``` From 5136863e27e12e644c97847196ee0150c24213b0 Mon Sep 17 00:00:00 2001 From: "Daniel (dB.) Doubrovkine" Date: Sat, 25 Mar 2023 10:00:16 -0400 Subject: [PATCH 07/11] Preparing for release, 0.3.0. --- CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f486c2f..59e785a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,9 @@ -### 0.3.0 (Next) +### 0.3.0 (2023/03/25) * [#30](https://github.com/dblock/open-weather-ruby-client/pull/30): Added support for Ruby 3.2 - [@petergoldstein](https://github.com/petergoldstein). * [#27](https://github.com/dblock/open-weather-ruby-client/pull/27): Removed default values for Faraday’s SSL settings ca_file and ca_path - [@sunny](https://github.com/sunny). * [#21](https://github.com/dblock/open-weather-ruby-client/pull/21), [#20](https://github.com/dblock/open-weather-ruby-client/pull/20), [#19](https://github.com/dblock/open-weather-ruby-client/pull/19), [#18](https://github.com/dblock/open-weather-ruby-client/pull/18): Added support for Stations API - [@wasabigeek](https://github.com/wasabigeek). * [#22](https://github.com/dblock/open-weather-ruby-client/pull/23): Removed API version from `Config#endpoint` - [@dblock](https://github.com/dblock). -* Your contribution here. ### 0.2.0 (2020/05/17) From e631cff76c7ae329743ff3810ced6c8b78e9429a Mon Sep 17 00:00:00 2001 From: "Daniel (dB.) Doubrovkine" Date: Sat, 25 Mar 2023 10:01:12 -0400 Subject: [PATCH 08/11] Preparing for next developer iteration, 0.3.1. --- CHANGELOG.md | 4 ++++ lib/open_weather/version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 59e785a..8adae85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### 0.3.1 (Next) + +* Your contribution here. + ### 0.3.0 (2023/03/25) * [#30](https://github.com/dblock/open-weather-ruby-client/pull/30): Added support for Ruby 3.2 - [@petergoldstein](https://github.com/petergoldstein). diff --git a/lib/open_weather/version.rb b/lib/open_weather/version.rb index 1412498..0ef17d0 100644 --- a/lib/open_weather/version.rb +++ b/lib/open_weather/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module OpenWeather - VERSION = '0.3.0' + VERSION = '0.3.1' end From 1e94653ec59dc9927a8f948594118ce82d548db9 Mon Sep 17 00:00:00 2001 From: Dewey Garwood Date: Sun, 13 Aug 2023 09:10:02 -0600 Subject: [PATCH 09/11] Upgrade faraday to 2.x (#33) * move development dependencies to gemspec * upgrade faraday to >= 2.0.1 this removes faraday_middleware (due to faraday 2.0 changes), adds faraday-multipart and updates related class references. additionally, faraday's minimum version is now set at 2.0.1 per https://github.com/lostisland/faraday/blob/main/UPGRADING.md to avoid missing net_http issues --- CHANGELOG.md | 1 + Gemfile | 12 ------------ lib/open-weather-ruby-client.rb | 3 ++- lib/open_weather/connection.rb | 13 ++++++------- lib/open_weather/raise_error.rb | 2 +- open-weather-ruby-client.gemspec | 14 ++++++++++++-- 6 files changed, 22 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8adae85..e08a2e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ### 0.3.1 (Next) * Your contribution here. +* [#33](https://github.com/dblock/open-weather-ruby-client/pull/33): Update faraday to 2.x - [@dgarwood](https://github.com/dgarwood). ### 0.3.0 (2023/03/25) diff --git a/Gemfile b/Gemfile index 0a417e0..f7200f1 100644 --- a/Gemfile +++ b/Gemfile @@ -3,15 +3,3 @@ source 'http://rubygems.org' gemspec - -group :development, :test do - gem 'danger-changelog', '~> 0.4.2' - gem 'danger-toc', '~> 0.1.3' - gem 'dotenv' - gem 'pry' - gem 'rake' - gem 'rspec' - gem 'rubocop', '~> 1.48.1' - gem 'vcr' - gem 'webmock' -end diff --git a/lib/open-weather-ruby-client.rb b/lib/open-weather-ruby-client.rb index a2cab32..41807fe 100644 --- a/lib/open-weather-ruby-client.rb +++ b/lib/open-weather-ruby-client.rb @@ -1,7 +1,8 @@ # frozen_string_literal: true require 'faraday' -require 'faraday_middleware' +require 'faraday/multipart' + require 'json' require 'logger' require 'hashie' diff --git a/lib/open_weather/connection.rb b/lib/open_weather/connection.rb index cdfaa80..74965bc 100644 --- a/lib/open_weather/connection.rb +++ b/lib/open_weather/connection.rb @@ -26,13 +26,12 @@ def connection request_options[:open_timeout] = open_timeout if open_timeout options[:request] = request_options if request_options.any? - ::Faraday::Connection.new(endpoint, options) do |connection| - connection.use ::Faraday::Request::Multipart - connection.use ::Faraday::Request::UrlEncoded - connection.use ::OpenWeather::Response::RaiseError - connection.use ::FaradayMiddleware::ParseJson, content_type: /\bjson$/ - connection.response :logger, logger if logger - connection.adapter ::Faraday.default_adapter + Faraday.new(endpoint, options) do |f| + f.request :multipart + f.request :url_encoded + f.use ::OpenWeather::Response::RaiseError + f.response :json, content_type: /\bjson$/ + f.response :logger, logger if logger end end end diff --git a/lib/open_weather/raise_error.rb b/lib/open_weather/raise_error.rb index 14aa0e7..6677953 100644 --- a/lib/open_weather/raise_error.rb +++ b/lib/open_weather/raise_error.rb @@ -2,7 +2,7 @@ module OpenWeather module Response - class RaiseError < ::Faraday::Response::Middleware + class RaiseError < ::Faraday::Response::RaiseError def on_complete(env) case env[:status] when 404 diff --git a/open-weather-ruby-client.gemspec b/open-weather-ruby-client.gemspec index d12db4c..35cfc19 100644 --- a/open-weather-ruby-client.gemspec +++ b/open-weather-ruby-client.gemspec @@ -17,7 +17,17 @@ Gem::Specification.new do |s| s.licenses = ['MIT'] s.summary = 'OpenWeather API Ruby client.' s.add_dependency 'activesupport' - s.add_dependency 'faraday', '>= 1.0.0' - s.add_dependency 'faraday_middleware' + s.add_dependency 'faraday', '>= 2.0.1' + s.add_dependency 'faraday-multipart' s.add_dependency 'hashie' + + s.add_development_dependency 'danger-changelog', '~> 0.4.2' + s.add_development_dependency 'danger-toc', '~> 0.1.3' + s.add_development_dependency 'dotenv' + s.add_development_dependency 'pry' + s.add_development_dependency 'rake' + s.add_development_dependency 'rspec' + s.add_development_dependency 'rubocop', '~> 1.48.1' + s.add_development_dependency 'vcr' + s.add_development_dependency 'webmock' end From 73e4d30d73e7a74ce68c2967d83a6801e27da5a8 Mon Sep 17 00:00:00 2001 From: "Daniel (dB.) Doubrovkine" Date: Sun, 13 Aug 2023 11:13:41 -0400 Subject: [PATCH 10/11] Preparing for release, 0.4.0. --- CHANGELOG.md | 5 ++--- lib/open_weather/version.rb | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e08a2e1..688f852 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,6 @@ -### 0.3.1 (Next) +### 0.4.0 (2023/08/13) -* Your contribution here. -* [#33](https://github.com/dblock/open-weather-ruby-client/pull/33): Update faraday to 2.x - [@dgarwood](https://github.com/dgarwood). +* [#33](https://github.com/dblock/open-weather-ruby-client/pull/33): Upgrade Faraday to 2.x - [@dgarwood](https://github.com/dgarwood). ### 0.3.0 (2023/03/25) diff --git a/lib/open_weather/version.rb b/lib/open_weather/version.rb index 0ef17d0..35f2304 100644 --- a/lib/open_weather/version.rb +++ b/lib/open_weather/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module OpenWeather - VERSION = '0.3.1' + VERSION = '0.4.0' end From aeac49041f20032ad4fbb418881628006d13fd86 Mon Sep 17 00:00:00 2001 From: "Daniel (dB.) Doubrovkine" Date: Sun, 13 Aug 2023 11:14:34 -0400 Subject: [PATCH 11/11] Preparing for next developer iteration, 0.4.1. --- CHANGELOG.md | 4 ++++ lib/open_weather/version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 688f852..efabb61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### 0.4.1 (Next) + +* Your contribution here. + ### 0.4.0 (2023/08/13) * [#33](https://github.com/dblock/open-weather-ruby-client/pull/33): Upgrade Faraday to 2.x - [@dgarwood](https://github.com/dgarwood). diff --git a/lib/open_weather/version.rb b/lib/open_weather/version.rb index 35f2304..999240c 100644 --- a/lib/open_weather/version.rb +++ b/lib/open_weather/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module OpenWeather - VERSION = '0.4.0' + VERSION = '0.4.1' end