lib/unleash/context.rb in unleash-4.1.0 vs lib/unleash/context.rb in unleash-4.2.0

- old
+ new

@@ -1,8 +1,8 @@ module Unleash class Context - ATTRS = [:app_name, :environment, :user_id, :session_id, :remote_address].freeze + ATTRS = [:app_name, :environment, :user_id, :session_id, :remote_address, :current_time].freeze attr_accessor(*[ATTRS, :properties].flatten) def initialize(params = {}) raise ArgumentError, "Unleash::Context must be initialized with a hash." unless params.is_a?(Hash) @@ -10,9 +10,10 @@ self.app_name = value_for('appName', params, Unleash&.configuration&.app_name) self.environment = value_for('environment', params, Unleash&.configuration&.environment || 'default') self.user_id = value_for('userId', params) self.session_id = value_for('sessionId', params) self.remote_address = value_for('remoteAddress', params) + self.current_time = value_for('currentTime', params, Time.now.utc.iso8601.to_s) properties = value_for('properties', params) self.properties = properties.is_a?(Hash) ? properties.transform_keys(&:to_sym) : {} end