项目作者: murraysum

项目描述 :
Ruby Library for the HoneyBadger Read API
高级语言: Ruby
项目地址: git://github.com/murraysum/honeybadger-api.git
创建时间: 2013-10-13T20:08:47Z
项目社区:https://github.com/murraysum/honeybadger-api

开源协议:MIT License

下载


Honeybadger Read API

A Ruby Library for the Honeybadger Read API for easily pulling your data out of Honeybadger.

Installation

Add this line to your application’s Gemfile:

  1. gem "honeybadger-api"

And then execute:

  1. $ bundle

Or install it yourself as:

  1. $ gem install honeybadger-api

Usage

Introduction

Firstly require the library:

  1. require "honeybadger-api"

Then configure your personal API access token. Your personal API access token can be found on your personal profile page:

  1. Honeybadger::Api.configure do |c|
  2. c.access_token = "xxxxxxxxxxxxxxxxxxxx"
  3. end

After you have setup your API access token you can now make requests.

Projects

  1. # Find a project
  2. Honeybadger::Api::Project.find(project_id)
  3. # Find all the projects
  4. Honeybadger::Api::Project.all
  5. # Retrieve a paginator for projects
  6. paginator = Honeybadger::Api::Project.paginate

There are several methods that you should be aware of when using the paginator.

  1. # Get a paginator for a resource
  2. paginator = Honeybadger::Api::Project.paginate
  3. # Retrieve a paginator for projects starting at a page
  4. paginator = Honeybadger::Api::Project.paginate(:page => 5)
  5. # Whether there are any more previous or next pages
  6. paginator.previous?
  7. => true
  8. paginator.next?
  9. => true
  10. # Retrieve the previous or next pages
  11. paginator.previous
  12. paginator.next
  13. # Retrieve the current page number
  14. paginator.current_page
  15. # Return all previously requested pages as a Hash
  16. paginator.pages
  17. => {
  18. 1 => [
  19. #<Honeybadger::Api::Project @id=1, @name="Example">,
  20. #<Honeybadger::Api::Project @id=2, @name="Acme">
  21. ],
  22. 2 => [
  23. #<Honeybadger::Api::Project @id=3, @name="Website">
  24. ]
  25. }
  26. # Return all previously requested pages as a collection
  27. paginator.collection
  28. => [
  29. #<Honeybadger::Api::Project @id=1, @name="Example">,
  30. #<Honeybadger::Api::Project @id=2, @name="Acme">,
  31. #<Honeybadger::Api::Project @id=3, @name="Website">
  32. ]

Deploys

  1. # Find a deploy
  2. Honeybadger::Api::Deploy.find(project_id, deploy_id)
  3. # Find all the deploys
  4. Honeybadger::Api::Deploy.all(project_id)
  5. # Retrieve a paginator for deploys
  6. Honeybadger::Api::Deploy.paginate(project_id)

Faults

  1. # Find a fault
  2. Honeybadger::Api::Fault.find(project_id, fault_id)
  3. # Find all the faults
  4. Honeybadger::Api::Fault.all(project_id)
  5. # Retrieve a paginator for faults
  6. Honeybadger::Api::Fault.paginate(project_id)

Notices

  1. # Find all the notices
  2. Honeybadger::Api::Notice.all(project_id, fault_id)
  3. # Retrieve a paginator for notices
  4. Honeybadger::Api::Notice.paginate(project_id, fault_id)

Comments

  1. # Find a comment
  2. Honeybadger::Api::Comment.find(project_id, fault_id, comment_id)
  3. # Find all the comments
  4. Honeybadger::Api::Comment.all(project_id, fault_id)
  5. # Retrieve a paginator for comments
  6. Honeybadger::Api::Comment.paginate(project_id, fault_id)

Teams

  1. # Find a team
  2. Honeybadger::Api::Team.find(team_id)
  3. # Find all the teams
  4. Honeybadger::Api::Team.all
  5. # Retrieve a paginator for teams
  6. Honeybadger::Api::Team.paginate

Team Members

  1. # Find a team member
  2. Honeybadger::Api::TeamMember.find(team_id, team_member_id)
  3. # Find all the team members
  4. Honeybadger::Api::TeamMember.all(team_id)
  5. # Retrieve a paginator for team members
  6. Honeybadger::Api::TeamMember.paginate(team_id)

Team Invitations

  1. # Find a team invitation
  2. Honeybadger::Api::TeamInvitation.find(team_id, team_invitation_id)
  3. # Find all the team invitations
  4. Honeybadger::Api::TeamInvitation.all(team_id)
  5. # Retrieve a paginator for team invitations
  6. Honeybadger::Api::TeamInvitation.paginate(team_id)

Sites

  1. # Find a site
  2. Honeybadger::Api::Site.find(project_id, site_id)
  3. # Find all the sites
  4. Honeybadger::Api::Site.all(project_id)
  5. # Retrieve a paginator for sites
  6. Honeybadger::Api::Site.paginate(project_id)

Outages

  1. # Find all the outages
  2. Honeybadger::Api::Outage.all(project_id, site_id)
  3. # Retrieve a paginator for outages
  4. Honeybadger::Api::Outage.paginate(project_id, site_id)

Uptime Checks

  1. # Find all the uptime checks
  2. Honeybadger::Api::UptimeCheck.all(project_id, site_id)
  3. # Retrieve a paginator for uptime checks
  4. Honeybadger::Api::UptimeCheck.paginate(project_id, site_id)

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request