Class: Scim::Kit::V2::ServiceProviderConfiguration

Inherits:
Object
  • Object
show all
Includes:
Templatable
Defined in:
lib/scim/kit/v2/service_provider_configuration.rb

Overview

Represents a scim Service Provider Configuration

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Templatable

#as_json, #render, #template_name, #to_h, #to_json

Constructor Details

#initialize(location:, meta: Meta.new('ServiceProviderConfig', location)) ⇒ ServiceProviderConfiguration

Returns a new instance of ServiceProviderConfiguration.



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/scim/kit/v2/service_provider_configuration.rb', line 14

def initialize(
  location:,
  meta: Meta.new('ServiceProviderConfig', location)
)
  @meta = meta
  @authentication_schemes = []
  @etag = Supportable.new
  @sort = Supportable.new
  @change_password = Supportable.new
  @patch = Supportable.new
  @bulk = Supportable.new(:max_operations, :max_payload_size)
  @filter = Supportable.new(:max_results)
end

Instance Attribute Details

#authentication_schemesObject



12
13
14
# File 'lib/scim/kit/v2/service_provider_configuration.rb', line 12

def authentication_schemes
  @authentication_schemes
end

#bulkObject



9
10
11
# File 'lib/scim/kit/v2/service_provider_configuration.rb', line 9

def bulk
  @bulk
end

#change_passwordObject



10
11
12
# File 'lib/scim/kit/v2/service_provider_configuration.rb', line 10

def change_password
  @change_password
end

#documentation_uriObject



11
12
13
# File 'lib/scim/kit/v2/service_provider_configuration.rb', line 11

def documentation_uri
  @documentation_uri
end

#etagObject



10
11
12
# File 'lib/scim/kit/v2/service_provider_configuration.rb', line 10

def etag
  @etag
end

#filterObject



9
10
11
# File 'lib/scim/kit/v2/service_provider_configuration.rb', line 9

def filter
  @filter
end

#metaObject



11
12
13
# File 'lib/scim/kit/v2/service_provider_configuration.rb', line 11

def meta
  @meta
end

#patchObject



10
11
12
# File 'lib/scim/kit/v2/service_provider_configuration.rb', line 10

def patch
  @patch
end

#sortObject



10
11
12
# File 'lib/scim/kit/v2/service_provider_configuration.rb', line 10

def sort
  @sort
end

Class Method Details

.parse(json, hash = JSON.parse(json, symbolize_names: true)) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/scim/kit/v2/service_provider_configuration.rb', line 35

def parse(json, hash = JSON.parse(json, symbolize_names: true))
  x = new(location: hash[:location], meta: Meta.from(hash[:meta]))
  x.documentation_uri = hash[:documentationUri]
  %i[patch changePassword sort etag filter bulk].each do |key|
    x.send("#{key.to_s.underscore}=", Supportable.from(hash[key]))
  end
  schemes = hash[:authenticationSchemes]
  x.authentication_schemes = schemes&.map do |auth|
    AuthenticationScheme.from(auth)
  end
  x
end

Instance Method Details

#add_authentication(type, primary: nil) {|scheme| ... } ⇒ Object

Yields:

  • (scheme)


28
29
30
31
32
# File 'lib/scim/kit/v2/service_provider_configuration.rb', line 28

def add_authentication(type, primary: nil)
  scheme = AuthenticationScheme.build_for(type, primary: primary)
  yield scheme if block_given?
  @authentication_schemes << scheme
end