honeybadger-api 2.0.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/README.md +39 -9
- data/honeybadger-api.gemspec +8 -8
- data/lib/honeybadger-api.rb +4 -1
- data/lib/honeybadger-api/outage.rb +39 -0
- data/lib/honeybadger-api/site.rb +49 -0
- data/lib/honeybadger-api/uptime_check.rb +37 -0
- data/lib/honeybadger-api/version.rb +1 -1
- data/spec/comment_spec.rb +2 -2
- data/spec/deploy_spec.rb +2 -2
- data/spec/factories/outage_factory.rb +20 -0
- data/spec/factories/site_factory.rb +17 -0
- data/spec/factories/uptime_check_factory.rb +12 -0
- data/spec/fault_spec.rb +4 -4
- data/spec/notice_spec.rb +2 -2
- data/spec/outage_spec.rb +72 -0
- data/spec/paginator_spec.rb +2 -2
- data/spec/project_spec.rb +2 -2
- data/spec/site_spec.rb +90 -0
- data/spec/spec_helper.rb +5 -5
- data/spec/team_invitation_spec.rb +2 -2
- data/spec/team_member_spec.rb +2 -2
- data/spec/team_spec.rb +2 -2
- data/spec/uptime_check_spec.rb +57 -0
- data/spec/user_spec.rb +1 -1
- data/spec/version_spec.rb +4 -4
- metadata +17 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1868e27ba3550d84ad8682705e0e8f283749a5ee
|
|
4
|
+
data.tar.gz: 386f81bb282beb30fbd578f3e5f3930db02f945f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: daff2d46de8568712fbc5234e5270f67a5fddfaed125964d7316520f098d79b8b6e56c183b0743b99446b7586f746604c5aee874d98ece6759c0ed544561b076
|
|
7
|
+
data.tar.gz: b70b702a69f86b1a8c7528bbc1a264572218870393cd9724c2e90d7a0368108ddfb6038aac208b99987cf66de807c1d1a8705f9b296e2d4e6a9799a08e69a9d1
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -6,7 +6,7 @@ A Ruby Library for the [Honeybadger Read API](https://www.honeybadger.io/documen
|
|
|
6
6
|
|
|
7
7
|
Add this line to your application's Gemfile:
|
|
8
8
|
|
|
9
|
-
gem
|
|
9
|
+
gem "honeybadger-api"
|
|
10
10
|
|
|
11
11
|
And then execute:
|
|
12
12
|
|
|
@@ -22,14 +22,14 @@ Or install it yourself as:
|
|
|
22
22
|
Firstly require the library:
|
|
23
23
|
|
|
24
24
|
```
|
|
25
|
-
require
|
|
25
|
+
require "honeybadger-api"
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
Then configure your personal API access token. Your personal API access token can be found on your [personal profile page](https://www.honeybadger.io/users/edit):
|
|
29
29
|
|
|
30
30
|
```
|
|
31
31
|
Honeybadger::Api.configure do |c|
|
|
32
|
-
c.access_token =
|
|
32
|
+
c.access_token = "xxxxxxxxxxxxxxxxxxxx"
|
|
33
33
|
end
|
|
34
34
|
```
|
|
35
35
|
|
|
@@ -132,10 +132,10 @@ Honeybadger::Api::Notice.paginate(project_id, fault_id)
|
|
|
132
132
|
# Find a comment
|
|
133
133
|
Honeybadger::Api::Comment.find(project_id, fault_id, comment_id)
|
|
134
134
|
|
|
135
|
-
# Find all the comments
|
|
135
|
+
# Find all the comments
|
|
136
136
|
Honeybadger::Api::Comment.all(project_id, fault_id)
|
|
137
137
|
|
|
138
|
-
# Retrieve a paginator for comments
|
|
138
|
+
# Retrieve a paginator for comments
|
|
139
139
|
Honeybadger::Api::Comment.paginate(project_id, fault_id)
|
|
140
140
|
```
|
|
141
141
|
|
|
@@ -159,22 +159,52 @@ Honeybadger::Api::TeamMember.find(team_id, team_member_id)
|
|
|
159
159
|
# Find all the team members
|
|
160
160
|
Honeybadger::Api::TeamMember.all(team_id)
|
|
161
161
|
|
|
162
|
-
# Retrieve a paginator for team members
|
|
162
|
+
# Retrieve a paginator for team members
|
|
163
163
|
Honeybadger::Api::TeamMember.paginate(team_id)
|
|
164
164
|
```
|
|
165
165
|
|
|
166
166
|
### Team Invitations
|
|
167
167
|
```
|
|
168
|
-
# Find a team invitation
|
|
168
|
+
# Find a team invitation
|
|
169
169
|
Honeybadger::Api::TeamInvitation.find(team_id, team_invitation_id)
|
|
170
170
|
|
|
171
|
-
# Find all the team invitations
|
|
171
|
+
# Find all the team invitations
|
|
172
172
|
Honeybadger::Api::TeamInvitation.all(team_id)
|
|
173
173
|
|
|
174
|
-
# Retrieve a paginator for team invitations
|
|
174
|
+
# Retrieve a paginator for team invitations
|
|
175
175
|
Honeybadger::Api::TeamInvitation.paginate(team_id)
|
|
176
176
|
```
|
|
177
177
|
|
|
178
|
+
### Sites
|
|
179
|
+
```
|
|
180
|
+
# Find a site
|
|
181
|
+
Honeybadger::Api::Site.find(project_id, site_id)
|
|
182
|
+
|
|
183
|
+
# Find all the sites
|
|
184
|
+
Honeybadger::Api::Site.all(project_id)
|
|
185
|
+
|
|
186
|
+
# Retrieve a paginator for sites
|
|
187
|
+
Honeybadger::Api::Site.paginate(project_id)
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Outages
|
|
191
|
+
```
|
|
192
|
+
# Find all the outages
|
|
193
|
+
Honeybadger::Api::Outage.all(project_id, site_id)
|
|
194
|
+
|
|
195
|
+
# Retrieve a paginator for outages
|
|
196
|
+
Honeybadger::Api::Outage.paginate(project_id, site_id)
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Uptime Checks
|
|
200
|
+
```
|
|
201
|
+
# Find all the uptime checks
|
|
202
|
+
Honeybadger::Api::UptimeCheck.all(project_id, site_id)
|
|
203
|
+
|
|
204
|
+
# Retrieve a paginator for uptime checks
|
|
205
|
+
Honeybadger::Api::UptimeCheck.paginate(project_id, site_id)
|
|
206
|
+
```
|
|
207
|
+
|
|
178
208
|
## Contributing
|
|
179
209
|
|
|
180
210
|
1. Fork it
|
data/honeybadger-api.gemspec
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# coding: utf-8
|
|
2
|
-
lib = File.expand_path(
|
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
-
require
|
|
4
|
+
require "honeybadger-api/version"
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = "honeybadger-api"
|
|
@@ -17,11 +17,11 @@ Gem::Specification.new do |spec|
|
|
|
17
17
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
18
18
|
spec.require_paths = ["lib"]
|
|
19
19
|
|
|
20
|
-
spec.add_runtime_dependency
|
|
20
|
+
spec.add_runtime_dependency "json"
|
|
21
21
|
|
|
22
|
-
spec.add_development_dependency
|
|
23
|
-
spec.add_development_dependency
|
|
24
|
-
spec.add_development_dependency
|
|
25
|
-
spec.add_development_dependency
|
|
26
|
-
spec.add_development_dependency
|
|
22
|
+
spec.add_development_dependency "rspec", "3.4.0"
|
|
23
|
+
spec.add_development_dependency "webmock"
|
|
24
|
+
spec.add_development_dependency "mocha"
|
|
25
|
+
spec.add_development_dependency "factory_girl", "4.7.0"
|
|
26
|
+
spec.add_development_dependency "activesupport", "4.2.6"
|
|
27
27
|
end
|
data/lib/honeybadger-api.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "date"
|
|
2
2
|
|
|
3
3
|
require "honeybadger-api/version"
|
|
4
4
|
require "honeybadger-api/configuration"
|
|
@@ -14,6 +14,9 @@ require "honeybadger-api/comment"
|
|
|
14
14
|
require "honeybadger-api/project"
|
|
15
15
|
require "honeybadger-api/fault"
|
|
16
16
|
require "honeybadger-api/notice"
|
|
17
|
+
require "honeybadger-api/site"
|
|
18
|
+
require "honeybadger-api/uptime_check"
|
|
19
|
+
require "honeybadger-api/outage"
|
|
17
20
|
|
|
18
21
|
module Honeybadger
|
|
19
22
|
module Api
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
module Honeybadger
|
|
2
|
+
module Api
|
|
3
|
+
class Outage
|
|
4
|
+
|
|
5
|
+
attr_reader :down_at, :up_at, :created_at, :status, :reason, :headers
|
|
6
|
+
|
|
7
|
+
# Public: Build a new instance of Outage
|
|
8
|
+
#
|
|
9
|
+
# opts - A Hash of attributes to initialize an Outage
|
|
10
|
+
#
|
|
11
|
+
# Returns a new Outage
|
|
12
|
+
def initialize(opts)
|
|
13
|
+
@down_at = opts[:down_at].nil? ? nil : DateTime.parse(opts[:down_at])
|
|
14
|
+
@up_at = opts[:up_at].nil? ? nil : DateTime.parse(opts[:up_at])
|
|
15
|
+
@created_at = opts[:created_at].nil? ? nil : DateTime.parse(opts[:created_at])
|
|
16
|
+
@status = opts[:status]
|
|
17
|
+
@reason = opts[:reason]
|
|
18
|
+
@headers = opts[:headers]
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Public: Find all outages for a given project and site.
|
|
22
|
+
def self.all(project_id, site_id)
|
|
23
|
+
path = "projects/#{project_id}/sites/#{site_id}/outages"
|
|
24
|
+
Honeybadger::Api::Request.all(path, handler)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Public: Paginate all outages for a given project and site.
|
|
28
|
+
def self.paginate(project_id, site_id, filters = {})
|
|
29
|
+
path = "projects/#{project_id}/sites/#{site_id}/outages"
|
|
30
|
+
Honeybadger::Api::Request.paginate(path, handler, filters)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Internal: The handler used to build objects from API responses.
|
|
34
|
+
def self.handler
|
|
35
|
+
Proc.new { |response| Outage.new(response) }
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
module Honeybadger
|
|
2
|
+
module Api
|
|
3
|
+
class Site
|
|
4
|
+
|
|
5
|
+
attr_reader :active, :frequency, :id, :last_checked_at,
|
|
6
|
+
:match, :match_type, :name, :state, :url
|
|
7
|
+
|
|
8
|
+
# Public: Build a new instance of Site
|
|
9
|
+
#
|
|
10
|
+
# opts - A Hash of attributes to initialize a Site
|
|
11
|
+
#
|
|
12
|
+
# Returns a new Site
|
|
13
|
+
def initialize(opts)
|
|
14
|
+
@active = opts[:active]
|
|
15
|
+
@frequency = opts[:frequency]
|
|
16
|
+
@id = opts[:id]
|
|
17
|
+
@last_checked_at = opts[:last_checked_at].nil? ? nil : DateTime.parse(opts[:last_checked_at])
|
|
18
|
+
@match = opts[:match]
|
|
19
|
+
@match_type = opts[:match_type]
|
|
20
|
+
@name = opts[:name]
|
|
21
|
+
@state = opts[:state]
|
|
22
|
+
@url = opts[:url]
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Public: Find all sites for a given project.
|
|
26
|
+
def self.all(project_id)
|
|
27
|
+
path = "projects/#{project_id}/sites"
|
|
28
|
+
Honeybadger::Api::Request.all(path, handler)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Public: Paginate all sites for a given project.
|
|
32
|
+
def self.paginate(project_id, filters = {})
|
|
33
|
+
path = "projects/#{project_id}/sites"
|
|
34
|
+
Honeybadger::Api::Request.paginate(path, handler, filters)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Public: Find a site for a given project.
|
|
38
|
+
def self.find(project_id, site_id)
|
|
39
|
+
path = "projects/#{project_id}/sites/#{site_id}"
|
|
40
|
+
Honeybadger::Api::Request.find(path, handler)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Internal: The handler used to build objects from API responses.
|
|
44
|
+
def self.handler
|
|
45
|
+
Proc.new { |response| Site.new(response) }
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
module Honeybadger
|
|
2
|
+
module Api
|
|
3
|
+
class UptimeCheck
|
|
4
|
+
|
|
5
|
+
attr_reader :up, :location, :duration, :created_at
|
|
6
|
+
|
|
7
|
+
# Public: Build a new instance of UptimeCheck
|
|
8
|
+
#
|
|
9
|
+
# opts - A Hash of attributes to initialize a UptimeCheck
|
|
10
|
+
#
|
|
11
|
+
# Returns a new UptimeCheck
|
|
12
|
+
def initialize(opts)
|
|
13
|
+
@up = opts[:up]
|
|
14
|
+
@location = opts[:location]
|
|
15
|
+
@duration = opts[:duration]
|
|
16
|
+
@created_at = opts[:created_at].nil? ? nil : DateTime.parse(opts[:created_at])
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Public: Find all uptime checks for a given project and site.
|
|
20
|
+
def self.all(project_id, site_id)
|
|
21
|
+
path = "projects/#{project_id}/sites/#{site_id}/uptime_checks"
|
|
22
|
+
Honeybadger::Api::Request.all(path, handler)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Public: Paginate all uptime checks for a given project and site.
|
|
26
|
+
def self.paginate(project_id, site_id, filters = {})
|
|
27
|
+
path = "projects/#{project_id}/sites/#{site_id}/uptime_checks"
|
|
28
|
+
Honeybadger::Api::Request.paginate(path, handler, filters)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Internal: The handler used to build objects from API responses.
|
|
32
|
+
def self.handler
|
|
33
|
+
Proc.new { |response| UptimeCheck.new(response) }
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
data/spec/comment_spec.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "spec_helper"
|
|
2
2
|
|
|
3
3
|
describe Honeybadger::Api::Comment do
|
|
4
4
|
|
|
@@ -65,7 +65,7 @@ describe Honeybadger::Api::Comment do
|
|
|
65
65
|
@fault_id = 2
|
|
66
66
|
@path = "projects/#{@project_id}/faults/#{@fault_id}/comments"
|
|
67
67
|
@handler = Proc.new { |response| Comment.new(response) }
|
|
68
|
-
@filters = { some_filter:
|
|
68
|
+
@filters = { some_filter: "value" }
|
|
69
69
|
Honeybadger::Api::Comment.expects(:handler).returns(@handler)
|
|
70
70
|
end
|
|
71
71
|
|
data/spec/deploy_spec.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "spec_helper"
|
|
2
2
|
|
|
3
3
|
describe Honeybadger::Api::Deploy do
|
|
4
4
|
|
|
@@ -55,7 +55,7 @@ describe Honeybadger::Api::Deploy do
|
|
|
55
55
|
@project_id = 1
|
|
56
56
|
@path = "projects/#{@project_id}/deploys"
|
|
57
57
|
@handler = Proc.new { |response| Deploy.new(response) }
|
|
58
|
-
@filters = { some_filter:
|
|
58
|
+
@filters = { some_filter: "value" }
|
|
59
59
|
Honeybadger::Api::Deploy.expects(:handler).returns(@handler)
|
|
60
60
|
end
|
|
61
61
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
FactoryGirl.define do
|
|
2
|
+
factory :outage, :class => Honeybadger::Api::Outage do
|
|
3
|
+
down_at "2015-02-17T18:20:44.776959Z"
|
|
4
|
+
up_at "2015-02-17T18:22:35.614678Z"
|
|
5
|
+
created_at "2015-02-17T18:20:44.777914Z"
|
|
6
|
+
status 301
|
|
7
|
+
reason "Expected 2xx status code. Got 301"
|
|
8
|
+
headers({
|
|
9
|
+
:date => "Tue, 17 Feb 2015 18:20:44 GMT",
|
|
10
|
+
:server => "DNSME HTTP Redirection",
|
|
11
|
+
:location => "http://text.vote/polls",
|
|
12
|
+
:connection => "close",
|
|
13
|
+
:content_length => "0"
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
initialize_with do
|
|
17
|
+
new(attributes)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
FactoryGirl.define do
|
|
2
|
+
factory :site, :class => Honeybadger::Api::Site do
|
|
3
|
+
id "9eed6a7e-af77-4cc6-8c55-b7b17555330d"
|
|
4
|
+
active true
|
|
5
|
+
frequency 5
|
|
6
|
+
last_checked_at "2016-06-15T12:57:29.646956Z"
|
|
7
|
+
match nil
|
|
8
|
+
match_type "success"
|
|
9
|
+
name "Main site"
|
|
10
|
+
state "down"
|
|
11
|
+
url "http://www.example.com"
|
|
12
|
+
|
|
13
|
+
initialize_with do
|
|
14
|
+
new(attributes)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
data/spec/fault_spec.rb
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "spec_helper"
|
|
2
2
|
|
|
3
3
|
describe Honeybadger::Api::Fault do
|
|
4
4
|
|
|
5
|
-
describe "initializing a new
|
|
5
|
+
describe "initializing a new fault" do
|
|
6
6
|
before :all do
|
|
7
7
|
@fault = FactoryGirl.build :fault
|
|
8
8
|
end
|
|
@@ -135,7 +135,7 @@ describe Honeybadger::Api::Fault do
|
|
|
135
135
|
@project_id = 1
|
|
136
136
|
@path = "projects/#{@project_id}/faults"
|
|
137
137
|
@handler = Proc.new { |response| Fault.new(response) }
|
|
138
|
-
@filters = { some_filter:
|
|
138
|
+
@filters = { some_filter: "value" }
|
|
139
139
|
Honeybadger::Api::Fault.expects(:handler).returns(@handler)
|
|
140
140
|
end
|
|
141
141
|
|
|
@@ -159,4 +159,4 @@ describe Honeybadger::Api::Fault do
|
|
|
159
159
|
Honeybadger::Api::Fault.find(@project_id, @fault_id)
|
|
160
160
|
end
|
|
161
161
|
end
|
|
162
|
-
end
|
|
162
|
+
end
|
data/spec/notice_spec.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "spec_helper"
|
|
2
2
|
|
|
3
3
|
describe Honeybadger::Api::Notice do
|
|
4
4
|
|
|
@@ -99,7 +99,7 @@ describe Honeybadger::Api::Notice do
|
|
|
99
99
|
@fault_id = 2
|
|
100
100
|
@path = "projects/#{@project_id}/faults/#{@fault_id}/notices"
|
|
101
101
|
@handler = Proc.new { |response| Notice.new(response) }
|
|
102
|
-
@filters = { some_filter:
|
|
102
|
+
@filters = { some_filter: "value" }
|
|
103
103
|
Honeybadger::Api::Notice.expects(:handler).returns(@handler)
|
|
104
104
|
end
|
|
105
105
|
|
data/spec/outage_spec.rb
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
describe Honeybadger::Api::Outage do
|
|
4
|
+
|
|
5
|
+
describe "initializing a new outage" do
|
|
6
|
+
before :all do
|
|
7
|
+
@outage = FactoryGirl.build :outage
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
it "should have a down_at attribute" do
|
|
11
|
+
expect(@outage.down_at).to eql(DateTime.parse("2015-02-17T18:20:44.776959Z"))
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it "should have an up_at attribute" do
|
|
15
|
+
expect(@outage.up_at).to eql(DateTime.parse("2015-02-17T18:22:35.614678Z"))
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it "should have a created_at attribute" do
|
|
19
|
+
expect(@outage.created_at).to eql(DateTime.parse("2015-02-17T18:20:44.777914Z"))
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it "should have a status attribute" do
|
|
23
|
+
expect(@outage.status).to eql(301)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it "should have a reason attribute" do
|
|
27
|
+
expect(@outage.reason).to eql("Expected 2xx status code. Got 301")
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it "should have a headers attribute" do
|
|
31
|
+
expected_headers = {
|
|
32
|
+
:date => "Tue, 17 Feb 2015 18:20:44 GMT",
|
|
33
|
+
:server => "DNSME HTTP Redirection",
|
|
34
|
+
:location => "http://text.vote/polls",
|
|
35
|
+
:connection => "close",
|
|
36
|
+
:content_length => "0"
|
|
37
|
+
}
|
|
38
|
+
expect(@outage.headers).to eql(expected_headers)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
describe "all" do
|
|
43
|
+
before :each do
|
|
44
|
+
@project_id = 1
|
|
45
|
+
@site_id = 2
|
|
46
|
+
@path = "projects/#{@project_id}/sites/#{@site_id}/outages"
|
|
47
|
+
@handler = Proc.new { |response| Outage.new(response) }
|
|
48
|
+
Honeybadger::Api::Outage.expects(:handler).returns(@handler)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
it "should find all of the uptime checks" do
|
|
52
|
+
Honeybadger::Api::Request.expects(:all).with(@path, @handler).once
|
|
53
|
+
Honeybadger::Api::Outage.all(@project_id, @site_id)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
describe "paginate" do
|
|
58
|
+
before :each do
|
|
59
|
+
@project_id = 1
|
|
60
|
+
@site_id = 2
|
|
61
|
+
@path = "projects/#{@project_id}/sites/#{@site_id}/outages"
|
|
62
|
+
@handler = Proc.new { |response| Outage.new(response) }
|
|
63
|
+
@filters = { some_filter: "value" }
|
|
64
|
+
Honeybadger::Api::Outage.expects(:handler).returns(@handler)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
it "should paginate all of the uptime checks" do
|
|
68
|
+
Honeybadger::Api::Request.expects(:paginate).with(@path, @handler, @filters).once
|
|
69
|
+
Honeybadger::Api::Outage.paginate(@project_id, @site_id, @filters)
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
data/spec/paginator_spec.rb
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "spec_helper"
|
|
2
2
|
|
|
3
3
|
describe Honeybadger::Api::Paginator do
|
|
4
4
|
|
|
5
5
|
describe "next? and previous?" do
|
|
6
6
|
before :all do
|
|
7
|
-
@client_stub = stub(
|
|
7
|
+
@client_stub = stub("client")
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
describe "when there is one page" do
|
data/spec/project_spec.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "spec_helper"
|
|
2
2
|
|
|
3
3
|
describe Honeybadger::Api::Project do
|
|
4
4
|
|
|
@@ -140,7 +140,7 @@ describe Honeybadger::Api::Project do
|
|
|
140
140
|
before :each do
|
|
141
141
|
@path = "projects"
|
|
142
142
|
@handler = Proc.new { |response| Project.new(response) }
|
|
143
|
-
@filters = { some_filter:
|
|
143
|
+
@filters = { some_filter: "value" }
|
|
144
144
|
Honeybadger::Api::Project.expects(:handler).returns(@handler)
|
|
145
145
|
end
|
|
146
146
|
|
data/spec/site_spec.rb
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
describe Honeybadger::Api::Site do
|
|
4
|
+
|
|
5
|
+
describe "initializing a new site" do
|
|
6
|
+
before :all do
|
|
7
|
+
@site = FactoryGirl.build :site
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
it "should have an id attribute" do
|
|
11
|
+
expect(@site.id).to eql("9eed6a7e-af77-4cc6-8c55-b7b17555330d")
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it "should have an active attribute" do
|
|
15
|
+
expect(@site.active).to be true
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it "should have a frequency attribute" do
|
|
19
|
+
expect(@site.frequency).to eql(5)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it "should have a last_checked_at attribute" do
|
|
23
|
+
expect(@site.last_checked_at).to eql(DateTime.parse("2016-06-15T12:57:29.646956Z"))
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it "should have a match attribute" do
|
|
27
|
+
expect(@site.match).to be_nil
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it "should have a match_type attribute" do
|
|
31
|
+
expect(@site.match_type).to eql("success")
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it "should have a name attribute" do
|
|
35
|
+
expect(@site.name).to eql("Main site")
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it "should have a state attribute" do
|
|
39
|
+
expect(@site.state).to eql("down")
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it "should have an url attribute" do
|
|
43
|
+
expect(@site.url).to eql("http://www.example.com")
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
describe "all" do
|
|
48
|
+
before :each do
|
|
49
|
+
@project_id = 1
|
|
50
|
+
@path = "projects/#{@project_id}/sites"
|
|
51
|
+
@handler = Proc.new { |response| Site.new(response) }
|
|
52
|
+
Honeybadger::Api::Site.expects(:handler).returns(@handler)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
it "should find all of the sites" do
|
|
56
|
+
Honeybadger::Api::Request.expects(:all).with(@path, @handler).once
|
|
57
|
+
Honeybadger::Api::Site.all(@project_id)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
describe "paginate" do
|
|
62
|
+
before :each do
|
|
63
|
+
@project_id = 1
|
|
64
|
+
@path = "projects/#{@project_id}/sites"
|
|
65
|
+
@handler = Proc.new { |response| Site.new(response) }
|
|
66
|
+
@filters = { some_filter: "value" }
|
|
67
|
+
Honeybadger::Api::Site.expects(:handler).returns(@handler)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
it "should paginate all of the sites" do
|
|
71
|
+
Honeybadger::Api::Request.expects(:paginate).with(@path, @handler, @filters).once
|
|
72
|
+
Honeybadger::Api::Site.paginate(@project_id, @filters)
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
describe "find" do
|
|
77
|
+
before :each do
|
|
78
|
+
@project_id = 1
|
|
79
|
+
@site_id = 2
|
|
80
|
+
@path = "projects/#{@project_id}/sites/#{@site_id}"
|
|
81
|
+
@handler = Proc.new { |response| Site.new(response) }
|
|
82
|
+
Honeybadger::Api::Site.expects(:handler).returns(@handler)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
it "should find a site" do
|
|
86
|
+
Honeybadger::Api::Request.expects(:find).with(@path, @handler).once
|
|
87
|
+
Honeybadger::Api::Site.find(@project_id, @site_id)
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
require
|
|
2
|
-
require
|
|
3
|
-
require
|
|
4
|
-
require
|
|
5
|
-
require
|
|
1
|
+
require "rspec"
|
|
2
|
+
require "webmock/rspec"
|
|
3
|
+
require "mocha/api"
|
|
4
|
+
require "factory_girl"
|
|
5
|
+
require "honeybadger-api"
|
|
6
6
|
|
|
7
7
|
RSpec.configure do |config|
|
|
8
8
|
config.color = true
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "spec_helper"
|
|
2
2
|
|
|
3
3
|
describe Honeybadger::Api::TeamInvitation do
|
|
4
4
|
|
|
@@ -71,7 +71,7 @@ describe Honeybadger::Api::TeamInvitation do
|
|
|
71
71
|
@team_id = 1
|
|
72
72
|
@path = "teams/#{@team_id}/team_invitations"
|
|
73
73
|
@handler = Proc.new { |response| TeamInvitation.new(response) }
|
|
74
|
-
@filters = { some_filter:
|
|
74
|
+
@filters = { some_filter: "value" }
|
|
75
75
|
Honeybadger::Api::TeamInvitation.expects(:handler).returns(@handler)
|
|
76
76
|
end
|
|
77
77
|
|
data/spec/team_member_spec.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "spec_helper"
|
|
2
2
|
|
|
3
3
|
describe Honeybadger::Api::TeamMember do
|
|
4
4
|
|
|
@@ -85,7 +85,7 @@ describe Honeybadger::Api::TeamMember do
|
|
|
85
85
|
@team_id = 1
|
|
86
86
|
@path = "teams/#{@team_id}/team_members"
|
|
87
87
|
@handler = Proc.new { |response| TeamMember.new(response) }
|
|
88
|
-
@filters = { some_filter:
|
|
88
|
+
@filters = { some_filter: "value" }
|
|
89
89
|
Honeybadger::Api::TeamMember.expects(:handler).returns(@handler)
|
|
90
90
|
end
|
|
91
91
|
|
data/spec/team_spec.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "spec_helper"
|
|
2
2
|
|
|
3
3
|
describe Honeybadger::Api::Team do
|
|
4
4
|
|
|
@@ -42,7 +42,7 @@ describe Honeybadger::Api::Team do
|
|
|
42
42
|
before :each do
|
|
43
43
|
@path = "teams"
|
|
44
44
|
@handler = Proc.new { |response| Team.new(response) }
|
|
45
|
-
@filters = { some_filter:
|
|
45
|
+
@filters = { some_filter: "value" }
|
|
46
46
|
Honeybadger::Api::Team.expects(:handler).returns(@handler)
|
|
47
47
|
end
|
|
48
48
|
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
describe Honeybadger::Api::UptimeCheck do
|
|
4
|
+
|
|
5
|
+
describe "initializing a new uptime check" do
|
|
6
|
+
before :all do
|
|
7
|
+
@uptime_check = FactoryGirl.build :uptime_check
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
it "should have an up attribute" do
|
|
11
|
+
expect(@uptime_check.up).to be true
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it "should have a location attribute" do
|
|
15
|
+
expect(@uptime_check.location).to eql("Singapore")
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it "should have a duration attribute" do
|
|
19
|
+
expect(@uptime_check.duration).to eql(1201)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it "should have a created_at attribute" do
|
|
23
|
+
expect(@uptime_check.created_at).to eql(DateTime.parse("2016-06-16T20:19:32.852569Z"))
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
describe "all" do
|
|
28
|
+
before :each do
|
|
29
|
+
@project_id = 1
|
|
30
|
+
@site_id = 2
|
|
31
|
+
@path = "projects/#{@project_id}/sites/#{@site_id}/uptime_checks"
|
|
32
|
+
@handler = Proc.new { |response| UptimeCheck.new(response) }
|
|
33
|
+
Honeybadger::Api::UptimeCheck.expects(:handler).returns(@handler)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it "should find all of the uptime checks" do
|
|
37
|
+
Honeybadger::Api::Request.expects(:all).with(@path, @handler).once
|
|
38
|
+
Honeybadger::Api::UptimeCheck.all(@project_id, @site_id)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
describe "paginate" do
|
|
43
|
+
before :each do
|
|
44
|
+
@project_id = 1
|
|
45
|
+
@site_id = 2
|
|
46
|
+
@path = "projects/#{@project_id}/sites/#{@site_id}/uptime_checks"
|
|
47
|
+
@handler = Proc.new { |response| UptimeCheck.new(response) }
|
|
48
|
+
@filters = { some_filter: "value" }
|
|
49
|
+
Honeybadger::Api::UptimeCheck.expects(:handler).returns(@handler)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
it "should paginate all of the uptime checks" do
|
|
53
|
+
Honeybadger::Api::Request.expects(:paginate).with(@path, @handler, @filters).once
|
|
54
|
+
Honeybadger::Api::UptimeCheck.paginate(@project_id, @site_id, @filters)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
data/spec/user_spec.rb
CHANGED
data/spec/version_spec.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "spec_helper"
|
|
2
2
|
|
|
3
3
|
describe "Honeybadger::Api::VERSION" do
|
|
4
|
-
it "should be version 2.0
|
|
5
|
-
expect(Honeybadger::Api::VERSION).to eql("2.0
|
|
4
|
+
it "should be version 2.1.0" do
|
|
5
|
+
expect(Honeybadger::Api::VERSION).to eql("2.1.0")
|
|
6
6
|
end
|
|
7
|
-
end
|
|
7
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: honeybadger-api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0
|
|
4
|
+
version: 2.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Murray Summers
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2017-01-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: json
|
|
@@ -115,12 +115,15 @@ files:
|
|
|
115
115
|
- lib/honeybadger-api/deploy.rb
|
|
116
116
|
- lib/honeybadger-api/fault.rb
|
|
117
117
|
- lib/honeybadger-api/notice.rb
|
|
118
|
+
- lib/honeybadger-api/outage.rb
|
|
118
119
|
- lib/honeybadger-api/paginator.rb
|
|
119
120
|
- lib/honeybadger-api/project.rb
|
|
120
121
|
- lib/honeybadger-api/request.rb
|
|
122
|
+
- lib/honeybadger-api/site.rb
|
|
121
123
|
- lib/honeybadger-api/team.rb
|
|
122
124
|
- lib/honeybadger-api/team_invitation.rb
|
|
123
125
|
- lib/honeybadger-api/team_member.rb
|
|
126
|
+
- lib/honeybadger-api/uptime_check.rb
|
|
124
127
|
- lib/honeybadger-api/user.rb
|
|
125
128
|
- lib/honeybadger-api/version.rb
|
|
126
129
|
- spec/comment_spec.rb
|
|
@@ -129,19 +132,25 @@ files:
|
|
|
129
132
|
- spec/factories/deploy_factory.rb
|
|
130
133
|
- spec/factories/fault_factory.rb
|
|
131
134
|
- spec/factories/notice_factory.rb
|
|
135
|
+
- spec/factories/outage_factory.rb
|
|
132
136
|
- spec/factories/project_factory.rb
|
|
137
|
+
- spec/factories/site_factory.rb
|
|
133
138
|
- spec/factories/team_factory.rb
|
|
134
139
|
- spec/factories/team_invitation_factory.rb
|
|
135
140
|
- spec/factories/team_member_factory.rb
|
|
141
|
+
- spec/factories/uptime_check_factory.rb
|
|
136
142
|
- spec/factories/user_factory.rb
|
|
137
143
|
- spec/fault_spec.rb
|
|
138
144
|
- spec/notice_spec.rb
|
|
145
|
+
- spec/outage_spec.rb
|
|
139
146
|
- spec/paginator_spec.rb
|
|
140
147
|
- spec/project_spec.rb
|
|
148
|
+
- spec/site_spec.rb
|
|
141
149
|
- spec/spec_helper.rb
|
|
142
150
|
- spec/team_invitation_spec.rb
|
|
143
151
|
- spec/team_member_spec.rb
|
|
144
152
|
- spec/team_spec.rb
|
|
153
|
+
- spec/uptime_check_spec.rb
|
|
145
154
|
- spec/user_spec.rb
|
|
146
155
|
- spec/version_spec.rb
|
|
147
156
|
homepage: https://github.com/murraysum/honeybadger-api
|
|
@@ -175,19 +184,25 @@ test_files:
|
|
|
175
184
|
- spec/factories/deploy_factory.rb
|
|
176
185
|
- spec/factories/fault_factory.rb
|
|
177
186
|
- spec/factories/notice_factory.rb
|
|
187
|
+
- spec/factories/outage_factory.rb
|
|
178
188
|
- spec/factories/project_factory.rb
|
|
189
|
+
- spec/factories/site_factory.rb
|
|
179
190
|
- spec/factories/team_factory.rb
|
|
180
191
|
- spec/factories/team_invitation_factory.rb
|
|
181
192
|
- spec/factories/team_member_factory.rb
|
|
193
|
+
- spec/factories/uptime_check_factory.rb
|
|
182
194
|
- spec/factories/user_factory.rb
|
|
183
195
|
- spec/fault_spec.rb
|
|
184
196
|
- spec/notice_spec.rb
|
|
197
|
+
- spec/outage_spec.rb
|
|
185
198
|
- spec/paginator_spec.rb
|
|
186
199
|
- spec/project_spec.rb
|
|
200
|
+
- spec/site_spec.rb
|
|
187
201
|
- spec/spec_helper.rb
|
|
188
202
|
- spec/team_invitation_spec.rb
|
|
189
203
|
- spec/team_member_spec.rb
|
|
190
204
|
- spec/team_spec.rb
|
|
205
|
+
- spec/uptime_check_spec.rb
|
|
191
206
|
- spec/user_spec.rb
|
|
192
207
|
- spec/version_spec.rb
|
|
193
208
|
has_rdoc:
|