Class: TurnKit::Event
- Inherits:
-
Object
- Object
- TurnKit::Event
- Defined in:
- lib/turnkit/event.rb
Instance Attribute Summary collapse
-
#conversation_id ⇒ Object
readonly
Returns the value of attribute conversation_id.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
-
#turn_id ⇒ Object
readonly
Returns the value of attribute turn_id.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type:, turn_id:, conversation_id:, payload: {}, created_at: Clock.now) ⇒ Event
constructor
A new instance of Event.
- #to_h ⇒ Object
Constructor Details
#initialize(type:, turn_id:, conversation_id:, payload: {}, created_at: Clock.now) ⇒ Event
Returns a new instance of Event.
7 8 9 10 11 12 13 |
# File 'lib/turnkit/event.rb', line 7 def initialize(type:, turn_id:, conversation_id:, payload: {}, created_at: Clock.now) @type = type.to_s @turn_id = turn_id @conversation_id = conversation_id @payload = payload || {} @created_at = created_at end |
Instance Attribute Details
#conversation_id ⇒ Object (readonly)
Returns the value of attribute conversation_id.
5 6 7 |
# File 'lib/turnkit/event.rb', line 5 def conversation_id @conversation_id end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
5 6 7 |
# File 'lib/turnkit/event.rb', line 5 def created_at @created_at end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
5 6 7 |
# File 'lib/turnkit/event.rb', line 5 def payload @payload end |
#turn_id ⇒ Object (readonly)
Returns the value of attribute turn_id.
5 6 7 |
# File 'lib/turnkit/event.rb', line 5 def turn_id @turn_id end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
5 6 7 |
# File 'lib/turnkit/event.rb', line 5 def type @type end |
Instance Method Details
#to_h ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/turnkit/event.rb', line 15 def to_h { "type" => type, "turn_id" => turn_id, "conversation_id" => conversation_id, "payload" => payload, "created_at" => created_at } end |