Class: Honeybadger::Api::Project
- Inherits:
-
Object
- Object
- Honeybadger::Api::Project
- Defined in:
- lib/honeybadger-api/project.rb
Instance Attribute Summary collapse
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#earliest_notice_at ⇒ Object
readonly
Returns the value of attribute earliest_notice_at.
-
#environments ⇒ Object
readonly
Returns the value of attribute environments.
-
#fault_count ⇒ Object
readonly
Returns the value of attribute fault_count.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#last_notice_at ⇒ Object
readonly
Returns the value of attribute last_notice_at.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#owner ⇒ Object
readonly
Returns the value of attribute owner.
-
#teams ⇒ Object
readonly
Returns the value of attribute teams.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
-
#unresolved_fault_count ⇒ Object
readonly
Returns the value of attribute unresolved_fault_count.
-
#users ⇒ Object
readonly
Returns the value of attribute users.
Class Method Summary collapse
-
.all ⇒ Object
Public: Find all of the project.
-
.find(project_id) ⇒ Object
Public: Find a project.
-
.handler ⇒ Object
Internal: The handler used to build objects from API responses.
-
.paginate(filters = {}) ⇒ Object
Public: Paginate all of the project.
Instance Method Summary collapse
-
#active? ⇒ Boolean
Public: Whether the project is active.
-
#inactive? ⇒ Boolean
Public: Whether the project is inactive.
-
#initialize(opts) ⇒ Project
constructor
Public: Build a new instance of Project.
-
#private_links? ⇒ Boolean
Public: Whether links are private.
-
#public_links? ⇒ Boolean
Public: Whether links are public.
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_at ⇒ Object (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_at ⇒ Object (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 |
#environments ⇒ Object (readonly)
Returns the value of attribute environments.
5 6 7 |
# File 'lib/honeybadger-api/project.rb', line 5 def environments @environments end |
#fault_count ⇒ Object (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 |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/honeybadger-api/project.rb', line 5 def id @id end |
#last_notice_at ⇒ Object (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 |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/honeybadger-api/project.rb', line 5 def name @name end |
#owner ⇒ Object (readonly)
Returns the value of attribute owner.
5 6 7 |
# File 'lib/honeybadger-api/project.rb', line 5 def owner @owner end |
#teams ⇒ Object (readonly)
Returns the value of attribute teams.
5 6 7 |
# File 'lib/honeybadger-api/project.rb', line 5 def teams @teams end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
5 6 7 |
# File 'lib/honeybadger-api/project.rb', line 5 def token @token end |
#unresolved_fault_count ⇒ Object (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 |
#users ⇒ Object (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
.all ⇒ Object
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 |
.handler ⇒ Object
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.
32 33 34 |
# File 'lib/honeybadger-api/project.rb', line 32 def active? @active == true end |
#inactive? ⇒ Boolean
Public: Whether the project is inactive.
37 38 39 |
# File 'lib/honeybadger-api/project.rb', line 37 def inactive? @active == false end |
#private_links? ⇒ Boolean
Public: Whether links are private.
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.
42 43 44 |
# File 'lib/honeybadger-api/project.rb', line 42 def public_links? @disable_public_links == false end |