From 094058efd6db9753f0855ab06e99b5e424953676 Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Mon, 29 Aug 2022 22:34:10 +0700 Subject: [PATCH 1/4] =?UTF-8?q?=E2=9E=95=20`OAuth::Comsumer#options`=20has?= =?UTF-8?q?h=20is=20now=20handled=20by=20`snaky=5Fhash`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - extracted from `oauth2` --- lib/oauth.rb | 1 + lib/oauth/consumer.rb | 87 ++++++++++++++++++++++--------------------- oauth.gemspec | 1 + 3 files changed, 47 insertions(+), 42 deletions(-) diff --git a/lib/oauth.rb b/lib/oauth.rb index 190295d3..de0d4d11 100644 --- a/lib/oauth.rb +++ b/lib/oauth.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true # third party gems +require "snaky_hash" require "version_gem" require "oauth/version" diff --git a/lib/oauth/consumer.rb b/lib/oauth/consumer.rb index bbfe6534..11ab1fcb 100644 --- a/lib/oauth/consumer.rb +++ b/lib/oauth/consumer.rb @@ -30,47 +30,49 @@ class Consumer end CA_FILE = nil unless defined?(CA_FILE) - @@default_options = { - # Signature method used by server. Defaults to HMAC-SHA1 - signature_method: "HMAC-SHA1", - - # default paths on site. These are the same as the defaults set up by the generators - request_token_path: "/oauth/request_token", - authenticate_path: "/oauth/authenticate", - authorize_path: "/oauth/authorize", - access_token_path: "/oauth/access_token", - - proxy: nil, - # How do we send the oauth values to the server see - # https://oauth.net/core/1.0/#consumer_req_param for more info - # - # Possible values: - # - # :header - via the Authorize header (Default) ( option 1. in spec) - # :body - url form encoded in body of POST request ( option 2. in spec) - # :query_string - via the query part of the url ( option 3. in spec) - scheme: :header, - - # Default http method used for OAuth Token Requests (defaults to :post) - http_method: :post, - - # Add a custom ca_file for consumer - # :ca_file => '/etc/certs.pem' - - # Possible values: - # - # nil, false - no debug output - # true - uses $stdout - # some_value - uses some_value - debug_output: nil, - - # Defaults to producing a body_hash as part of the signature but - # can be disabled since it's not officially part of the OAuth 1.0 - # spec. Possible values are true and false - body_hash_enabled: true, - - oauth_version: "1.0" - } + @@default_options = SnakyHash::SymbolKeyed.new( + { + # Signature method used by server. Defaults to HMAC-SHA1 + signature_method: "HMAC-SHA1", + + # default paths on site. These are the same as the defaults set up by the generators + request_token_path: "/oauth/request_token", + authenticate_path: "/oauth/authenticate", + authorize_path: "/oauth/authorize", + access_token_path: "/oauth/access_token", + + proxy: nil, + # How do we send the oauth values to the server see + # https://oauth.net/core/1.0/#consumer_req_param for more info + # + # Possible values: + # + # :header - via the Authorize header (Default) ( option 1. in spec) + # :body - url form encoded in body of POST request ( option 2. in spec) + # :query_string - via the query part of the url ( option 3. in spec) + scheme: :header, + + # Default http method used for OAuth Token Requests (defaults to :post) + http_method: :post, + + # Add a custom ca_file for consumer + # :ca_file => '/etc/certs.pem' + + # Possible values: + # + # nil, false - no debug output + # true - uses $stdout + # some_value - uses some_value + debug_output: nil, + + # Defaults to producing a body_hash as part of the signature but + # can be disabled since it's not officially part of the OAuth 1.0 + # spec. Possible values are true and false + body_hash_enabled: true, + + oauth_version: "1.0" + } + ) attr_accessor :options, :key, :secret attr_writer :site, :http @@ -103,7 +105,8 @@ def initialize(consumer_key, consumer_secret, options = {}) @secret = consumer_secret # ensure that keys are symbols - @options = @@default_options.merge(options.transform_keys(&:to_sym)) + snaky_options = SnakyHash::SymbolKeyed.new(options) + @options = @@default_options.merge(snaky_options) end # The default http method diff --git a/oauth.gemspec b/oauth.gemspec index 073a8b4c..540474db 100644 --- a/oauth.gemspec +++ b/oauth.gemspec @@ -3,6 +3,7 @@ require_relative "lib/oauth/version" Gem::Specification.new do |spec| + spec.add_dependency("snaky_hash", "~> 2.0") spec.add_dependency("version_gem", "~> 1.1") spec.name = "oauth" From e55b0099730531c8f562ffd1ec337459225c4a31 Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Tue, 30 Aug 2022 05:02:33 +0700 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=94=96=20Prepare=20release=201.0.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 8 +++++++- lib/oauth/version.rb | 2 +- oauth.gemspec | 8 ++++---- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 006af424..e4fc1821 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed +## [1.0.1] 2022-08-29 +### Changed +* `OAuth::Comsumer#options` hash is now handled by `snaky_hash`, which was extracted from `oauth2` + * symbolized keys, dot-access and snake-case are now normalized + ## [1.0.0] 2022-08-23 ### Changed * Dropped support for Ruby < 2.7 @@ -440,7 +445,8 @@ but please have a look at the unit tests. * Moved all non-Rails functionality from the Rails plugin: http://code.google.com/p/oauth-plugin/ -[Unreleased]: https://github.com/oauth-xx/oauth-ruby/compare/v1.0.0...main +[Unreleased]: https://github.com/oauth-xx/oauth-ruby/compare/v1.0.1...main +[1.0.1]: https://github.com/oauth-xx/oauth-ruby/releases/tag/v1.0.1 [1.0.0]: https://github.com/oauth-xx/oauth-ruby/releases/tag/v1.0.0 [0.6.1]: https://github.com/oauth-xx/oauth-ruby/releases/tag/v0.6.1 [0.6.0]: https://github.com/oauth-xx/oauth-ruby/releases/tag/v0.6.0 diff --git a/lib/oauth/version.rb b/lib/oauth/version.rb index f331c7c5..4e61f9e8 100644 --- a/lib/oauth/version.rb +++ b/lib/oauth/version.rb @@ -2,6 +2,6 @@ module OAuth module Version - VERSION = "1.0.0" + VERSION = "1.0.1" end end diff --git a/oauth.gemspec b/oauth.gemspec index 540474db..b4819a94 100644 --- a/oauth.gemspec +++ b/oauth.gemspec @@ -34,13 +34,13 @@ Gem::Specification.new do |spec| spec.post_install_message = " You have installed oauth version #{OAuth::Version::VERSION}, congratulations! -Non-commercial support for the 1.0.x series will end in April, 2025. Please make a plan to upgrade to the next version prior to that date. -The only breaking change will be dropped support for Ruby 2.7. +Non-commercial support for the 1.x series will end by April, 2025. Please make a plan to upgrade to the next version prior to that date. +The only breaking change will be dropped support for Ruby 2.7 and any other versions which will also have reached EOL by then. Please see: -• https://github.com/oauth-xx/oauth/blob/main/SECURITY.md +• #{spec.homepage}/blob/main/SECURITY.md -Note also that I, and this project, am in the process of leaving Github. +Note also that I am, and this project is, in the process of leaving Github. I wrote about some of the reasons here: • https://dev.to/galtzo/im-leaving-github-50ba From 3e2bd0709e1851d34916d165ab0b240e4b6845cd Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Tue, 30 Aug 2022 05:44:18 +0700 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=94=96=20Prepare=20release=201.0.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e4fc1821..e6323b8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * New EOL Policy * Non-commercial support for the oldest version of Ruby (which itself is going EOL) will be dropped each year in April +## [0.6.2] 2022-08-29 +### Changed +* `OAuth::Comsumer#options` hash is now handled by `snaky_hash`, which was extracted from `oauth2` + * symbolized keys, dot-access and snake-case are now normalized + ## [0.6.1] 2022-08-23 ### Changed * Fixed documentation in SECURITY.md @@ -49,6 +54,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed * Ruby 2.0, 2.1, 2.2, and 2.3 are no longer valid install targets +## [0.5.14] 2022-08-29 +The "hopeful last 0.5.x" Release + +### Fixed +* More typos fixed + ## [0.5.13] 2022-08-23 The "I think I caught 'em all!" Release @@ -448,8 +459,10 @@ but please have a look at the unit tests. [Unreleased]: https://github.com/oauth-xx/oauth-ruby/compare/v1.0.1...main [1.0.1]: https://github.com/oauth-xx/oauth-ruby/releases/tag/v1.0.1 [1.0.0]: https://github.com/oauth-xx/oauth-ruby/releases/tag/v1.0.0 +[0.6.2]: https://github.com/oauth-xx/oauth-ruby/releases/tag/v0.6.2 [0.6.1]: https://github.com/oauth-xx/oauth-ruby/releases/tag/v0.6.1 [0.6.0]: https://github.com/oauth-xx/oauth-ruby/releases/tag/v0.6.0 +[0.5.14]: https://github.com/oauth-xx/oauth-ruby/releases/tag/v0.5.14 [0.5.13]: https://github.com/oauth-xx/oauth-ruby/releases/tag/v0.5.13 [0.5.12]: https://github.com/oauth-xx/oauth-ruby/releases/tag/v0.5.12 [0.5.11]: https://github.com/oauth-xx/oauth-ruby/releases/tag/v0.5.11 From 9f05f3d496ca4b0e6a4394822f4475108b005b8d Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Tue, 30 Aug 2022 05:55:47 +0700 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=93=9D=20Document=20v1.0-maintenance?= =?UTF-8?q?=20branch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 342e8701..1c7223d1 100644 --- a/README.md +++ b/README.md @@ -96,7 +96,7 @@ The link tokens in the following sections should be kept ordered by the row and [📗next]: https://github.com/oauth-xx/oauth-ruby/milestone/1 [📗next-img]: https://img.shields.io/github/milestones/progress/oauth-xx/oauth-ruby/1?label=Next%20Version - + [⛳cclim-maint]: https://codeclimate.com/github/oauth-xx/oauth-ruby/maintainability [⛳cclim-maint-img♻️]: https://api.codeclimate.com/v1/badges/3cf23270c21e8791d788/maintainability [🖇triage-help]: https://www.codetriage.com/oauth-xx/oauth-ruby @@ -191,7 +191,8 @@ Targeted ruby compatibility is non-EOL versions of Ruby, currently 2.7, 3.0, and 3.1. Ruby is limited to 2.7+ in the gemspec, and this will change with minor version bumps, while the gem is still in 0.x, in accordance with the SemVer spec. -The `main` branch now targets 1.0.x releases, for Ruby >= 2.7. +The `main` branch now targets 1.1.x releases, for Ruby >= 2.7. +See `v1.0-maintenance` (EOL April, 2025) branch for Ruby >= 2.7. See `v0.6-maintenance` (EOL April, 2024) branch for Ruby >= 2.4. See `v0.5-maintenance` (EOL April, 2023) branch for Ruby >= 2.0.