Sha256: 7e7c515d37a135a49b76fd30bd1780ba11ed5e726ae0b368e89c3dc506a4f7c3

Contents?: true

Size: 1.41 KB

Versions: 19

Compression:

Stored size: 1.41 KB

Contents

$stdout.sync = true
require 'rubygems'
require 'bundler'
require 'bundler/setup'
ENV['RACK_ENV'] ||= ENV['RAILS_ENV'].present? ? ENV['RAILS_ENV'] : 'development'
Bundler.require :default, (ENV['RACK_ENV'] || 'development').to_sym


class SinatraApp < Sinatra::Base
  use Rack::Config do |env|
    env["action_dispatch.parameter_filter"] = [:password] # This is highly recommended.  It will prevent the ExceptionNotification email from including your users' passwords
  end

  use ExceptionNotification::Rack,
    :asana => {
      asana_api_key: ENV['ASANA_API_KEY'],
      workspace: ENV['ASANA_WORKSPACE_ID'],
      assignee: 'me',
      assignee_status: 'today', # 'today'
      due_at:  Time.now.iso8601,
      due_on: nil,
      hearted: false,
      hearts: [],
      projects: [],
      followers: [],
      memberships: [],
      tags: [],
      name: nil,
      notes: '',
      template_path: nil
    }

  get '/' do
    raise StandardError, "ERROR: #{params[:error]}" unless params[:error].blank?
    'Everything is fine! Now, lets break things clicking <a href="/?error=ops"> here </a>. Dont forget to see the asana tasks at <a href="http://asana.com">Asana</a> !'
  end

  get '/background_notification' do
    begin
      1/0
    rescue Exception => e
      ExceptionNotifier.notify_exception(e, :data => {:msg => "Cannot divide by zero!"})
    end
    'Check notification at <a href="http://asana.com">Asana</a>.'
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
asana_exception_notifier-0.3.6 examples/sinatra/sinatra_app.rb
asana_exception_notifier-0.3.5 examples/sinatra/sinatra_app.rb
asana_exception_notifier-0.3.4 examples/sinatra/sinatra_app.rb
asana_exception_notifier-0.3.3 examples/sinatra/sinatra_app.rb
asana_exception_notifier-0.3.2 examples/sinatra/sinatra_app.rb
asana_exception_notifier-0.3.1 examples/sinatra/sinatra_app.rb
asana_exception_notifier-0.2.2 examples/sinatra/sinatra_app.rb
asana_exception_notifier-0.2.1 examples/sinatra/sinatra_app.rb
asana_exception_notifier-0.2.0 examples/sinatra/sinatra_app.rb
asana_exception_notifier-0.1.0 examples/sinatra/sinatra_app.rb
asana_exception_notifier-0.0.9 examples/sinatra/sinatra_app.rb
asana_exception_notifier-0.0.8 examples/sinatra/sinatra_app.rb
asana_exception_notifier-0.0.7 examples/sinatra/sinatra_app.rb
asana_exception_notifier-0.0.6 examples/sinatra/sinatra_app.rb
asana_exception_notifier-0.0.5 examples/sinatra/sinatra_app.rb
asana_exception_notifier-0.0.4 examples/sinatra/sinatra_app.rb
asana_exception_notifier-0.0.3 examples/sinatra/sinatra_app.rb
asana_exception_notifier-0.0.2 examples/sinatra/sinatra_app.rb
asana_exception_notifier-0.0.1 examples/sinatra/sinatra_app.rb