class WorkOS::DirectoryGroup

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.

Attributes

id[RW]
name[RW]

Public Class Methods

new(json) click to toggle source
# File lib/workos/directory_group.rb, line 14
def initialize(json)
  raw = parse_json(json)

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

Public Instance Methods

to_json(*) click to toggle source
# File lib/workos/directory_group.rb, line 21
def to_json(*)
  {
    id: id,
    name: name,
  }
end

Private Instance Methods

parse_json(json_string) click to toggle source
# File lib/workos/directory_group.rb, line 35
def parse_json(json_string)
  hash = JSON.parse(json_string, symbolize_names: true)

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