Class: Honeybadger::Api::Notice
- Inherits:
-
Object
- Object
- Honeybadger::Api::Notice
- Defined in:
- lib/honeybadger-api/notice.rb
Instance Attribute Summary collapse
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#fault_id ⇒ Object
readonly
Returns the value of attribute fault_id.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Class Method Summary collapse
-
.all(project_id, fault_id) ⇒ Object
Public: Find all notices on a fault for a project.
-
.find(project_id, fault_id, notice_id) ⇒ Object
Public: Find a notice on a fault for a project.
-
.handler ⇒ Object
Internal: The handler used to build objects from API responses.
-
.paginate(project_id, fault_id, filters = {}) ⇒ Object
Public: Paginate all notices on a fault for a project.
Instance Method Summary collapse
-
#initialize(opts) ⇒ Notice
constructor
Public: Build a new instance of Notice.
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] = opts[:message] @request = opts[:request] @created_at = opts[:created_at].nil? ? nil : DateTime.parse(opts[:created_at]) end |
Instance Attribute Details
#created_at ⇒ Object (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 |
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
5 6 7 |
# File 'lib/honeybadger-api/notice.rb', line 5 def environment @environment end |
#fault_id ⇒ Object (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 |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/honeybadger-api/notice.rb', line 5 def id @id end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
5 6 7 |
# File 'lib/honeybadger-api/notice.rb', line 5 def end |
#request ⇒ Object (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 |
.handler ⇒ Object
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 |