lib/raygun/client.rb
def build_payload_hash(exception_instance, env = {}, user = nil)
        Raygun.log('building payload hash')
        custom_data = filter_custom_data(env) || {}
        exception_custom_data = if exception_instance.respond_to?(:raygun_custom_data)
                                  exception_instance.raygun_custom_data
                                else
                                  {}
                                end

        tags = env.delete(:tags) || []

        if rails_env
          tags << rails_env
        else
          tags << rack_env
        end

        configuration_tags = []
        if Raygun.configuration.tags.is_a?(Proc)
          configuration_tags = Raygun.configuration.tags.call(exception_instance, env)
        else
          configuration_tags = Raygun.configuration.tags
        end

        Raygun.log('set tags')

        grouping_key = env.delete(:grouping_key)

        configuration_custom_data = Raygun.configuration.custom_data
        configured_custom_data = if configuration_custom_data.is_a?(Proc)
                                  configuration_custom_data.call(exception_instance, env)
                                 else
                                  configuration_custom_data
                                 end

        Raygun.log('set custom data')

        error_details = {
            machineName:    hostname,
            version:        version,
            client:         client_details,
            error:          error_details(exception_instance),
            userCustomData: exception_custom_data.merge(custom_data).merge(configured_custom_data),
            tags:           configuration_tags.concat(tags).compact.uniq,
            request:        request_information(env),
            environment:    {
              utcOffset: Time.now.utc_offset / 3600
            }
        }
        store = ::Raygun::Breadcrumbs::Store
        error_details[:breadcrumbs] = store.take_until_size(MAX_BREADCRUMBS_SIZE).map(&:build_payload) if store.any?

        Raygun.log('set details and breadcrumbs')

        error_details.merge!(groupingKey: grouping_key) if grouping_key

        user_details = if affected_user_present?(env)
                         user_information(env)
                       elsif user != nil
                         AffectedUser.information_hash(user)
                       end
        error_details.merge!(user: user_details) unless user_details == nil

        Raygun.log('set user details')

        if Raygun.configuration.filter_payload_with_whitelist
          Raygun.log('filtering payload with whitelist')
          error_details = filter_payload_with_whitelist(error_details)
        end

        {
          occurredOn: Time.now.utc.iso8601,
          details:    error_details
        }
      end
def build_payload_hash(exception_instance, env = {}, user = nil)
        Raygun.log('building payload hash')
        custom_data = filter_custom_data(env) || {}
        exception_custom_data = if exception_instance.respond_to?(:raygun_custom_data)
                                  exception_instance.raygun_custom_data
                                else
                                  {}
                                end

        tags = env.delete(:tags) || []

        if rails_env
          tags << rails_env
        else
          tags << rack_env
        end

        configuration_tags = []
        if Raygun.configuration.tags.is_a?(Proc)
          configuration_tags = Raygun.configuration.tags.call(exception_instance, env)
        else
          configuration_tags = Raygun.configuration.tags
        end

        Raygun.log('set tags')

        grouping_key = env.delete(:grouping_key)

        configuration_custom_data = Raygun.configuration.custom_data
        configured_custom_data = if configuration_custom_data.is_a?(Proc)
                                  configuration_custom_data.call(exception_instance, env)
                                 else
                                  configuration_custom_data
                                 end

        Raygun.log('set custom data')

        error_details = {
            machineName:    hostname,
            version:        version,
            client:         client_details,
            error:          error_details(exception_instance),
            userCustomData: exception_custom_data.merge(custom_data).merge(configured_custom_data),
            tags:           configuration_tags.concat(tags).compact.uniq,
            request:        request_information(env),
            environment:    {
              utcOffset: Time.now.utc_offset / 3600
            }
        }
        store = ::Raygun::Breadcrumbs::Store
        error_details[:breadcrumbs] = store.take_until_size(MAX_BREADCRUMBS_SIZE).map(&:build_payload) if store.any?

        Raygun.log('set details and breadcrumbs')

        error_details.merge!(groupingKey: grouping_key) if grouping_key

        user_details = if affected_user_present?(env)
                         user_information(env)
                       elsif user != nil
                         AffectedUser.information_hash(user)
                       end
        error_details.merge!(user: user_details) unless user_details == nil

        Raygun.log('set user details')

        if Raygun.configuration.filter_payload_with_whitelist
          Raygun.log('filtering payload with whitelist')
          error_details = filter_payload_with_whitelist(error_details)
        end

        {
          occurredOn: Time.now.utc.iso8601,
          details:    error_details
        }
      end
def build_payload_hash ( exception_instance , env = { } , user = nil ) Raygun . log ( 'building payload hash' ) custom_data = filter_custom_data ( env ) || { } exception_custom_data = if exception_instance . respond_to? ( :raygun_custom_data ) exception_instance . raygun_custom_data else { } end tags = env . delete ( :tags ) || [ ] if rails_env tags << rails_env else tags << rack_env end configuration_tags = [ ] if Raygun . configuration . tags . is_a? ( Proc ) configuration_tags = Raygun . configuration . tags . call ( exception_instance , env ) else configuration_tags = Raygun . configuration . tags end Raygun . log ( 'set tags' ) grouping_key = env . delete ( :grouping_key ) configuration_custom_data = Raygun . configuration . custom_data configured_custom_data = if configuration_custom_data . is_a? ( Proc ) configuration_custom_data . call ( exception_instance , env ) else configuration_custom_data end Raygun . log ( 'set custom data' ) error_details = { machineName : hostname , version : version , client : client_details , error : error_details ( exception_instance ) , userCustomData : exception_custom_data . merge ( custom_data ) . merge ( configured_custom_data ) , tags : configuration_tags . concat ( tags ) . compact . uniq , request : request_information ( env ) , environment : { utcOffset : Time . now . utc_offset / 3600 } } store = :: Raygun :: Breadcrumbs :: Store error_details [ :breadcrumbs ] = store . take_until_size ( MAX_BREADCRUMBS_SIZE ) . map ( :build_payload ) if store . any? Raygun . log ( 'set details and breadcrumbs' ) error_details . merge! ( groupingKey : grouping_key ) if grouping_key user_details = if affected_user_present? ( env ) user_information ( env ) elsif user != nil AffectedUser . information_hash ( user ) end error_details . merge! ( user : user_details ) unless user_details == nil Raygun . log ( 'set user details' ) if Raygun . configuration . filter_payload_with_whitelist Raygun . log ( 'filtering payload with whitelist' ) error_details = filter_payload_with_whitelist ( error_details ) end { occurredOn : Time . now . utc . iso8601 , details : error_details } end
see http://raygun.io/raygun-providers/rest-json-api?v=1
see http : // raygun . io / raygun - providers / rest - json - api?v = 1