booqable 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ce7d8b0be4851e4e78229078331a2f73cbe7cb7702c1555df9dec0903be28d0e
4
- data.tar.gz: c79ed318eb3a38534291ef5e4abeb6a5749c7a2684bcd1befbf43d6f7f1d0e8a
3
+ metadata.gz: eb7d9650b7c441ded7b819566722c9dd860d83c28338407897c3e359367954a3
4
+ data.tar.gz: 6fd5b29991f14b4503b244fcb05db3613c7d87baf215904274066081a2d71107
5
5
  SHA512:
6
- metadata.gz: 9d6dead61b0b4bfd8374c9b51aec7dccc724988b5417f9585018ee549840ee207756642b38aedbfcf4fdb4e313f9764fdc64b1d1d6e7593c057edb20d6095afc
7
- data.tar.gz: c5e34b3a736ab3bdca397dfd1245d07b8dd8e246e32d4d0f24e097c41f52d47307c645a547592e60b90dc27f98e2e817193a1059f2696c0a726316c0693c1f88
6
+ metadata.gz: 38b96b39b3d88bfe1209a102f15117f2f7292d38f0ffebb5d2d0e80cbf93d8cb5622462b9bfef7a3cc784a52f25c4bdcad97333de5401a7d8cc2ca0abcbaae15
7
+ data.tar.gz: f53f2f5c9347c8f3ea266abfc8882b42e8e1239c9df104cb46277a2467ad22710fc68a7417808eb32ac37d1ee0a3891a9e704e558101dbb30962b54da2d1b917
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.2.1] - 2026-06-10
2
+
3
+ - Require `oauth2 >= 2.0.22` to address GHSA-pp92-crg2-gfv9, where a
4
+ protocol-relative redirect `Location` could override the request authority and
5
+ leak the bearer `Authorization` header to an attacker-controlled host.
6
+
7
+
1
8
  ## [1.2.0] - 2026-05-27
2
9
 
3
10
  - Add optional `around_refresh_token` configuration. When provided, the OAuth
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "did_you_mean"
4
+
3
5
  module Booqable
4
6
  # Client for the Booqable API
5
7
  #
@@ -40,11 +42,22 @@ module Booqable
40
42
  access_token
41
43
  ]
42
44
 
45
+ # Accepted aliases for configuration options, mapping the alias to its
46
+ # canonical {Booqable::Configurable} key.
47
+ OPTION_ALIASES = {
48
+ skip_retries: :no_retries
49
+ }.freeze
50
+
43
51
  # Initialize a new Client
44
52
  #
45
53
  # @param options [Hash] Configuration options for the client
46
54
  # @see Booqable::Configurable For a complete list of supported configuration options
47
55
  def initialize(options = {})
56
+ options = normalize_aliases(options)
57
+
58
+ unknown_keys = options.keys.map(&:to_sym) - Booqable::Configurable.keys
59
+ raise ArgumentError, unknown_options_message(unknown_keys) unless unknown_keys.empty?
60
+
48
61
  # Use options passed in, but fall back to module defaults
49
62
  #
50
63
  # This may look like a `.keys.each` which should be replaced with `#each_key`, but
@@ -94,5 +107,34 @@ module Booqable
94
107
 
95
108
  inspected
96
109
  end
110
+
111
+ private
112
+
113
+ # Rewrite any aliased option keys to their canonical configuration key.
114
+ #
115
+ # @param options [Hash] options as passed to {#initialize}
116
+ # @return [Hash] options with aliases replaced by their canonical keys
117
+ def normalize_aliases(options)
118
+ options.to_h do |key, value|
119
+ [ OPTION_ALIASES.fetch(key.to_sym, key), value ]
120
+ end
121
+ end
122
+
123
+ # Build an error message for unknown configuration options, suggesting
124
+ # similarly-named valid options via did_you_mean when one is close enough.
125
+ #
126
+ # @param unknown_keys [Array<Symbol>] options that aren't valid config keys
127
+ # @return [String]
128
+ def unknown_options_message(unknown_keys)
129
+ dictionary = Booqable::Configurable.keys + OPTION_ALIASES.keys
130
+ spell_checker = DidYouMean::SpellChecker.new(dictionary: dictionary)
131
+
132
+ message = "unknown configuration option(s): #{unknown_keys.join(", ")}"
133
+
134
+ suggestions = unknown_keys.flat_map { |key| spell_checker.correct(key) }.uniq
135
+ message += ". Did you mean: #{suggestions.join(", ")}?" unless suggestions.empty?
136
+
137
+ message
138
+ end
97
139
  end
98
140
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Booqable
4
- VERSION = "1.2.0"
4
+ VERSION = "1.2.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: booqable
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hrvoje Šimić
@@ -86,6 +86,9 @@ dependencies:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
88
  version: '2.0'
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: 2.0.22
89
92
  type: :runtime
90
93
  prerelease: false
91
94
  version_requirements: !ruby/object:Gem::Requirement
@@ -93,6 +96,9 @@ dependencies:
93
96
  - - "~>"
94
97
  - !ruby/object:Gem::Version
95
98
  version: '2.0'
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: 2.0.22
96
102
  - !ruby/object:Gem::Dependency
97
103
  name: jwt
98
104
  requirement: !ruby/object:Gem::Requirement