Class: Quilt::Performance::Report

Inherits:
Object
  • Object
show all
Defined in:
lib/quilt_rails/performance/report.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(events:, navigations:, connection:) ⇒ Report

Returns a new instance of Report.



45
46
47
48
49
# File 'lib/quilt_rails/performance/report.rb', line 45

def initialize(events:, navigations:, connection:)
  @events = events
  @navigations = navigations
  @connection = connection
end

Instance Attribute Details

#connectionObject

Returns the value of attribute connection.



8
9
10
# File 'lib/quilt_rails/performance/report.rb', line 8

def connection
  @connection
end

#eventsObject

Returns the value of attribute events.



6
7
8
# File 'lib/quilt_rails/performance/report.rb', line 6

def events
  @events
end

Returns the value of attribute navigations.



7
8
9
# File 'lib/quilt_rails/performance/report.rb', line 7

def navigations
  @navigations
end

Class Method Details

.from_params(params) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/quilt_rails/performance/report.rb', line 11

def from_params(params)
  params.transform_keys! { |key| key.underscore.to_sym }
  params[:connection] = { effectiveType: "unknown" } if params[:connection].blank?

  connection = Connection.from_params(params[:connection])

  Report.new(
    connection: connection,
    navigations: build_navigations(params[:navigations], connection: connection),
    events: build_events(params[:events], connection: connection),
  )
end