ask-auth 0.3.1 → 0.3.2

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: d8434cd70339a093050b7c19364a628d9b8e56048f41c1bb492f6268ed672b39
4
- data.tar.gz: d5c377bb5480fb7e19d1dca9a0ca46bc1a29d09ef4dc7d3fc3f216fa38342552
3
+ metadata.gz: d41ca49d1114503dc3a3830efb730823fd598c1dca1249b2c06bc808be7c4743
4
+ data.tar.gz: 17b4718e99c515ba26424ce90b104ad4dfc416871e2ee2598ff5f62b67524bd7
5
5
  SHA512:
6
- metadata.gz: 7676f10e858addff8c2ab69db3223aea179e11016ce8faa44422432dfcc2e567ff772c9d04e037b8370d4a32b894c0094a5e3a23debfdd43d02bb877283c775f
7
- data.tar.gz: cacdcf31dbe213784f73c9ca0a70b8b17e280cd13697fb07e4cbcf5ac99261c340ed24f0591b637584dcc6d32be10bf83eac713b89751511a82ff2e2e6ecdfd1
6
+ metadata.gz: 90118e173e9fa7e9a675dacb331d14fe179f006b72679c2201a3395b121f0637dd91058f99efa098a1aefcf33224f730c40ce5bcbe9a80b37932edcfef73f791
7
+ data.tar.gz: 73b8d4681b7a3a74a7f92600e26c819e9123b796975d4100e6784fcb948f9412fecef3c7791dd095f41f114a00dadf59ed05c0e4f04eb9dddaee22fd74e5bba9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## [0.3.2] — 2026-08-13
2
+
3
+ ### Added
4
+
5
+ - **`Ask::Auth.lookup` — non-raising credential resolution.** Same chain and
6
+ fallback semantics as `resolve`, but returns `nil` when nothing matches
7
+ instead of raising `MissingCredential`. For config-time resolution (e.g.
8
+ ERB in `database.yml`) where a missing credential should degrade to
9
+ nil/defaults rather than crash the boot. `resolve` is now implemented on
10
+ top of `lookup` and keeps its raising behavior.
11
+
1
12
  ## [0.3.1] — 2026-08-07
2
13
 
3
14
  ### Added
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ask
4
4
  module Auth
5
- VERSION = "0.3.1"
5
+ VERSION = "0.3.2"
6
6
  end
7
7
  end
data/lib/ask/auth.rb CHANGED
@@ -74,7 +74,21 @@ module Ask
74
74
  #
75
75
  # +names+:: One or more Symbols, Strings, or Arrays identifying the credential
76
76
  # +user+:: Optional user record for per-user providers (Database, OAuth)
77
+ #
78
+ # Raises MissingCredential when nothing matches. Use +lookup+ for a
79
+ # non-raising variant.
77
80
  def resolve(*names, user: nil)
81
+ value = lookup(*names, user: user)
82
+ return value unless value.nil?
83
+
84
+ raise MissingCredential, names
85
+ end
86
+
87
+ # Non-raising variant of +resolve+: returns nil when no provider
88
+ # matches, instead of raising MissingCredential. For config-time
89
+ # resolution (e.g. ERB in database.yml) where a missing credential
90
+ # should degrade to nil/defaults rather than crash the boot.
91
+ def lookup(*names, user: nil)
78
92
  return nil if names.empty?
79
93
 
80
94
  names.each do |name|
@@ -92,7 +106,7 @@ module Ask
92
106
  end
93
107
  end
94
108
 
95
- raise MissingCredential, names
109
+ nil
96
110
  end
97
111
 
98
112
  private
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ask-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaka Ruto
@@ -110,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
110
  - !ruby/object:Gem::Version
111
111
  version: '0'
112
112
  requirements: []
113
- rubygems_version: 4.0.3
113
+ rubygems_version: 4.0.18
114
114
  specification_version: 4
115
115
  summary: Credential resolution for the ask-rb ecosystem
116
116
  test_files: []