Class: TestTrack::OfflineSession

Inherits:
Object
  • Object
show all
Defined in:
app/models/test_track/offline_session.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(remote_visitor) ⇒ OfflineSession

Returns a new instance of OfflineSession.



2
3
4
# File 'app/models/test_track/offline_session.rb', line 2

def initialize(remote_visitor)
  @remote_visitor = remote_visitor
end

Class Method Details

.with_visitor_for(identifier_type, identifier_value, &block) ⇒ Object

Raises:

  • (ArgumentError)


6
7
8
9
10
11
12
# File 'app/models/test_track/offline_session.rb', line 6

def self.with_visitor_for(identifier_type, identifier_value, &block)
  raise ArgumentError, "must provide block to `with_visitor_for`" unless block_given?

  remote_visitor = TestTrack::Remote::Visitor.from_identifier(identifier_type, identifier_value)

  new(remote_visitor).send(:manage, &block)
end

.with_visitor_id(visitor_id, &block) ⇒ Object

Raises:

  • (ArgumentError)


14
15
16
17
18
19
20
# File 'app/models/test_track/offline_session.rb', line 14

def self.with_visitor_id(visitor_id, &block)
  raise ArgumentError, "must provide block to `with_visitor_id`" unless block_given?

  remote_visitor = TestTrack::Remote::Visitor.find(visitor_id)

  new(remote_visitor).send(:manage, &block)
end