Class: Honeybadger::Api::Site
- Inherits:
-
Object
- Object
- Honeybadger::Api::Site
- Defined in:
- lib/honeybadger-api/site.rb
Instance Attribute Summary collapse
-
#active ⇒ Object
readonly
Returns the value of attribute active.
-
#frequency ⇒ Object
readonly
Returns the value of attribute frequency.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#last_checked_at ⇒ Object
readonly
Returns the value of attribute last_checked_at.
-
#match ⇒ Object
readonly
Returns the value of attribute match.
-
#match_type ⇒ Object
readonly
Returns the value of attribute match_type.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
-
.all(project_id) ⇒ Object
Public: Find all sites for a given project.
-
.find(project_id, site_id) ⇒ Object
Public: Find a site for a given project.
-
.handler ⇒ Object
Internal: The handler used to build objects from API responses.
-
.paginate(project_id, filters = {}) ⇒ Object
Public: Paginate all sites for a given project.
Instance Method Summary collapse
-
#initialize(opts) ⇒ Site
constructor
Public: Build a new instance of Site.
Constructor Details
#initialize(opts) ⇒ Site
Public: Build a new instance of Site
opts - A Hash of attributes to initialize a Site
Returns a new Site
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/honeybadger-api/site.rb', line 13 def initialize(opts) @active = opts[:active] @frequency = opts[:frequency] @id = opts[:id] @last_checked_at = opts[:last_checked_at].nil? ? nil : DateTime.parse(opts[:last_checked_at]) @match = opts[:match] @match_type = opts[:match_type] @name = opts[:name] @state = opts[:state] @url = opts[:url] end |
Instance Attribute Details
#active ⇒ Object (readonly)
Returns the value of attribute active.
5 6 7 |
# File 'lib/honeybadger-api/site.rb', line 5 def active @active end |
#frequency ⇒ Object (readonly)
Returns the value of attribute frequency.
5 6 7 |
# File 'lib/honeybadger-api/site.rb', line 5 def frequency @frequency end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/honeybadger-api/site.rb', line 5 def id @id end |
#last_checked_at ⇒ Object (readonly)
Returns the value of attribute last_checked_at.
5 6 7 |
# File 'lib/honeybadger-api/site.rb', line 5 def last_checked_at @last_checked_at end |
#match ⇒ Object (readonly)
Returns the value of attribute match.
5 6 7 |
# File 'lib/honeybadger-api/site.rb', line 5 def match @match end |
#match_type ⇒ Object (readonly)
Returns the value of attribute match_type.
5 6 7 |
# File 'lib/honeybadger-api/site.rb', line 5 def match_type @match_type end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/honeybadger-api/site.rb', line 5 def name @name end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
5 6 7 |
# File 'lib/honeybadger-api/site.rb', line 5 def state @state end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
5 6 7 |
# File 'lib/honeybadger-api/site.rb', line 5 def url @url end |
Class Method Details
.all(project_id) ⇒ Object
Public: Find all sites for a given project.
26 27 28 29 |
# File 'lib/honeybadger-api/site.rb', line 26 def self.all(project_id) path = "projects/#{project_id}/sites" Honeybadger::Api::Request.all(path, handler) end |
.find(project_id, site_id) ⇒ Object
Public: Find a site for a given project.
38 39 40 41 |
# File 'lib/honeybadger-api/site.rb', line 38 def self.find(project_id, site_id) path = "projects/#{project_id}/sites/#{site_id}" Honeybadger::Api::Request.find(path, handler) end |
.handler ⇒ Object
Internal: The handler used to build objects from API responses.
44 45 46 |
# File 'lib/honeybadger-api/site.rb', line 44 def self.handler Proc.new { |response| Site.new(response) } end |
.paginate(project_id, filters = {}) ⇒ Object
Public: Paginate all sites for a given project.
32 33 34 35 |
# File 'lib/honeybadger-api/site.rb', line 32 def self.paginate(project_id, filters = {}) path = "projects/#{project_id}/sites" Honeybadger::Api::Request.paginate(path, handler, filters) end |