Sha256: ed683121f4a0f23d68e7a72537149c9660c2369035fda1f27e2231da1c37ca18

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

# frozen_string_literal: true

module WorkOS
  # 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.
  class Organization
    include HashProvider

    attr_accessor(
      :id,
      :domains,
      :stripe_customer_id,
      :name,
      :allow_profiles_outside_organization,
      :created_at,
      :updated_at,
    )

    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

    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
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
workos-5.13.0 lib/workos/organization.rb
workos-5.12.0 lib/workos/organization.rb