Sha256: 85360c97bcc8ba07425af21bec1d49bff7f9bb41feb259552ccdd60b9e9051d3

Contents?: true

Size: 993 Bytes

Versions: 18

Compression:

Stored size: 993 Bytes

Contents

# frozen_string_literal: true

module WorkOS
  # The Directory class provides a lightweight wrapper around
  # a WorkOS Directory resource. This class is not meant to be instantiated
  # in user space, and is instantiated internally but exposed.
  class Directory
    include HashProvider

    attr_accessor :id, :domain, :name, :type, :state, :organization_id, :created_at, :updated_at

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

      @id = hash[:id]
      @name = hash[:name]
      @domain = hash[:domain]
      @type = hash[:type]
      @state = hash[:state]
      @organization_id = hash[:organization_id]
      @created_at = hash[:created_at]
      @updated_at = hash[:updated_at]
    end

    def to_json(*)
      {
        id: id,
        name: name,
        domain: domain,
        type: type,
        state: state,
        organization_id: organization_id,
        created_at: created_at,
        updated_at: updated_at,
      }
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
workos-5.9.0 lib/workos/directory.rb
workos-5.8.0 lib/workos/directory.rb
workos-5.7.0 lib/workos/directory.rb
workos-5.6.0 lib/workos/directory.rb
workos-5.5.1 lib/workos/directory.rb
workos-5.5.0 lib/workos/directory.rb
workos-5.4.0 lib/workos/directory.rb
workos-5.3.0 lib/workos/directory.rb
workos-5.2.1 lib/workos/directory.rb
workos-5.2.0 lib/workos/directory.rb
workos-5.1.0 lib/workos/directory.rb
workos-5.0.0 lib/workos/directory.rb
workos-4.8.0 lib/workos/directory.rb
workos-4.5.0 lib/workos/directory.rb
workos-4.4.0 lib/workos/directory.rb
workos-4.3.0 lib/workos/directory.rb
workos-4.2.1 lib/workos/directory.rb
workos-4.2.0 lib/workos/directory.rb