Class: Honeybadger::Api::Notice

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Notice

Public: Build a new instance of Notice

opts - A Hash of attributes to initialize a Notice

Returns a new Notice



12
13
14
15
16
17
18
19
# File 'lib/honeybadger-api/notice.rb', line 12

def initialize(opts)
  @id = opts[:id]
  @fault_id = opts[:fault_id]
  @environment = opts[:environment]
  @message = opts[:message]
  @request = opts[:request]
  @created_at = opts[:created_at].nil? ? nil : DateTime.parse(opts[:created_at])
end

Instance Attribute Details

#created_atObject (readonly)

Returns the value of attribute created_at.



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

def created_at
  @created_at
end

#environmentObject (readonly)

Returns the value of attribute environment.



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

def environment
  @environment
end

#fault_idObject (readonly)

Returns the value of attribute fault_id.



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

def fault_id
  @fault_id
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#messageObject (readonly)

Returns the value of attribute message.



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

def message
  @message
end

#requestObject (readonly)

Returns the value of attribute request.



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

def request
  @request
end

Class Method Details

.all(project_id, fault_id) ⇒ Object

Public: Find all notices on a fault for a project.



22
23
24
25
# File 'lib/honeybadger-api/notice.rb', line 22

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

.find(project_id, fault_id, notice_id) ⇒ Object

Public: Find a notice on a fault for a project.



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

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

.handlerObject

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



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

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

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

Public: Paginate all notices on a fault for a project



28
29
30
31
# File 'lib/honeybadger-api/notice.rb', line 28

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