Class: WorkOS::Connection

Inherits:
Object
  • Object
show all
Includes:
HashProvider
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. Note: status is deprecated - use state instead

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HashProvider

#to_h

Constructor Details

#initialize(json) ⇒ Connection

Returns a new instance of Connection.



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/workos/connection.rb', line 14

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

  @id = hash[:id]
  @name = hash[:name]
  @connection_type = hash[:connection_type]
  @domains = hash[:domains]
  @organization_id = hash[:organization_id]
  @state = hash[:state]
  @status = hash[:status]
  @created_at = hash[:created_at]
  @updated_at = hash[:updated_at]
end

Instance Attribute Details

#connection_typeObject

Returns the value of attribute connection_type.



11
12
13
# File 'lib/workos/connection.rb', line 11

def connection_type
  @connection_type
end

#created_atObject

Returns the value of attribute created_at.



11
12
13
# File 'lib/workos/connection.rb', line 11

def created_at
  @created_at
end

#domainsObject

Returns the value of attribute domains.



11
12
13
# File 'lib/workos/connection.rb', line 11

def domains
  @domains
end

#idObject

Returns the value of attribute id.



11
12
13
# File 'lib/workos/connection.rb', line 11

def id
  @id
end

#nameObject

Returns the value of attribute name.



11
12
13
# File 'lib/workos/connection.rb', line 11

def name
  @name
end

#organization_idObject

Returns the value of attribute organization_id.



11
12
13
# File 'lib/workos/connection.rb', line 11

def organization_id
  @organization_id
end

#stateObject

Returns the value of attribute state.



11
12
13
# File 'lib/workos/connection.rb', line 11

def state
  @state
end

#statusObject

Returns the value of attribute status.



11
12
13
# File 'lib/workos/connection.rb', line 11

def status
  @status
end

#updated_atObject

Returns the value of attribute updated_at.



11
12
13
# File 'lib/workos/connection.rb', line 11

def updated_at
  @updated_at
end

Instance Method Details

#to_jsonObject



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/workos/connection.rb', line 28

def to_json(*)
  {
    id: id,
    name: name,
    connection_type: connection_type,
    domains: domains,
    organization_id: organization_id,
    state: state,
    status: status,
    created_at: created_at,
    updated_at: updated_at,
  }
end