class WorkOS::Directory
The Directory
class provides a lightweight wrapper around a WorkOS
Directory
resource. This class is not meant to be instantiated in user space, and is instantiated internally but exposed.
Attributes
created_at[RW]
domain[RW]
id[RW]
name[RW]
organization_id[RW]
state[RW]
type[RW]
updated_at[RW]
Public Class Methods
new(json)
click to toggle source
# File lib/workos/directory.rb, line 15 def initialize(json) raw = parse_json(json) @id = T.let(raw.id, String) @name = T.let(raw.name, String) @domain = T.let(raw.domain, String) @type = T.let(raw.type, String) @state = T.let(raw.state, String) @organization_id = T.let(raw.organization_id, String) @created_at = T.let(raw.created_at, String) @updated_at = T.let(raw.updated_at, String) end
Public Instance Methods
to_json(*)
click to toggle source
rubocop:enable Metrics/AbcSize
# File lib/workos/directory.rb, line 29 def to_json(*) { id: id, name: name, domain: domain, type: type, state: state, organization_id: organization_id, created_at: created_at, updated_at: updated_at, } end
Private Instance Methods
parse_json(json_string)
click to toggle source
# File lib/workos/directory.rb, line 49 def parse_json(json_string) hash = JSON.parse(json_string, symbolize_names: true) WorkOS::Types::DirectoryStruct.new( id: hash[:id], name: hash[:name], domain: hash[:domain], type: hash[:type], state: hash[:state], organization_id: hash[:organization_id], created_at: hash[:created_at], updated_at: hash[:updated_at], ) end