metamaps--metamaps/app/models/webhooks/slack/base.rb

35 lines
597 B
Ruby
Raw Permalink Normal View History

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