Class: WorkOS::Event
- Inherits:
-
Object
- Object
- WorkOS::Event
- Includes:
- HashProvider
- Defined in:
- lib/workos/event.rb
Overview
The Event class provides a lightweight wrapper around a WorkOS Event resource. This class is not meant to be instantiated in user space, and is instantiated internally but exposed.
Instance Attribute Summary collapse
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#data ⇒ Object
Returns the value of attribute data.
-
#event ⇒ Object
Returns the value of attribute event.
-
#id ⇒ Object
Returns the value of attribute id.
Instance Method Summary collapse
-
#initialize(json) ⇒ Event
constructor
A new instance of Event.
- #to_json ⇒ Object
Methods included from HashProvider
Constructor Details
#initialize(json) ⇒ Event
Returns a new instance of Event.
12 13 14 15 16 17 18 19 |
# File 'lib/workos/event.rb', line 12 def initialize(json) hash = JSON.parse(json, symbolize_names: true) @id = hash[:id] @event = hash[:event] @created_at = hash[:created_at] @data = hash[:data] end |
Instance Attribute Details
#created_at ⇒ Object
Returns the value of attribute created_at.
10 11 12 |
# File 'lib/workos/event.rb', line 10 def created_at @created_at end |
#data ⇒ Object
Returns the value of attribute data.
10 11 12 |
# File 'lib/workos/event.rb', line 10 def data @data end |
#event ⇒ Object
Returns the value of attribute event.
10 11 12 |
# File 'lib/workos/event.rb', line 10 def event @event end |
#id ⇒ Object
Returns the value of attribute id.
10 11 12 |
# File 'lib/workos/event.rb', line 10 def id @id end |
Instance Method Details
#to_json ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/workos/event.rb', line 21 def to_json(*) { id: id, event: event, data: data, created_at: created_at, } end |