Class: Honeybadger::Api::Site

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#activeObject (readonly)

Returns the value of attribute active.



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

def active
  @active
end

#frequencyObject (readonly)

Returns the value of attribute frequency.



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

def frequency
  @frequency
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#last_checked_atObject (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

#matchObject (readonly)

Returns the value of attribute match.



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

def match
  @match
end

#match_typeObject (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

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#stateObject (readonly)

Returns the value of attribute state.



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

def state
  @state
end

#urlObject (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

.handlerObject

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