Class: WorkOS::Organization

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

Overview

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

Returns a new instance of Organization.



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/workos/organization.rb', line 20

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

  @id = hash[:id]
  @name = hash[:name]
  @allow_profiles_outside_organization = hash[:allow_profiles_outside_organization]
  @domains = hash[:domains]
  @stripe_customer_id = hash[:stripe_customer_id]
  @created_at = hash[:created_at]
  @updated_at = hash[:updated_at]
end

Instance Attribute Details

#allow_profiles_outside_organizationObject

Returns the value of attribute allow_profiles_outside_organization.



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

def allow_profiles_outside_organization
  @allow_profiles_outside_organization
end

#created_atObject

Returns the value of attribute created_at.



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

def created_at
  @created_at
end

#domainsObject

Returns the value of attribute domains.



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

def domains
  @domains
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#stripe_customer_idObject

Returns the value of attribute stripe_customer_id.



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

def stripe_customer_id
  @stripe_customer_id
end

Instance Method Details

#to_jsonObject



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/workos/organization.rb', line 32

def to_json(*)
  {
    id: id,
    name: name,
    allow_profiles_outside_organization: allow_profiles_outside_organization,
    domains: domains,
    stripe_customer_id: stripe_customer_id,
    created_at: created_at,
    updated_at: updated_at,
  }
end