module Flowdock::Rails
Constants
- VERSION
Private Instance Methods
formatted_attributes_for_flow(hash, changes=false)
click to toggle source
# File lib/flowdock/rails.rb, line 58 def formatted_attributes_for_flow(hash, changes=false) case ENV["FLOWDOCK_RAILS_FORMAT"] when "json" "<pre>#{ JSON.pretty_generate(hash) }</pre>" else if hash.any? %Q{ <table class="diff"> <tbody> #{ hash.map{|k,v| "<tr><th>#{k}</th><td>#{changes ? v.first : v}</td><td>#{changes ? v.last : ""}</td></tr>" }.join("\n") } </tbody> </table> }.strip else "<pre>#{I18n.t :nothing_to_show, scope: :flowdock_rails}</pre>" end end end
push_create_notification_to_flow()
click to toggle source
# File lib/flowdock/rails.rb, line 77 def push_create_notification_to_flow self.class.push_to_flow( subject: I18n.t(:"resource.created", klass: self.class.model_name.human, scope: :flowdock_rails), content: %Q{ <h2>#{I18n.t :"resource.created", klass: self.class.model_name.human, scope: :flowdock_rails }</h2> <h3>#{I18n.t :"attributes", scope: :flowdock_rails }</h3> #{formatted_attributes_for_flow self.attributes} }, tags: [self.class.model_name.param_key, "resource", "created", ::Rails.env] ) end
push_update_notification_to_flow()
click to toggle source
# File lib/flowdock/rails.rb, line 89 def push_update_notification_to_flow self.class.push_to_flow( subject: I18n.t(:"resource.updated", klass: self.class.model_name.human, scope: :flowdock_rails), content: %Q{ <h2>#{I18n.t :"resource.updated", klass: self.class.model_name.human, scope: :flowdock_rails }</h2> <h3>#{I18n.t :"changes", scope: :flowdock_rails }</h3> #{formatted_attributes_for_flow self.changes, true} <h3>#{I18n.t :"attributes", scope: :flowdock_rails }</h3> #{formatted_attributes_for_flow self.attributes} }, tags: [self.class.model_name.param_key, "resource", "updated", ::Rails.env] ) end