Class: WorkOS::Directory

Inherits:
Object
  • Object
show all
Includes:
HashProvider
Defined in:
lib/workos/directory.rb

Overview

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.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HashProvider

#to_h

Constructor Details

#initialize(json) ⇒ Directory

Returns a new instance of Directory.



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/workos/directory.rb', line 12

def initialize(json)
  hash = JSON.parse(json, symbolize_names: true)

  @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

Instance Attribute Details

#created_atObject

Returns the value of attribute created_at.



10
11
12
# File 'lib/workos/directory.rb', line 10

def created_at
  @created_at
end

#domainObject

Returns the value of attribute domain.



10
11
12
# File 'lib/workos/directory.rb', line 10

def domain
  @domain
end

#idObject

Returns the value of attribute id.



10
11
12
# File 'lib/workos/directory.rb', line 10

def id
  @id
end

#nameObject

Returns the value of attribute name.



10
11
12
# File 'lib/workos/directory.rb', line 10

def name
  @name
end

#organization_idObject

Returns the value of attribute organization_id.



10
11
12
# File 'lib/workos/directory.rb', line 10

def organization_id
  @organization_id
end

#stateObject

Returns the value of attribute state.



10
11
12
# File 'lib/workos/directory.rb', line 10

def state
  @state
end

#typeObject

Returns the value of attribute type.



10
11
12
# File 'lib/workos/directory.rb', line 10

def type
  @type
end

#updated_atObject

Returns the value of attribute updated_at.



10
11
12
# File 'lib/workos/directory.rb', line 10

def updated_at
  @updated_at
end

Instance Method Details

#to_jsonObject



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/workos/directory.rb', line 25

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