airbrake-api 4.0.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/airbrake-api/client.rb +14 -0
- data/lib/airbrake-api/version.rb +1 -1
- data/spec/airbrake_api/client_spec.rb +39 -2
- metadata +3 -3
data/lib/airbrake-api/client.rb
CHANGED
@@ -18,6 +18,20 @@ module AirbrakeAPI
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
+
def url_for(endpoint, *args)
|
22
|
+
path = case endpoint.to_s
|
23
|
+
when 'deploys' then deploys_path(*args)
|
24
|
+
when 'projects' then '/projects'
|
25
|
+
when 'errors' then errors_path
|
26
|
+
when 'error' then error_path(*args)
|
27
|
+
when 'notices' then notices_path(*args)
|
28
|
+
when 'notice' then notice_path(*args)
|
29
|
+
else raise ArgumentError.new("Unrecognized path: #{path}")
|
30
|
+
end
|
31
|
+
|
32
|
+
[account_path, path.split('.').first].join('')
|
33
|
+
end
|
34
|
+
|
21
35
|
# deploys
|
22
36
|
|
23
37
|
def deploys(project_id, options = {})
|
data/lib/airbrake-api/version.rb
CHANGED
@@ -88,10 +88,10 @@ describe AirbrakeAPI::Client do
|
|
88
88
|
|
89
89
|
first_deploy.rails_env.should eq('production')
|
90
90
|
end
|
91
|
-
|
91
|
+
|
92
92
|
it 'returns empty when no data' do
|
93
93
|
@client.deploys('67890').should be_kind_of(Array)
|
94
|
-
end
|
94
|
+
end
|
95
95
|
end
|
96
96
|
|
97
97
|
describe '#projects' do
|
@@ -175,4 +175,41 @@ describe AirbrakeAPI::Client do
|
|
175
175
|
end
|
176
176
|
end
|
177
177
|
end
|
178
|
+
|
179
|
+
describe '#url_for' do
|
180
|
+
before(:all) do
|
181
|
+
options = { :account => 'myapp', :auth_token => 'abcdefg123456', :secure => false }
|
182
|
+
AirbrakeAPI.configure(options)
|
183
|
+
|
184
|
+
@client = AirbrakeAPI::Client.new
|
185
|
+
end
|
186
|
+
|
187
|
+
it 'generates web urls for projects' do
|
188
|
+
@client.url_for(:projects).should eq('http://myapp.airbrake.io/projects')
|
189
|
+
end
|
190
|
+
|
191
|
+
it 'generates web urls for deploys' do
|
192
|
+
@client.url_for(:deploys, '2000').should eq('http://myapp.airbrake.io/projects/2000/deploys')
|
193
|
+
end
|
194
|
+
|
195
|
+
it 'generates web urls for errors' do
|
196
|
+
@client.url_for(:errors).should eq('http://myapp.airbrake.io/errors')
|
197
|
+
end
|
198
|
+
|
199
|
+
it 'generates web urls for individual errors' do
|
200
|
+
@client.url_for(:error, 1696171).should eq('http://myapp.airbrake.io/errors/1696171')
|
201
|
+
end
|
202
|
+
|
203
|
+
it 'generates web urls for notices' do
|
204
|
+
@client.url_for(:notices, 1696171).should eq('http://myapp.airbrake.io/errors/1696171/notices')
|
205
|
+
end
|
206
|
+
|
207
|
+
it 'generates web urls for individual notices' do
|
208
|
+
@client.url_for(:notice, 123, 1696171).should eq('http://myapp.airbrake.io/errors/1696171/notices/123')
|
209
|
+
end
|
210
|
+
|
211
|
+
it 'raises an exception when passed an unknown endpoint' do
|
212
|
+
lambda { @client.url_for(:foo) }.should raise_error(ArgumentError)
|
213
|
+
end
|
214
|
+
end
|
178
215
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: airbrake-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -293,7 +293,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
293
293
|
version: '0'
|
294
294
|
segments:
|
295
295
|
- 0
|
296
|
-
hash: -
|
296
|
+
hash: -2747691361078738522
|
297
297
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
298
298
|
none: false
|
299
299
|
requirements:
|
@@ -302,7 +302,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
302
302
|
version: '0'
|
303
303
|
segments:
|
304
304
|
- 0
|
305
|
-
hash: -
|
305
|
+
hash: -2747691361078738522
|
306
306
|
requirements: []
|
307
307
|
rubyforge_project:
|
308
308
|
rubygems_version: 1.8.24
|