Sha256: ca22acdf61a7d9c47b87cf8218c8efe92da98a53b8f630a4b9c654a1f9037084

Contents?: true

Size: 940 Bytes

Versions: 17

Compression:

Stored size: 940 Bytes

Contents

# frozen_string_literal: true
# typed: true

module WorkOS
  # The DirectoryGroup class provides a lightweight wrapper around
  # a WorkOS DirectoryGroup resource. This class is not meant to be instantiated
  # in user space, and is instantiated internally but exposed.
  class DirectoryGroup
    extend T::Sig

    attr_accessor :id, :name

    sig { params(json: String).void }
    def initialize(json)
      raw = parse_json(json)

      @id = T.let(raw.id, String)
      @name = T.let(raw.name, String)
    end

    def to_json(*)
      {
        id: id,
        name: name,
      }
    end

    private

    sig do
      params(
        json_string: String,
      ).returns(WorkOS::Types::DirectoryGroupStruct)
    end
    def parse_json(json_string)
      hash = JSON.parse(json_string, symbolize_names: true)

      WorkOS::Types::DirectoryGroupStruct.new(
        id: hash[:id],
        name: hash[:name],
      )
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
workos-2.2.0 lib/workos/directory_group.rb
workos-2.1.1 lib/workos/directory_group.rb
workos-2.1.0 lib/workos/directory_group.rb
workos-2.0.0 lib/workos/directory_group.rb
workos-1.6.1 lib/workos/directory_group.rb
workos-1.6.0 lib/workos/directory_group.rb
workos-1.5.1 lib/workos/directory_group.rb
workos-1.5.0 lib/workos/directory_group.rb
workos-1.4.0 lib/workos/directory_group.rb
workos-1.3.0 lib/workos/directory_group.rb
workos-1.2.1 lib/workos/directory_group.rb
workos-1.2.0 lib/workos/directory_group.rb
workos-1.1.0 lib/workos/directory_group.rb
workos-1.0.0 lib/workos/directory_group.rb
workos-0.11.2 lib/workos/directory_group.rb
workos-0.11.1 lib/workos/directory_group.rb
workos-0.11.0 lib/workos/directory_group.rb