Commit c5f9532
Changed files (2)
lib
lib/scim/kit/v2/authentication_scheme.rb
@@ -32,15 +32,26 @@ module Scim
yield self if block_given?
end
- def self.build_for(type, primary: nil)
- defaults = DEFAULTS[type.to_sym] || {}
- new do |x|
- x.type = type
- x.primary = primary
- x.description = defaults[:description]
- x.documentation_uri = defaults[:documentation_uri]
- x.name = defaults[:name]
- x.spec_uri = defaults[:spec_uri]
+ class << self
+ def build_for(type, primary: nil)
+ defaults = DEFAULTS[type.to_sym] || {}
+ new do |x|
+ x.type = type
+ x.primary = primary
+ x.description = defaults[:description]
+ x.documentation_uri = defaults[:documentation_uri]
+ x.name = defaults[:name]
+ x.spec_uri = defaults[:spec_uri]
+ end
+ end
+
+ def from(hash)
+ x = build_for(hash[:type], primary: hash[:primary])
+ x.description = hash[:description]
+ x.documentation_uri = hash[:documentationUri]
+ x.name = hash[:name]
+ x.spec_uri = hash[:specUri]
+ x
end
end
end
lib/scim/kit/v2/service_provider_configuration.rb
@@ -44,12 +44,7 @@ module Scim
x.sort.supported = hash[:sort][:supported]
x.etag.supported = hash[:etag][:supported]
hash[:authenticationSchemes]&.each do |auth|
- x.add_authentication(auth[:type], primary: auth[:primary]) do |y|
- y.description = auth[:description]
- y.documentation_uri = auth[:documentationUri]
- y.name = auth[:name]
- y.spec_uri = auth[:specUri]
- end
+ x.authentication_schemes << AuthenticationScheme.from(auth)
end
x
end