2016-09-24 03:00:46 +00:00
|
|
|
# frozen_string_literal: true
|
2017-11-25 19:23:47 +00:00
|
|
|
|
2016-11-05 16:34:50 +00:00
|
|
|
Webhooks::Slack::Base = Struct.new(:webhook, :event) do
|
2016-03-12 23:36:38 +00:00
|
|
|
include Routing
|
|
|
|
|
|
|
|
def username
|
2016-07-26 00:14:23 +00:00
|
|
|
'Metamaps Bot'
|
2016-03-12 23:36:38 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def icon_url
|
2016-07-26 00:14:23 +00:00
|
|
|
'https://pbs.twimg.com/profile_images/539300245029392385/dJ1bwnw7.jpeg'
|
2016-03-12 23:36:38 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def text
|
2016-07-26 00:14:23 +00:00
|
|
|
'something'
|
2016-03-12 23:36:38 +00:00
|
|
|
end
|
|
|
|
|
2016-12-13 03:28:10 +00:00
|
|
|
delegate :channel, to: :webhook
|
2016-11-05 16:34:50 +00:00
|
|
|
|
2016-07-26 00:14:23 +00:00
|
|
|
alias_method :read_attribute_for_serialization, :send
|
2016-03-12 23:36:38 +00:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def view_map_on_metamaps(text = nil)
|
2016-04-14 18:35:28 +00:00
|
|
|
"<#{map_url(event.map)}|#{text || event.map.name}>"
|
2016-03-12 23:36:38 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def eventable
|
|
|
|
@eventable ||= event.eventable
|
|
|
|
end
|
|
|
|
|
|
|
|
def author
|
|
|
|
@author ||= eventable.author
|
|
|
|
end
|
|
|
|
end
|