Class: WorkOS::WebhookEndpoint

Inherits:
Object
  • Object
show all
Includes:
HashProvider
Defined in:
lib/workos/webhooks/webhook_endpoint.rb

Constant Summary collapse

HASH_ATTRS =
{
  object: :object,
  id: :id,
  endpoint_url: :endpoint_url,
  secret: :secret,
  status: :status,
  events: :events,
  created_at: :created_at,
  updated_at: :updated_at
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HashProvider

#inspect, #to_h, #to_json

Constructor Details

#initialize(json) ⇒ WebhookEndpoint

Returns a new instance of WebhookEndpoint.



32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/workos/webhooks/webhook_endpoint.rb', line 32

def initialize(json)
  hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true)
  hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String)
  @object = hash[:object]
  @id = hash[:id]
  @endpoint_url = hash[:endpoint_url]
  @secret = hash[:secret]
  @status = hash[:status]
  @events = hash[:events] || []
  @created_at = hash[:created_at]
  @updated_at = hash[:updated_at]
end

Instance Attribute Details

#created_atObject

Returns the value of attribute created_at.



22
23
24
# File 'lib/workos/webhooks/webhook_endpoint.rb', line 22

def created_at
  @created_at
end

#endpoint_urlObject

Returns the value of attribute endpoint_url.



22
23
24
# File 'lib/workos/webhooks/webhook_endpoint.rb', line 22

def endpoint_url
  @endpoint_url
end

#eventsObject

Returns the value of attribute events.



22
23
24
# File 'lib/workos/webhooks/webhook_endpoint.rb', line 22

def events
  @events
end

#idObject

Returns the value of attribute id.



22
23
24
# File 'lib/workos/webhooks/webhook_endpoint.rb', line 22

def id
  @id
end

#objectObject

Returns the value of attribute object.



22
23
24
# File 'lib/workos/webhooks/webhook_endpoint.rb', line 22

def object
  @object
end

#secretObject

Returns the value of attribute secret.



22
23
24
# File 'lib/workos/webhooks/webhook_endpoint.rb', line 22

def secret
  @secret
end

#statusObject

Returns the value of attribute status.



22
23
24
# File 'lib/workos/webhooks/webhook_endpoint.rb', line 22

def status
  @status
end

#updated_atObject

Returns the value of attribute updated_at.



22
23
24
# File 'lib/workos/webhooks/webhook_endpoint.rb', line 22

def updated_at
  @updated_at
end