Class: Bugwatch::ReportBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/bugwatch/report_builder.rb

Constant Summary collapse

VALID_CATEGORIES =
%w[ui behavior performance other].freeze

Instance Method Summary collapse

Constructor Details

#initialize(title, category: "other", severity: "warning", tags: {}, config: Bugwatch.configuration) ⇒ ReportBuilder

Returns a new instance of ReportBuilder.



7
8
9
10
11
12
13
# File 'lib/bugwatch/report_builder.rb', line 7

def initialize(title, category: "other", severity: "warning", tags: {}, config: Bugwatch.configuration)
  @title    = title.to_s
  @category = VALID_CATEGORIES.include?(category.to_s) ? category.to_s : "other"
  @severity = severity.to_s
  @tags     = tags || {}
  @config   = config
end

Instance Method Details

#buildObject



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/bugwatch/report_builder.rb', line 15

def build
  {
    issue_type: "manual",
    category: @category,
    exception: exception_payload,
    app: app_payload,
    user: UserContext.get,
    breadcrumbs: BreadcrumbCollector.all,
    tags: @tags,
    severity: @severity
  }
end