metamaps--metamaps/app/models/webhooks/slack/base.rb
2016-12-14 19:58:10 -05:00

36 lines
603 B
Ruby

# frozen_string_literal: true
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
def channel
webhook.channel
end
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