Class: JSON::JWK::Set
- Inherits:
-
Array
- Object
- Array
- JSON::JWK::Set
show all
- Defined in:
- lib/json/jwk/set.rb,
lib/json/jwk/set/fetcher.rb
Defined Under Namespace
Modules: Fetcher
Classes: KidNotFound
Instance Method Summary
collapse
Constructor Details
#initialize(*jwks) ⇒ Set
Returns a new instance of Set.
6
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/json/jwk/set.rb', line 6
def initialize(*jwks)
jwks = if jwks.first.is_a?(Hash) && (keys = jwks.first.with_indifferent_access[:keys])
keys
else
jwks
end
jwks = Array(jwks).flatten.collect do |jwk|
JWK.new jwk
end
replace jwks
end
|
Instance Method Details
#[](kid) ⇒ Object
22
23
24
25
26
|
# File 'lib/json/jwk/set.rb', line 22
def [](kid)
detect do |jwk|
jwk[:kid] && jwk[:kid] == kid
end
end
|
#as_json(options = {}) ⇒ Object
28
29
30
31
|
# File 'lib/json/jwk/set.rb', line 28
def as_json(options = {})
{keys: Array.new(self)}
end
|
#content_type ⇒ Object
18
19
20
|
# File 'lib/json/jwk/set.rb', line 18
def content_type
'application/jwk-set+json'
end
|