Class: Kameleoon::Managers::Tracking::TrackingBuilder
- Inherits:
-
Object
- Object
- Kameleoon::Managers::Tracking::TrackingBuilder
- Defined in:
- lib/kameleoon/managers/tracking/tracking_builder.rb
Instance Attribute Summary collapse
-
#tracking_lines ⇒ Object
readonly
Returns the value of attribute tracking_lines.
-
#unsent_visitor_data ⇒ Object
readonly
Returns the value of attribute unsent_visitor_data.
-
#visitor_codes_to_keep ⇒ Object
readonly
Returns the value of attribute visitor_codes_to_keep.
-
#visitor_codes_to_send ⇒ Object
readonly
Returns the value of attribute visitor_codes_to_send.
Instance Method Summary collapse
-
#build ⇒ Object
Not thread-safe.
-
#initialize(visitor_codes, data_file, visitor_manager, request_size_limit) ⇒ TrackingBuilder
constructor
A new instance of TrackingBuilder.
Constructor Details
#initialize(visitor_codes, data_file, visitor_manager, request_size_limit) ⇒ TrackingBuilder
Returns a new instance of TrackingBuilder.
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/kameleoon/managers/tracking/tracking_builder.rb', line 14 def initialize(visitor_codes, data_file, visitor_manager, request_size_limit) @visitor_codes = visitor_codes @data_file = data_file @visitor_manager = visitor_manager @request_size_limit = request_size_limit @built = false @total_size = 0 # result @visitor_codes_to_send = [] @visitor_codes_to_keep = [] @tracking_lines = [] @unsent_visitor_data = [] end |
Instance Attribute Details
#tracking_lines ⇒ Object (readonly)
Returns the value of attribute tracking_lines.
12 13 14 |
# File 'lib/kameleoon/managers/tracking/tracking_builder.rb', line 12 def tracking_lines @tracking_lines end |
#unsent_visitor_data ⇒ Object (readonly)
Returns the value of attribute unsent_visitor_data.
12 13 14 |
# File 'lib/kameleoon/managers/tracking/tracking_builder.rb', line 12 def unsent_visitor_data @unsent_visitor_data end |
#visitor_codes_to_keep ⇒ Object (readonly)
Returns the value of attribute visitor_codes_to_keep.
12 13 14 |
# File 'lib/kameleoon/managers/tracking/tracking_builder.rb', line 12 def visitor_codes_to_keep @visitor_codes_to_keep end |
#visitor_codes_to_send ⇒ Object (readonly)
Returns the value of attribute visitor_codes_to_send.
12 13 14 |
# File 'lib/kameleoon/managers/tracking/tracking_builder.rb', line 12 def visitor_codes_to_send @visitor_codes_to_send end |
Instance Method Details
#build ⇒ Object
Not thread-safe
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/kameleoon/managers/tracking/tracking_builder.rb', line 29 def build return if @built @visitor_codes.each do |visitor_code| if @total_size <= @request_size_limit visitor = @visitor_manager.get_visitor(visitor_code) = (visitor) data = collect_tracking_data(visitor_code, visitor, ) if !data.empty? log_visitor_track_sending(visitor_code, , data) @visitor_codes_to_send.push(visitor_code) @unsent_visitor_data.concat(data) else log_visitor_track_no_data(visitor_code, ) end else @visitor_codes_to_keep.push(visitor_code) end end @built = true end |