Class: WorkOS::Connection

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/workos/connection.rb

Overview

The Connection class provides a lightweight wrapper around a WorkOS Connection 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

Constructor Details

#initialize(json) ⇒ Connection

Returns a new instance of Connection.



16
17
18
19
20
21
22
23
# File 'lib/workos/connection.rb', line 16

def initialize(json)
  raw = parse_json(json)

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

Instance Attribute Details

#connection_typeObject

Returns the value of attribute connection_type.



13
14
15
# File 'lib/workos/connection.rb', line 13

def connection_type
  @connection_type
end

#domainsObject

Returns the value of attribute domains.



13
14
15
# File 'lib/workos/connection.rb', line 13

def domains
  @domains
end

#idObject

Returns the value of attribute id.



13
14
15
# File 'lib/workos/connection.rb', line 13

def id
  @id
end

#nameObject

Returns the value of attribute name.



13
14
15
# File 'lib/workos/connection.rb', line 13

def name
  @name
end

Instance Method Details

#to_jsonObject



25
26
27
28
29
30
31
32
# File 'lib/workos/connection.rb', line 25

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