diff --git a/Gemfile.lock b/Gemfile.lock index 7d9a780..28bb06a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - absmartly-sdk (1.0.6) + absmartly-sdk (1.0.7) arraybuffer (~> 0.0.6) faraday (~> 1.10.3) murmurhash3 (~> 0.1.7) diff --git a/lib/absmartly/version.rb b/lib/absmartly/version.rb index 3fac81d..130661d 100644 --- a/lib/absmartly/version.rb +++ b/lib/absmartly/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Absmartly - VERSION = "1.0.6" + VERSION = "1.0.7" end diff --git a/lib/json/attribute.rb b/lib/json/attribute.rb index 977e4a3..2cf8ab4 100644 --- a/lib/json/attribute.rb +++ b/lib/json/attribute.rb @@ -22,9 +22,9 @@ def hash_code def to_s "Attribute{" + - "name='" + @name + "'" + - ", value=" + @value + - ", setAt=" + @set_at + + "name='#{@name}'" + + ", value=#{@value}" + + ", setAt=#{@set_at}" + "}" end end diff --git a/lib/json/experiment.rb b/lib/json/experiment.rb index c83fe9b..35d43d5 100644 --- a/lib/json/experiment.rb +++ b/lib/json/experiment.rb @@ -63,21 +63,21 @@ def hash_code def to_s "ContextExperiment{" + - "id=" + @id + - ", name='" + @name + "'" + - ", unitType='" + @unit_type + "'" + - ", iteration=" + @iteration + - ", seedHi=" + @seed_hi + - ", seedLo=" + @seed_lo + - ", split=" + @split.join + - ", trafficSeedHi=" + @traffic_seed_hi + - ", trafficSeedLo=" + @traffic_seed_lo + - ", trafficSplit=" + @traffic_split.join + - ", fullOnVariant=" + @full_on_variant + - ", applications=" + @applications.join + - ", variants=" + @variants.join + - ", audienceStrict=" + @audience_strict + - ", audience='" + @audience + "'" + + "id= #{@id}"+ + ", name='#{@name}'" + + ", unitType='#{@unit_type}'" + + ", iteration=#{@iteration}" + + ", seedHi=#{@seed_hi}" + + ", seedLo=#{@seed_lo}" + + ", split=#{@split.join}" + + ", trafficSeedHi=#{@traffic_seed_hi}" + + ", trafficSeedLo=#{@traffic_seed_lo}" + + ", trafficSplit=#{@traffic_split.join}" + + ", fullOnVariant=#{@full_on_variant}" + + ", applications=#{@applications.join}" + + ", variants=#{@variants.join}" + + ", audienceStrict=#{@audience_strict}" + + ", audience='#{@audience}'" + "}" end end diff --git a/lib/json/experiment_variant.rb b/lib/json/experiment_variant.rb index cc91510..b833280 100644 --- a/lib/json/experiment_variant.rb +++ b/lib/json/experiment_variant.rb @@ -22,8 +22,8 @@ def hash_code def to_s "ExperimentVariant{" + - "name='" + @name + "'" + - ", config='" + @config + "'" + + "name='#{@name}'" + + ", config='#{@config}'" + "}" end end diff --git a/lib/json/exposure.rb b/lib/json/exposure.rb index a2bb683..69eadfe 100644 --- a/lib/json/exposure.rb +++ b/lib/json/exposure.rb @@ -44,17 +44,17 @@ def hash_code def to_s "Exposure{" + - "id=" + @id + - "name='" + @name + "'" + - ", unit=" + @unit + - ", variant=" + @variant + - ", exposed_at=" + @exposed_at + - ", assigned=" + @assigned + - ", eligible=" + @eligible + - ", overridden=" + @overridden + - ", full_on=" + @full_on + - ", custom=" + @custom + - ", audience_mismatch=" + @audience_mismatch + + "id=#{@id}" + + "name='#{@name}'" + + ", unit=#{@unit}" + + ", variant=#{@variant}" + + ", exposed_at=#{@exposed_at}" + + ", assigned=#{@assigned}" + + ", eligible=#{@eligible}" + + ", overridden=#{@overridden}" + + ", full_on=#{@full_on}" + + ", custom=#{@custom}" + + ", audience_mismatch=#{@audience_mismatch}" + "}" end end diff --git a/lib/json/goal_achievement.rb b/lib/json/goal_achievement.rb index 8e0ac10..97a3240 100644 --- a/lib/json/goal_achievement.rb +++ b/lib/json/goal_achievement.rb @@ -24,9 +24,9 @@ def hash_code def to_s "GoalAchievement{" + - "name='" + @name + "'" + - ", achieved_at='" + @achieved_at + "'" + - ", properties='" + @properties.inspect + "'" + + "name='#{@name}'" + + ", achieved_at='#{@achieved_at}'" + + ", properties='#{@properties.inspect}'" + "}" end end diff --git a/lib/json/publish_event.rb b/lib/json/publish_event.rb index 2caae04..b765cde 100644 --- a/lib/json/publish_event.rb +++ b/lib/json/publish_event.rb @@ -31,12 +31,12 @@ def hash_code def to_s "PublishEvent{" + - "hashedUnits=" + @hashed + - ", units=" + @units.inspect + - ", publishedAt=" + @published_at + - ", exposures=" + @exposures.inspect + - ", goals=" + @goals.inspect + - ", attributes=" + @attributes.join + + "hashedUnits=#{@hashed}" + + ", units=#{@units.inspect}" + + ", publishedAt=#{@published_at}" + + ", exposures=#{@exposures.inspect}" + + ", goals=#{@goals.inspect}" + + ", attributes=#{@attributes!=nil ? @attributes.join : ""}" + "}" end end diff --git a/spec/context_spec.rb b/spec/context_spec.rb index ad81b10..8542af6 100644 --- a/spec/context_spec.rb +++ b/spec/context_spec.rb @@ -12,6 +12,7 @@ require "scheduled_executor_service" require "audience_matcher" require "json/unit" +require "logger" RSpec.describe Context do let(:units) { @@ -106,7 +107,7 @@ end let(:event_logger) do event_logger = MockContextEventLoggerProxy.new - allow(event_logger).to receive(:handle_event).and_return(nil) + allow(event_logger).to receive(:handle_event).and_call_original event_logger end let(:variable_parser) { DefaultVariableParser.new } @@ -1081,16 +1082,20 @@ def faraday_response(content) class MockContextEventLoggerProxy < ContextEventLogger - attr_accessor :called, :events + attr_accessor :called, :events, :logger def initialize @called = 0 @events = [] + @logger = Logger.new(STDOUT) end def handle_event(event, data) @called += 1 @events << { event: event, data: data } + + @logger.debug "event: #{event}" + @logger.debug "data: #{data}" end def clear