Class: Honeybadger::Api::Project

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Project

Public: Build a new instance of Project

opts - A Hash of attributes to initialize a Project

Returns a new Project



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

def initialize(opts)
  @id = opts[:id]
  @name = opts[:name]
  @owner = User.new(opts[:owner][:name], opts[:owner][:email])
  @users = opts[:users].collect { |user| User.new(user[:name], user[:email]) }
  @token = opts[:token]
  @environments = opts[:environments]
  @teams = opts[:teams]
  @active = opts[:active]
  @disable_public_links = opts[:disable_public_links]
  @fault_count = opts[:fault_count]
  @unresolved_fault_count = opts[:unresolved_fault_count]
  @last_notice_at = opts[:last_notice_at].nil? ? nil : DateTime.parse(opts[:last_notice_at])
  @earliest_notice_at = opts[:earliest_notice_at].nil? ? nil : DateTime.parse(opts[:earliest_notice_at])
  @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/project.rb', line 5

def created_at
  @created_at
end

#earliest_notice_atObject (readonly)

Returns the value of attribute earliest_notice_at.



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

def earliest_notice_at
  @earliest_notice_at
end

#environmentsObject (readonly)

Returns the value of attribute environments.



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

def environments
  @environments
end

#fault_countObject (readonly)

Returns the value of attribute fault_count.



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

def fault_count
  @fault_count
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#last_notice_atObject (readonly)

Returns the value of attribute last_notice_at.



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

def last_notice_at
  @last_notice_at
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#ownerObject (readonly)

Returns the value of attribute owner.



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

def owner
  @owner
end

#teamsObject (readonly)

Returns the value of attribute teams.



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

def teams
  @teams
end

#tokenObject (readonly)

Returns the value of attribute token.



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

def token
  @token
end

#unresolved_fault_countObject (readonly)

Returns the value of attribute unresolved_fault_count.



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

def unresolved_fault_count
  @unresolved_fault_count
end

#usersObject (readonly)

Returns the value of attribute users.



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

def users
  @users
end

Class Method Details

.allObject

Public: Find all of the project.



52
53
54
# File 'lib/honeybadger-api/project.rb', line 52

def self.all
  Honeybadger::Api::Request.all("projects", handler)
end

.find(project_id) ⇒ Object

Public: Find a project.



62
63
64
# File 'lib/honeybadger-api/project.rb', line 62

def self.find(project_id)
  Honeybadger::Api::Request.find("projects/#{project_id}", handler)
end

.handlerObject

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



67
68
69
# File 'lib/honeybadger-api/project.rb', line 67

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

.paginate(filters = {}) ⇒ Object

Public: Paginate all of the project.



57
58
59
# File 'lib/honeybadger-api/project.rb', line 57

def self.paginate(filters = {})
  Honeybadger::Api::Request.paginate("projects", handler, filters)
end

Instance Method Details

#active?Boolean

Public: Whether the project is active.

Returns:

  • (Boolean)


32
33
34
# File 'lib/honeybadger-api/project.rb', line 32

def active?
  @active == true
end

#inactive?Boolean

Public: Whether the project is inactive.

Returns:

  • (Boolean)


37
38
39
# File 'lib/honeybadger-api/project.rb', line 37

def inactive?
  @active == false
end

#private_links?Boolean

Public: Whether links are private.

Returns:

  • (Boolean)


47
48
49
# File 'lib/honeybadger-api/project.rb', line 47

def private_links?
  @disable_public_links == true
end

#public_links?Boolean

Public: Whether links are public.

Returns:

  • (Boolean)


42
43
44
# File 'lib/honeybadger-api/project.rb', line 42

def public_links?
  @disable_public_links == false
end