Sha256: 81b2e971cd87e31e34794dd3c2ebe46be560c2b59af48fa4ac48f472b9253f6b
Contents?: true
Size: 1.39 KB
Versions: 2
Compression:
Stored size: 1.39 KB
Contents
# frozen_string_literal: true # typed: true module WorkOS # The OrganizationMembership class provides a lightweight wrapper around a WorkOS OrganizationMembership # resource. This class is not meant to be instantiated in a user space, # and is instantiated internally but exposed. class OrganizationMembership include HashProvider extend T::Sig attr_accessor :id, :user_id, :organization_id, :created_at, :updated_at sig { params(json: String).void } def initialize(json) raw = parse_json(json) @id = T.let(raw.id, String) @user_id = T.let(raw.user_id, String) @organization_id = raw.organization_id @created_at = T.let(raw.created_at, String) @updated_at = T.let(raw.updated_at, String) end def to_json(*) { id: id, user_id: user_id, organization_id: organization_id, created_at: created_at, updated_at: updated_at, } end private sig { params(json_string: String).returns(WorkOS::Types::OrganizationMembershipStruct) } def parse_json(json_string) hash = JSON.parse(json_string, symbolize_names: true) WorkOS::Types::OrganizationMembershipStruct.new( id: hash[:id], user_id: hash[:user_id], organization_id: hash[:organization_id], created_at: hash[:created_at], updated_at: hash[:updated_at], ) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
workos-3.1.0 | lib/workos/organization_membership.rb |
workos-3.0.0 | lib/workos/organization_membership.rb |