Sha256: 3270a0bdfb7071e78d1bc89b806ada4a7cd6de72f553cfb55d5dcda34c390e8c
Contents?: true
Size: 1.58 KB
Versions: 7
Compression:
Stored size: 1.58 KB
Contents
# frozen_string_literal: true # typed: true module WorkOS # 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 class Connection extend T::Sig attr_accessor :id, :name, :connection_type, :domains, :organization_id, :state, :status sig { params(json: String).void } def initialize(json) raw = parse_json(json) @id = T.let(raw.id, String) @name = T.let(raw.name, String) @connection_type = T.let(raw.connection_type, String) @domains = T.let(raw.domains, Array) @organization_id = T.let(raw.organization_id, String) @state = T.let(raw.state, String) @status = T.let(raw.status, String) end def to_json(*) { id: id, name: name, connection_type: connection_type, domains: domains, organization_id: organization_id, state: state, status: status, } end private sig { params(json_string: String).returns(WorkOS::Types::ConnectionStruct) } def parse_json(json_string) hash = JSON.parse(json_string, symbolize_names: true) WorkOS::Types::ConnectionStruct.new( 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], ) end end end
Version data entries
7 entries across 7 versions & 1 rubygems