Class: Clever::Types::Event
Constant Summary collapse
- TYPE_MAP =
{ 'sections' => ::Clever::Types::Section, 'teachers' => ::Clever::Types::Teacher, 'students' => ::Clever::Types::Student }.freeze
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#object ⇒ Object
readonly
Returns the value of attribute object.
-
#provider ⇒ Object
readonly
Returns the value of attribute provider.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#uid ⇒ Object
readonly
Returns the value of attribute uid.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Event
constructor
A new instance of Event.
Methods inherited from Base
Constructor Details
#initialize(attributes = {}) ⇒ Event
Returns a new instance of Event.
22 23 24 25 26 27 |
# File 'lib/clever/types/event.rb', line 22 def initialize(attributes = {}, *) @uid = attributes['id'] @type, @action = attributes['type'].split('.') @object = TYPE_MAP[@type]&.new(attributes['data']['object']) @provider = 'clever' end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
10 11 12 |
# File 'lib/clever/types/event.rb', line 10 def action @action end |
#object ⇒ Object (readonly)
Returns the value of attribute object.
10 11 12 |
# File 'lib/clever/types/event.rb', line 10 def object @object end |
#provider ⇒ Object (readonly)
Returns the value of attribute provider.
10 11 12 |
# File 'lib/clever/types/event.rb', line 10 def provider @provider end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
10 11 12 |
# File 'lib/clever/types/event.rb', line 10 def type @type end |
#uid ⇒ Object (readonly)
Returns the value of attribute uid.
10 11 12 |
# File 'lib/clever/types/event.rb', line 10 def uid @uid end |