From 85a2717ceb5b6e4b1eed23d4aa96c32307f3c584 Mon Sep 17 00:00:00 2001 From: Taylor Lodge Date: Tue, 9 May 2017 10:32:27 +1200 Subject: [PATCH 1/2] Use lowercase user identifier keys --- lib/raygun/affected_user.rb | 16 ++++++++-------- test/unit/affected_user_test.rb | 12 ++++++------ test/unit/client_test.rb | 8 ++++---- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lib/raygun/affected_user.rb b/lib/raygun/affected_user.rb index f4d3c69..9977828 100644 --- a/lib/raygun/affected_user.rb +++ b/lib/raygun/affected_user.rb @@ -10,11 +10,11 @@ class AffectedUser }.freeze SUPPORTED_ATTRIBUTES = DEFAULT_MAPPING.keys.freeze NAME_TO_RAYGUN_NAME_MAPPING = { - identifier: :Identifier, - email: :Email, - full_name: :FullName, - first_name: :FirstName, - uuid: :UUID + identifier: :identifier, + email: :email, + full_name: :fullName, + first_name: :firstName, + uuid: :uuid }.freeze class << self @@ -29,13 +29,13 @@ def information_hash(user_object) private def handle_anonymous_user(user_object) - result = { IsAnonymous: true } - result[:Identifier] = user_object unless user_object.nil? + result = { isAnonymous: true } + result[:identifier] = user_object unless user_object.nil? result end def handle_known_user(user_object) - SUPPORTED_ATTRIBUTES.reduce({ IsAnonymous: false }) do |result, attribute| + SUPPORTED_ATTRIBUTES.reduce({ isAnonymous: false }) do |result, attribute| mapping = Raygun.configuration.affected_user_mapping method = mapping[attribute] diff --git a/test/unit/affected_user_test.rb b/test/unit/affected_user_test.rb index bbe37cf..f99e0c3 100644 --- a/test/unit/affected_user_test.rb +++ b/test/unit/affected_user_test.rb @@ -61,7 +61,7 @@ def test_inserting_user_object_with_email begin @middleware.call("action_controller.instance" => @controller) rescue TestException - user_hash = { :Identifier => 123, :Email => "testemail@something.com", :IsAnonymous => false } + user_hash = { :identifier => 123, :email => "testemail@something.com", :isAnonymous => false } assert_equal user_hash, @app.env["raygun.affected_user"] end end @@ -77,7 +77,7 @@ def test_changing_method_mapping begin @middleware.call("action_controller.instance" => @controller) rescue TestException - user_hash = { :Identifier => "topsecret", :IsAnonymous => false } + user_hash = { :identifier => "topsecret", :isAnonymous => false } assert_equal user_hash, @app.env["raygun.affected_user"] end end @@ -89,7 +89,7 @@ def test_inserting_user_as_plain_string begin @middleware.call("action_controller.instance" => @controller) rescue TestException - user_hash = { :Identifier => "some-string-identifier", :IsAnonymous => true } + user_hash = { :identifier => "some-string-identifier", :isAnonymous => true } assert_equal user_hash, @app.env["raygun.affected_user"] end end @@ -101,7 +101,7 @@ def test_with_a_nil_user begin @middleware.call("action_controller.instance" => @controller) rescue TestException - user_hash = { :IsAnonymous => true } + user_hash = { :isAnonymous => true } assert_equal user_hash, @app.env["raygun.affected_user"] end end @@ -113,7 +113,7 @@ def test_with_private_method begin @middleware.call("action_controller.instance" => @controller) rescue TestException - user_hash = {:IsAnonymous=>false, :Identifier=>123, :Email=>"testemail@something.com"} + user_hash = {:isAnonymous=>false, :identifier=>123, :email=>"testemail@something.com"} assert_equal user_hash, @app.env["raygun.affected_user"] end end @@ -129,7 +129,7 @@ def test_with_proc_for_mapping begin @middleware.call("action_controller.instance" => @controller) rescue TestException - user_hash = {:IsAnonymous=>false, :Identifier=>123, :Email=>"testemail@something.com", :FullName => "Taylor Lodge", :FirstName => "Taylor"} + user_hash = {:isAnonymous=>false, :identifier=>123, :email=>"testemail@something.com", :fullName => "Taylor Lodge", :firstName => "Taylor"} assert_equal user_hash, @app.env["raygun.affected_user"] end end diff --git a/test/unit/client_test.rb b/test/unit/client_test.rb index e32482f..7c1407b 100644 --- a/test/unit/client_test.rb +++ b/test/unit/client_test.rb @@ -634,10 +634,10 @@ def test_filter_payload_with_whitelist_request_specific_keys def test_build_payload_hash_adds_affected_user_details_when_supplied_with_user user = OpenStruct.new(id: '123', email: 'test@email.com', first_name: 'Taylor') expected_details = { - :IsAnonymous => false, - :Identifier => '123', - :Email => 'test@email.com', - :FirstName => 'Taylor', + :isAnonymous => false, + :identifier => '123', + :email => 'test@email.com', + :firstName => 'Taylor', } user_details = @client.send(:build_payload_hash, test_exception, sample_env_hash, user)[:details][:user] From 1b5221f93aaf2309389862925c4bd0afdd9a3c9a Mon Sep 17 00:00:00 2001 From: Taylor Lodge Date: Tue, 9 May 2017 10:51:55 +1200 Subject: [PATCH 2/2] Update CHANGELOG and version --- CHANGELOG.md | 9 +++++++-- lib/raygun/version.rb | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6d2d17..eb9cb97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,9 @@ -## 2.2.0 +## 2.3.0 (09/05/2017) + +Bugfixes + - Fix issue preventing affected users for a crash report from showing up in the affected users page ([#119](https://github.com/MindscapeHQ/raygun4ruby/pull/119)) + +## 2.2.0 (05/05/2017) Features - Opt in support for sending exceptions in a background thread to not block web request thread during IO ([#117](https://github.com/MindscapeHQ/raygun4ruby/pull/117)) @@ -6,7 +11,7 @@ Features Bugfixes - Don't attempt to read raw data during GET requests or if rack.input buffer is empty -## 2.1.0 +## 2.1.0 (27/04/2017) Features - Ability to record breadcrumbs in your code that will be sent to Raygun along with a raised exception ([#113](https://github.com/MindscapeHQ/raygun4ruby/pull/113)) diff --git a/lib/raygun/version.rb b/lib/raygun/version.rb index a6196d5..450e710 100644 --- a/lib/raygun/version.rb +++ b/lib/raygun/version.rb @@ -1,3 +1,3 @@ module Raygun - VERSION = "2.2.0" + VERSION = "2.3.0" end