Sha256: 25fe35215419b777dd9262df0dcd62553e890f4d32619c200b2e67fe58a530d8

Contents?: true

Size: 1.03 KB

Versions: 14

Compression:

Stored size: 1.03 KB

Contents

require 'rollbar/request_data_extractor'

module Rollbar
  module Rails
    module ControllerMethods
      include RequestDataExtractor

      def rollbar_person_data
        user = send(Rollbar.configuration.person_method)
        # include id, username, email if non-empty
        if user
          {
            :id => (user.send(Rollbar.configuration.person_id_method) rescue nil),
            :username => (user.send(Rollbar.configuration.person_username_method) rescue nil),
            :email => (user.send(Rollbar.configuration.person_email_method) rescue nil)
          }
        else
          {}
        end
      rescue NoMethodError, NameError
        {}
      end

      def rollbar_request_data
        extract_request_data_from_rack(request.env)
      end

      # for backwards compatabilty with the old ratchetio-gem
      def ratchetio_person_data
        rollbar_person_data
      end

      # for backwards compatabilty with the old ratchetio-gem
      def ratchetio_request_data
        rollbar_request_data
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rollbar-2.18.2 lib/rollbar/plugins/rails/controller_methods.rb
rollbar-2.18.0 lib/rollbar/plugins/rails/controller_methods.rb
rollbar-2.17.0 lib/rollbar/plugins/rails/controller_methods.rb
rollbar-2.16.4 lib/rollbar/plugins/rails/controller_methods.rb
rollbar-2.16.3 lib/rollbar/plugins/rails/controller_methods.rb
rollbar-2.16.2 lib/rollbar/plugins/rails/controller_methods.rb
rollbar-2.16.0 lib/rollbar/plugins/rails/controller_methods.rb
rollbar-2.15.6 lib/rollbar/plugins/rails/controller_methods.rb
rollbar-2.15.5 lib/rollbar/plugins/rails/controller_methods.rb
rollbar-2.15.4 lib/rollbar/plugins/rails/controller_methods.rb
rollbar-2.15.3 lib/rollbar/plugins/rails/controller_methods.rb
rollbar-2.15.2 lib/rollbar/plugins/rails/controller_methods.rb
rollbar-2.15.1 lib/rollbar/plugins/rails/controller_methods.rb
rollbar-2.15.0 lib/rollbar/plugins/rails/controller_methods.rb