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



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

def initialize(opts)
  @id = opts[:id]
  @url = opts[:url]
  @fault_id = opts[:fault_id]
  @environment = opts[:environment]
  @environment_name = opts[:environment_name]
  @cookies = opts[:cookies]
  @web_environment = opts[:web_environment]
  @backtrace = opts[:backtrace]
  @deploy = Deploy.new(opts[:deploy]) if !opts[:deploy].nil?
  @message = opts[:message]
  @request = opts[:request]
  @created_at = opts[:created_at].nil? ? nil : DateTime.parse(opts[:created_at])
end

Instance Attribute Details

#backtraceObject (readonly)

Returns the value of attribute backtrace.



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

def backtrace
  @backtrace
end

#cookiesObject (readonly)

Returns the value of attribute cookies.



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

def cookies
  @cookies
end

#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

#deployObject (readonly)

Returns the value of attribute deploy.



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

def deploy
  @deploy
end

#environmentObject (readonly)

Returns the value of attribute environment.



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

def environment
  @environment
end

#environment_nameObject (readonly)

Returns the value of attribute environment_name.



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

def environment_name
  @environment_name
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

#urlObject (readonly)

Returns the value of attribute url.



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

def url
  @url
end

#web_environmentObject (readonly)

Returns the value of attribute web_environment.



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

def web_environment
  @web_environment
end

Class Method Details

.all(project_id, fault_id) ⇒ Object

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



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

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

.handlerObject

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



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

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



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

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