Class: TestTrack::IdentitySessionLocator
- Inherits:
-
Object
- Object
- TestTrack::IdentitySessionLocator
- Defined in:
- app/models/test_track/identity_session_locator.rb
Instance Attribute Summary collapse
-
#identity ⇒ Object
readonly
Returns the value of attribute identity.
Instance Method Summary collapse
-
#initialize(identity) ⇒ IdentitySessionLocator
constructor
A new instance of IdentitySessionLocator.
- #with_session ⇒ Object
-
#with_visitor(&block) ⇒ Object
rubocop:disable Metrics/AbcSize.
Constructor Details
#initialize(identity) ⇒ IdentitySessionLocator
Returns a new instance of IdentitySessionLocator.
4 5 6 |
# File 'app/models/test_track/identity_session_locator.rb', line 4 def initialize(identity) @identity = identity end |
Instance Attribute Details
#identity ⇒ Object (readonly)
Returns the value of attribute identity.
2 3 4 |
# File 'app/models/test_track/identity_session_locator.rb', line 2 def identity @identity end |
Instance Method Details
#with_session ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'app/models/test_track/identity_session_locator.rb', line 20 def with_session raise ArgumentError, "must provide block to `with_session`" unless block_given? if web_session.present? yield web_session else raise "#with_session called outside of web session" end end |
#with_visitor(&block) ⇒ Object
rubocop:disable Metrics/AbcSize
8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/models/test_track/identity_session_locator.rb', line 8 def with_visitor(&block) # rubocop:disable Metrics/AbcSize raise ArgumentError, "must provide block to `with_visitor`" unless block_given? if web_session.present? yield web_session.visitor_dsl_for(identity) elsif job_session.present? yield job_session.visitor_dsl_for(identity) else TestTrack::OfflineSession.with_visitor_for(identity.test_track_identifier_type, identity.test_track_identifier_value, &block) end end |