Class: HasuraHandler::Event
- Inherits:
-
Object
- Object
- HasuraHandler::Event
- Defined in:
- lib/hasura_handler/event.rb
Instance Attribute Summary collapse
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#event ⇒ Object
readonly
Returns the value of attribute event.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#op ⇒ Object
readonly
Returns the value of attribute op.
-
#raw_event ⇒ Object
readonly
Returns the value of attribute raw_event.
-
#schema ⇒ Object
readonly
Returns the value of attribute schema.
-
#table ⇒ Object
readonly
Returns the value of attribute table.
-
#trigger ⇒ Object
readonly
Returns the value of attribute trigger.
Instance Method Summary collapse
-
#initialize(event) ⇒ Event
constructor
A new instance of Event.
- #valid? ⇒ Boolean
Constructor Details
#initialize(event) ⇒ Event
Returns a new instance of Event.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/hasura_handler/event.rb', line 13 def initialize(event) @id = event['id'] @table = event['table']['name'] @schema = event['table']['schema'] @trigger = event['trigger']['name'] @event = event['event'] @op = event['event']['op'] @created_at = event['created_at'] @raw_event = event @errors = {} [ :validate_simple_fields, :validate_table, :validate_trigger, :validate_event ].each{ |check| self.send(check) } end |
Instance Attribute Details
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
3 4 5 |
# File 'lib/hasura_handler/event.rb', line 3 def created_at @created_at end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
3 4 5 |
# File 'lib/hasura_handler/event.rb', line 3 def errors @errors end |
#event ⇒ Object (readonly)
Returns the value of attribute event.
3 4 5 |
# File 'lib/hasura_handler/event.rb', line 3 def event @event end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/hasura_handler/event.rb', line 3 def id @id end |
#op ⇒ Object (readonly)
Returns the value of attribute op.
3 4 5 |
# File 'lib/hasura_handler/event.rb', line 3 def op @op end |
#raw_event ⇒ Object (readonly)
Returns the value of attribute raw_event.
3 4 5 |
# File 'lib/hasura_handler/event.rb', line 3 def raw_event @raw_event end |
#schema ⇒ Object (readonly)
Returns the value of attribute schema.
3 4 5 |
# File 'lib/hasura_handler/event.rb', line 3 def schema @schema end |
#table ⇒ Object (readonly)
Returns the value of attribute table.
3 4 5 |
# File 'lib/hasura_handler/event.rb', line 3 def table @table end |
#trigger ⇒ Object (readonly)
Returns the value of attribute trigger.
3 4 5 |
# File 'lib/hasura_handler/event.rb', line 3 def trigger @trigger end |
Instance Method Details
#valid? ⇒ Boolean
32 33 34 |
# File 'lib/hasura_handler/event.rb', line 32 def valid? @errors.blank? end |