Class: Relax::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/relax/event.rb

Constant Summary collapse

ATTRIBUTES =
[:type, :user_uid, :channel_uid, :team_uid, :im, :text,
:relax_bot_uid, :timestamp, :provider, :event_timestamp,
:namespace]

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Event

Returns a new instance of Event.



9
10
11
# File 'lib/relax/event.rb', line 9

def initialize(opts = {})
  opts.each { |k,v| self.send("#{k}=", v) if self.respond_to?("#{k}=") }
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



19
20
21
22
23
24
# File 'lib/relax/event.rb', line 19

def ==(other)
  other.respond_to?('channel_uid') &&
  other.respond_to?('timestamp') &&
  self.channel_uid == other.channel_uid &&
  self.timestamp == other.timestamp
end

#to_hashObject



13
14
15
16
17
# File 'lib/relax/event.rb', line 13

def to_hash
  hash = {}
  ATTRIBUTES.each { |a| hash[a] = self.send(a) }
  hash
end