Class: Skypekit::FFI::Event
- Inherits:
-
FFI::ManagedStruct
- Object
- FFI::ManagedStruct
- Skypekit::FFI::Event
- Defined in:
- lib/skypekit/ffi/event.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.release(pointer) ⇒ Object
7 8 9 |
# File 'lib/skypekit/ffi/event.rb', line 7 def self.release(pointer) FFI.skypekit_event_free(pointer) end |
Instance Method Details
#created_at ⇒ Object
25 26 27 |
# File 'lib/skypekit/ffi/event.rb', line 25 def created_at @created_at ||= Time.at(self[:timestamp]) end |
#data ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/skypekit/ffi/event.rb', line 29 def data @data ||= case self.type when :account_status AccountStatusData.new(self[:data]) when :chat_message ChatMessageData.new(self[:data]) else raise NotImplementedError, "event type #{type.inspect} is not implemeted" end end |
#inspect ⇒ Object
41 42 43 |
# File 'lib/skypekit/ffi/event.rb', line 41 def inspect "#{super} type=#{type} created_at=#{created_at}" end |
#timestamp ⇒ Object
21 22 23 |
# File 'lib/skypekit/ffi/event.rb', line 21 def self[:timestamp] end |
#type ⇒ Object
17 18 19 |
# File 'lib/skypekit/ffi/event.rb', line 17 def type self[:type] end |