Class: Webhooks::EventSerializer
- Inherits:
-
Object
- Object
- Webhooks::EventSerializer
- Includes:
- ActiveModel::Serializers::JSON
- Defined in:
- app/models/webhooks/event_serializer.rb
Instance Attribute Summary collapse
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#event ⇒ Object
readonly
Returns the value of attribute event.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #attributes ⇒ Object
-
#initialize(request) ⇒ EventSerializer
constructor
A new instance of EventSerializer.
Constructor Details
#initialize(request) ⇒ EventSerializer
Returns a new instance of EventSerializer.
12 13 14 15 16 17 18 19 |
# File 'app/models/webhooks/event_serializer.rb', line 12 def initialize(request) event = request.event @id = event.id @type = event.event_type @event = ActiveSupport::JSON.decode(event.event) @created_at = event.created_at.iso8601(6) end |
Instance Attribute Details
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
10 11 12 |
# File 'app/models/webhooks/event_serializer.rb', line 10 def created_at @created_at end |
#event ⇒ Object (readonly)
Returns the value of attribute event.
9 10 11 |
# File 'app/models/webhooks/event_serializer.rb', line 9 def event @event end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'app/models/webhooks/event_serializer.rb', line 7 def id @id end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
8 9 10 |
# File 'app/models/webhooks/event_serializer.rb', line 8 def type @type end |
Instance Method Details
#attributes ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'app/models/webhooks/event_serializer.rb', line 21 def attributes { 'id' => id, 'type' => type, 'event' => event, 'created_at' => created_at, } end |