class HipTail::Event

Attributes

authority[RW]
raw[R]

Public Class Methods

new(params) click to toggle source

@return [HipTail::Event]

# File lib/hiptail/event.rb, line 9
def initialize(params)
  @raw = params.dup
end
parse(params) click to toggle source

@param [Hash] params @return [HipTail::Event]

# File lib/hiptail/event.rb, line 34
def parse(params)
  type = params['event']

  case params['event']
  when 'room_message'
    return Event::RoomMessage.new(params)
  when 'room_notification'
    return Event::RoomNotification.new(params)
  when 'room_topic_change'
    return Event::RoomTopicChange.new(params)
  when 'room_enter'
    return Event::RoomEnter.new(params)
  when 'room_exit'
    return Event::RoomExit.new(params)
  else
    return Event.new(params)
  end
end

Public Instance Methods

oauth_client_id() click to toggle source

@attribute [r] oauth_client_id @return [String]

# File lib/hiptail/event.rb, line 21
def oauth_client_id
  @raw['oauth_client_id']
end
type() click to toggle source

@attribute [r] type @return [String]

# File lib/hiptail/event.rb, line 15
def type
  @raw['event']
end
webhook_id() click to toggle source

@attribute [r] webhook_id @return [String]

# File lib/hiptail/event.rb, line 27
def webhook_id
  @raw['webhook_id']
end