airbrake-api 4.3.0 → 4.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -24,7 +24,7 @@ module AirbrakeAPI
24
24
  path = case endpoint.to_s
25
25
  when 'deploys' then deploys_path(*args)
26
26
  when 'projects' then '/projects'
27
- when 'errors' then errors_path
27
+ when 'errors' then errors_path(*args)
28
28
  when 'error' then error_path(*args)
29
29
  when 'notices' then notices_path(*args)
30
30
  when 'notice' then notice_path(*args)
@@ -65,8 +65,8 @@ module AirbrakeAPI
65
65
  "#{unformatted_error_path(error_id)}.xml"
66
66
  end
67
67
 
68
- def errors_path
69
- '/groups.xml'
68
+ def errors_path(options={})
69
+ "#{options[:project_id] ? "/projects/#{options[:project_id]}" : nil}/groups.xml"
70
70
  end
71
71
 
72
72
  def update(error, options = {})
@@ -80,7 +80,9 @@ module AirbrakeAPI
80
80
  end
81
81
 
82
82
  def errors(options = {})
83
- results = request(:get, errors_path, options)
83
+ options = options.dup
84
+ project_id = options.delete(:project_id)
85
+ results = request(:get, errors_path(:project_id => project_id), options)
84
86
  results.group || results.groups
85
87
  end
86
88
 
@@ -1,3 +1,3 @@
1
1
  module AirbrakeAPI
2
- VERSION = '4.3.0'
2
+ VERSION = '4.4.0'
3
3
  end
@@ -128,6 +128,11 @@ describe AirbrakeAPI::Client do
128
128
  ordered.should == errors
129
129
  errors.size.should == 2
130
130
  end
131
+
132
+ it "should use project_id for error path" do
133
+ @client.should_receive(:request).with(:get, "/projects/123/groups.xml", {}).and_return(stub(:group => 111))
134
+ @client.errors(:project_id => 123)
135
+ end
131
136
  end
132
137
 
133
138
  describe '#error' do
@@ -209,6 +214,10 @@ describe AirbrakeAPI::Client do
209
214
  @client.url_for(:errors).should eq('http://myapp.airbrake.io/groups')
210
215
  end
211
216
 
217
+ it 'generates web urls for errors with project_id' do
218
+ @client.url_for(:errors, :project_id => 123).should eq('http://myapp.airbrake.io/projects/123/groups')
219
+ end
220
+
212
221
  it 'generates web urls for individual errors' do
213
222
  @client.url_for(:error, 1696171).should eq('http://myapp.airbrake.io/groups/1696171')
214
223
  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.3.0
4
+ version: 4.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-25 00:00:00.000000000 Z
12
+ date: 2013-06-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hashie
@@ -147,7 +147,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
147
147
  version: '0'
148
148
  segments:
149
149
  - 0
150
- hash: 1928915121749542886
150
+ hash: 705071692726450878
151
151
  required_rubygems_version: !ruby/object:Gem::Requirement
152
152
  none: false
153
153
  requirements:
@@ -156,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
156
  version: '0'
157
157
  segments:
158
158
  - 0
159
- hash: 1928915121749542886
159
+ hash: 705071692726450878
160
160
  requirements: []
161
161
  rubyforge_project:
162
162
  rubygems_version: 1.8.23