class FlowdockNotifications::MessageNotification
Public Class Methods
new(client, flow_name, message)
click to toggle source
# File lib/flowdock-notifications/message_notification.rb, line 5 def initialize(client, flow_name, message) @message = message @flow_name = flow_name @client = client end
Public Instance Methods
show!()
click to toggle source
# File lib/flowdock-notifications/message_notification.rb, line 11 def show! Notify.notify title, content, options end
Protected Instance Methods
content()
click to toggle source
# File lib/flowdock-notifications/message_notification.rb, line 30 def content return nil if @message['content'].nil? if @message['content'].is_a? String @message['content'] elsif @message['content']['subject'] @message['content']['subject'] elsif @message['content']['content'] @message['content']['content'] else @message['content'].to_json end end
icon()
click to toggle source
# File lib/flowdock-notifications/message_notification.rb, line 44 def icon @icon ||= @client.avatar(@message['user']) end
options()
click to toggle source
# File lib/flowdock-notifications/message_notification.rb, line 16 def options opts = { app_name: "flowdock-notifications" } opts[:icon] = icon if icon opts end
title()
click to toggle source
# File lib/flowdock-notifications/message_notification.rb, line 24 def title return @title if @title user = @client.user(@message['user']) @title ||= "[#{@flow_name}] #{user.nil? ? '' : user['nick']}" end