Project

scim-kit

0.01
A long-lived project that still receives updates
A simple toolkit for working with SCIM 2.0
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.7
~> 13.0
~> 3.0
~> 1.0
~> 3.5

Runtime

~> 2.0
>= 6.1, < 8.0
~> 2.0
 Project Readme

Scim::Kit

Build Status Gem Version

Scim::Kit is a library with the purpose of simplifying the generation and consumption of SCIM Schema. https://tools.ietf.org/html/rfc7643#section-2

Installation

Add this line to your application's Gemfile:

gem 'scim-kit'

And then execute:

$ bundle

Or install it yourself as:

$ gem install scim-kit

Usage

def user_schema
  Scim::Kit::V2::Schema.build(
    id: Scim::Kit::V2::Schemas::USER,
    name: "User",
    location: scim_v2_schema_url(id: Scim::Kit::V2::Schemas::USER)
  ) do |schema|
    schema.description = "User Account"
    schema.add_attribute(name: 'userName') do |x|
      x.description = "Unique identifier for the User"
      x.required = true
      x.uniqueness = :server
    end
    schema.add_attribute(name: 'password') do |x|
      x.description = "The User's cleartext password."
      x.mutability = :write_only
      x.required = false
      x.returned = :never
    end
    schema.add_attribute(name: 'emails') do |x|
      x.multi_valued = true
      x.description = "Email addresses for the user."
      x.add_attribute(name: 'value') do |y|
        y.description = "Email addresses for the user."
      end
      x.add_attribute(name: 'primary', type: :boolean) do |y|
        y.description = "A Boolean value indicating the preferred email"
      end
    end
    schema.add_attribute(name: 'groups') do |x|
      x.multi_valued = true
      x.description = "A list of groups to which the user belongs."
      x.mutability = :read_only
      x.add_attribute(name: 'value') do |y|
        y.description = "The identifier of the User's group."
        y.mutability = :read_only
      end
      x.add_attribute(name: '$ref', type: :reference) do |y|
        y.reference_types = ['User', 'Group']
        y.description = "The URI of the corresponding 'Group' resource."
        y.mutability = :read_only
      end
      x.add_attribute(name: 'display') do |y|
        y.description = "A human-readable name."
        y.mutability = :read_only
      end
    end
  end
end

puts user_schema.to_json

Development

After checking out the repo, run bin/setup to install dependencies. Then, run bin/test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/xlgmokha/scim-kit.

License

The gem is available as open source under the terms of the MIT License.