Class: Honeybadger::Api::Fault

Inherits:
Object
  • Object
show all
Defined in:
lib/honeybadger-api/fault.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Fault

Public: Build a new instance of Fault

opts - A Hash of attributes to initialize a Fault

Returns a new Fault



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/honeybadger-api/fault.rb', line 13

def initialize(opts)
  @id = opts[:id]
  @project_id = opts[:project_id]
  @klass = opts[:klass]
  @action = opts[:action]
  @component = opts[:component]
  @message = opts[:message]
  @environment = opts[:environment]
  @ignored = opts[:ignored]
  @resolved = opts[:resolved]
  @notices_count = opts[:notices_count]
  @comments_count = opts[:comments_count]
  @last_notice_at = opts[:last_notice_at].nil? ? nil : DateTime.parse(opts[:last_notice_at])
  @created_at = opts[:created_at].nil? ? nil : DateTime.parse(opts[:created_at])
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



5
6
7
# File 'lib/honeybadger-api/fault.rb', line 5

def action
  @action
end

#comments_countObject (readonly)

Returns the value of attribute comments_count.



5
6
7
# File 'lib/honeybadger-api/fault.rb', line 5

def comments_count
  @comments_count
end

#componentObject (readonly)

Returns the value of attribute component.



5
6
7
# File 'lib/honeybadger-api/fault.rb', line 5

def component
  @component
end

#created_atObject (readonly)

Returns the value of attribute created_at.



5
6
7
# File 'lib/honeybadger-api/fault.rb', line 5

def created_at
  @created_at
end

#environmentObject (readonly)

Returns the value of attribute environment.



5
6
7
# File 'lib/honeybadger-api/fault.rb', line 5

def environment
  @environment
end

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/honeybadger-api/fault.rb', line 5

def id
  @id
end

#klassObject (readonly)

Returns the value of attribute klass.



5
6
7
# File 'lib/honeybadger-api/fault.rb', line 5

def klass
  @klass
end

#last_notice_atObject (readonly)

Returns the value of attribute last_notice_at.



5
6
7
# File 'lib/honeybadger-api/fault.rb', line 5

def last_notice_at
  @last_notice_at
end

#messageObject (readonly)

Returns the value of attribute message.



5
6
7
# File 'lib/honeybadger-api/fault.rb', line 5

def message
  @message
end

#notices_countObject (readonly)

Returns the value of attribute notices_count.



5
6
7
# File 'lib/honeybadger-api/fault.rb', line 5

def notices_count
  @notices_count
end

#project_idObject (readonly)

Returns the value of attribute project_id.



5
6
7
# File 'lib/honeybadger-api/fault.rb', line 5

def project_id
  @project_id
end

Class Method Details

.all(project_id) ⇒ Object

Public: Find all faults for a given project.



40
41
42
43
# File 'lib/honeybadger-api/fault.rb', line 40

def self.all(project_id)
  path  = "projects/#{project_id}/faults"
  Honeybadger::Api::Request.all(path, handler)
end

.find(project_id, fault_id) ⇒ Object

Public: Find a fault for a given project.



52
53
54
55
# File 'lib/honeybadger-api/fault.rb', line 52

def self.find(project_id, fault_id)
  path = "projects/#{project_id}/faults/#{fault_id}"
  Honeybadger::Api::Request.find(path, handler)
end

.handlerObject

Internal: The handler used to build objects from API responses.



58
59
60
# File 'lib/honeybadger-api/fault.rb', line 58

def self.handler
  Proc.new { |response| Fault.new(response) }
end

.paginate(project_id, filters = {}) ⇒ Object

Public: Paginate all faults for a given project.



46
47
48
49
# File 'lib/honeybadger-api/fault.rb', line 46

def self.paginate(project_id, filters = {})
  path  = "projects/#{project_id}/faults"
  Honeybadger::Api::Request.paginate(path, handler, filters)
end

Instance Method Details

#ignored?Boolean

Public: Whether tha fault has been marked as ignored.

Returns:

  • (Boolean)


30
31
32
# File 'lib/honeybadger-api/fault.rb', line 30

def ignored?
  @ignored == true
end

#resolved?Boolean

Public: Whether tha fault has been marked as resolved.

Returns:

  • (Boolean)


35
36
37
# File 'lib/honeybadger-api/fault.rb', line 35

def resolved?
  @resolved == true
end