Class: Crep::CrashController

Inherits:
Object
  • Object
show all
Defined in:
lib/crep/crash_controller.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bundle_identifier, top, crash_source, show_only_unresolved, template_path) ⇒ CrashController

Returns a new instance of CrashController.



10
11
12
13
14
15
16
17
18
# File 'lib/crep/crash_controller.rb', line 10

def initialize(bundle_identifier, top, crash_source, show_only_unresolved, template_path)
  @bundle_identifier = bundle_identifier
  @top = top
  @crash_source = crash_source
  @show_only_unresolved = show_only_unresolved
  @crash_source.configure(bundle_identifier)
  @app_name = @crash_source.app.name
  @template_path = template_path
end

Instance Attribute Details

#app_nameObject (readonly)

Returns the value of attribute app_name.



8
9
10
# File 'lib/crep/crash_controller.rb', line 8

def app_name
  @app_name
end

#buildObject (readonly)

Returns the value of attribute build.



8
9
10
# File 'lib/crep/crash_controller.rb', line 8

def build
  @build
end

#bundle_identifierObject (readonly)

Returns the value of attribute bundle_identifier.



8
9
10
# File 'lib/crep/crash_controller.rb', line 8

def bundle_identifier
  @bundle_identifier
end

#crashesObject (readonly)

Returns the value of attribute crashes.



8
9
10
# File 'lib/crep/crash_controller.rb', line 8

def crashes
  @crashes
end

#template_pathObject (readonly)

Returns the value of attribute template_path.



8
9
10
# File 'lib/crep/crash_controller.rb', line 8

def template_path
  @template_path
end

#total_crashesObject (readonly)

Returns the value of attribute total_crashes.



8
9
10
# File 'lib/crep/crash_controller.rb', line 8

def total_crashes
  @total_crashes
end

#versionObject (readonly)

Returns the value of attribute version.



8
9
10
# File 'lib/crep/crash_controller.rb', line 8

def version
  @version
end

Instance Method Details

#latest_top_crashesObject



20
21
22
23
24
# File 'lib/crep/crash_controller.rb', line 20

def latest_top_crashes
  app_source = HockeyAppAppSource.new
  app_source.configure
  latest_top_crashes_with_app_source(app_source)
end

#latest_top_crashes_with_app_source(app_source) ⇒ Object



26
27
28
29
# File 'lib/crep/crash_controller.rb', line 26

def latest_top_crashes_with_app_source(app_source)
  latest_app = app_source.versions_for_bundle_identifier(@bundle_identifier).first
  top_crashes(latest_app.version, latest_app.build)
end

#top_crashes(version, build) ⇒ Object

returns list of top crashes for the given build



32
33
34
35
36
37
38
# File 'lib/crep/crash_controller.rb', line 32

def top_crashes(version, build)
  @version = version
  @build = build
  @crashes = @crash_source.crashes(@top, version, build, @show_only_unresolved)
  @total_crashes = @crash_source.crash_count(version: @version, build: @build)
  report
end