module Flowdock::Rails::ClassMethods
Public Instance Methods
flow()
click to toggle source
# File lib/flowdock/rails.rb, line 11 def flow api_token = (ENV["FLOWDOCK_RAILS_API_TOKEN"].try(:split, ",") || []).map(&:strip) @flow ||= Flowdock::Flow.new( flowdock_rails_options.reverse_merge( api_token: api_token, source: "Flowdock Notifier", project: ( ENV["FLOWDOCK_RAILS_NAME"] || ::Rails.application.class.parent_name ).parameterize, from: { name: ( ENV["FLOWDOCK_RAILS_FROM_NAME"] || "Marv" ), address: ( ENV["FLOWDOCK_RAILS_FROM_EMAIL"] || "marv@dreimannzelt.de") } ) ) end
notify_flow(options = {})
click to toggle source
# File lib/flowdock/rails.rb, line 47 def notify_flow(options = {}) cattr_accessor :flowdock_rails_options self.flowdock_rails_options = options after_create :push_create_notification_to_flow after_update :push_update_notification_to_flow end
push_to_flow(options = {})
click to toggle source
# File lib/flowdock/rails.rb, line 34 def push_to_flow(options = {}) begin if push_to_flow_enabled? flow.push_to_team_inbox(options) else logger.info "[Flowdock::Rails] Notification is disabled" end rescue Exception => e logger.fatal "[Flowdock::Rails] Something went wrong with pushing to the flow:" logger.fatal "[Flowdock::Rails] #{e}" end end
push_to_flow_enabled?()
click to toggle source
# File lib/flowdock/rails.rb, line 26 def push_to_flow_enabled? ( !::Rails.env.test? ) && ( ( ENV["FLOWDOCK_RAILS_ENABLED"] == "true" ) || ( !(ENV["FLOWDOCK_RAILS_ENABLED"] == "false") && ::Rails.env.production? ) ) end