Sha256: 21af99505dea410483b4bc5a6325aceaf3ff38d25b2bccd7961c108893f106f7
Contents?: true
Size: 1014 Bytes
Versions: 13
Compression:
Stored size: 1014 Bytes
Contents
# frozen_string_literal: true # typed: true module WorkOS # The Webhook class provides a lightweight wrapper around # a WorkOS Webhook resource. This class is not meant to be instantiated # in user space, and is instantiated internally but exposed. class Webhook include HashProvider extend T::Sig attr_accessor :id, :event, :data sig { params(json: String).void } def initialize(json) raw = parse_json(json) @id = T.let(raw.id, String) @event = T.let(raw.event, String) @data = raw.data end def to_json(*) { id: id, event: event, data: data, } end private sig do params( json_string: String, ).returns(WorkOS::Types::WebhookStruct) end def parse_json(json_string) hash = JSON.parse(json_string, symbolize_names: true) WorkOS::Types::WebhookStruct.new( id: hash[:id], event: hash[:event], data: hash[:data], ) end end end
Version data entries
13 entries across 13 versions & 1 rubygems