Class: WorkOS::Organization

Inherits:
Types::BaseModel show all
Defined in:
lib/workos/organizations/organization.rb

Constant Summary collapse

HASH_ATTRS =
{
  object: :object,
  id: :id,
  name: :name,
  domains: :domains,
  metadata: :metadata,
  external_id: :external_id,
  stripe_customer_id: :stripe_customer_id,
  created_at: :created_at,
  updated_at: :updated_at,
  allow_profiles_outside_organization: :allow_profiles_outside_organization
}.freeze

Instance Attribute Summary collapse

Attributes inherited from Types::BaseModel

#last_response

Instance Method Summary collapse

Methods inherited from Types::BaseModel

normalize

Methods included from HashProvider

#inspect, #to_h, #to_json

Constructor Details

#initialize(json) ⇒ Organization

Returns a new instance of Organization.



41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/workos/organizations/organization.rb', line 41

def initialize(json)
  hash = self.class.normalize(json)
  @object = hash[:object]
  @id = hash[:id]
  @name = hash[:name]
  @domains = (hash[:domains] || []).map { |item| item ? WorkOS::OrganizationDomain.new(item) : nil }
  @metadata = hash[:metadata] || {}
  @external_id = hash[:external_id]
  @stripe_customer_id = hash[:stripe_customer_id]
  @created_at = hash[:created_at]
  @updated_at = hash[:updated_at]
  @allow_profiles_outside_organization = hash[:allow_profiles_outside_organization]
end

Instance Attribute Details

#allow_profiles_outside_organizationObject

Deprecated.

Whether the Organization allows profiles outside of its managed domains.



23
24
25
26
27
28
29
30
31
32
# File 'lib/workos/organizations/organization.rb', line 23

attr_accessor \
:object,
:id,
:name,
:domains,
:metadata,
:external_id,
:stripe_customer_id,
:created_at,
:updated_at

#created_atObject

Returns the value of attribute created_at.



23
24
25
# File 'lib/workos/organizations/organization.rb', line 23

def created_at
  @created_at
end

#domainsObject

Returns the value of attribute domains.



23
24
25
# File 'lib/workos/organizations/organization.rb', line 23

def domains
  @domains
end

#external_idObject

Returns the value of attribute external_id.



23
24
25
# File 'lib/workos/organizations/organization.rb', line 23

def external_id
  @external_id
end

#idObject

Returns the value of attribute id.



23
24
25
# File 'lib/workos/organizations/organization.rb', line 23

def id
  @id
end

#metadataObject

Returns the value of attribute metadata.



23
24
25
# File 'lib/workos/organizations/organization.rb', line 23

def 
  @metadata
end

#nameObject

Returns the value of attribute name.



23
24
25
# File 'lib/workos/organizations/organization.rb', line 23

def name
  @name
end

#objectObject

Returns the value of attribute object.



23
24
25
# File 'lib/workos/organizations/organization.rb', line 23

def object
  @object
end

#stripe_customer_idObject

Returns the value of attribute stripe_customer_id.



23
24
25
# File 'lib/workos/organizations/organization.rb', line 23

def stripe_customer_id
  @stripe_customer_id
end

#updated_atObject

Returns the value of attribute updated_at.



23
24
25
# File 'lib/workos/organizations/organization.rb', line 23

def updated_at
  @updated_at
end