Skip to content
This repository
Browse code

s/Hoptoad/Airbrake/gi

  • Loading branch information...
commit e9abeefb8b5cd573c6bd0902e4775a32cab2c8b8 1 parent 99a2ab6
Brad Greenlee authored September 04, 2011
32  README.md
Source Rendered
... ...
@@ -1,57 +1,57 @@
1  
-Hoptoad API
  1
+Airbrake API
2 2
 ===========
3 3
 
4  
-A ruby wrapper for the [Hoptoad API](http://hoptoadapp.com/pages/api)
  4
+A ruby wrapper for the [Airbrake API](http://airbrakeapp.com/pages/api)
5 5
 
6 6
 Usage
7 7
 -----
8 8
 
9 9
 The first thing you need to set is the account name.  This is the same as the web address for your account.
10 10
 
11  
-    Hoptoad.account = 'myaccount'
  11
+    Airbrake.account = 'myaccount'
12 12
 
13 13
 Then, you should set the authentication token.
14 14
 
15  
-    Hoptoad.auth_token = 'abcdefg'
  15
+    Airbrake.auth_token = 'abcdefg'
16 16
 
17 17
 If your account uses ssl then turn it on:
18 18
 
19  
-    Hoptoad.secure = true
  19
+    Airbrake.secure = true
20 20
 
21 21
 Optionally, you can configure through a single method:
22 22
 
23  
-    Hoptoad.configure(:account => 'anapp', :auth_token => 'abcdefg', :secure => true)
  23
+    Airbrake.configure(:account => 'anapp', :auth_token => 'abcdefg', :secure => true)
24 24
 
25  
-Once you've configured authentication, you can make calls against the API.  If no token or authentication is given, a HoptoadError exception will be raised.
  25
+Once you've configured authentication, you can make calls against the API.  If no token or authentication is given, a AirbrakeError exception will be raised.
26 26
 
27 27
 Finding Errors
28 28
 --------------
29 29
 
30 30
 Errors are paginated, the API responds with 25 at a time, pass an optional params hash for additional pages:
31 31
 
32  
-    Hoptoad::Error.find(:all)
33  
-    Hoptoad::Error.find(:all, :page => 2)
  32
+    Airbrake::Error.find(:all)
  33
+    Airbrake::Error.find(:all, :page => 2)
34 34
 
35 35
 To find an individual error, you can find by ID:
36 36
 
37  
-    Hoptoad::Error.find(error_id)
  37
+    Airbrake::Error.find(error_id)
38 38
 
39 39
 Find *all* notices of an error:
40 40
 
41  
-    Hoptoad::Notice.find_all_by_error_id(error_id)
  41
+    Airbrake::Notice.find_all_by_error_id(error_id)
42 42
 
43 43
 Find an individual notice:
44 44
 
45  
-    Hoptoad::Notice.find(notice_id, error_id)
  45
+    Airbrake::Notice.find(notice_id, error_id)
46 46
 
47 47
 To resolve an error via the API:
48 48
 
49  
-    Hoptoad::Error.update(1696170, :group => { :resolved => true})
  49
+    Airbrake::Error.update(1696170, :group => { :resolved => true})
50 50
 
51 51
 Recreate an error:
52 52
 
53 53
     STDOUT.sync = true
54  
-    Hoptoad::Notice.find_all_by_error_id(error_id) do |batch|
  54
+    Airbrake::Notice.find_all_by_error_id(error_id) do |batch|
55 55
       batch.each do |notice|
56 56
         result = system "curl --silent '#{notice.request.url}' > /dev/null"
57 57
         print (result ? '.' : 'F')
@@ -63,12 +63,12 @@ Projects
63 63
 
64 64
 To retrieve a list of projects:
65 65
 
66  
-    Hoptoad::Project.find(:all)
  66
+    Airbrake::Project.find(:all)
67 67
 
68 68
 Responses
69 69
 ---------
70 70
 
71  
-If an error is returned from the API.  A HoptoadError will be raised.  Successful responses will return a Hashie::Mash object based on the data from the response.
  71
+If an error is returned from the API.  A AirbrakeError will be raised.  Successful responses will return a Hashie::Mash object based on the data from the response.
72 72
 
73 73
 
74 74
 Contributors
12  hoptoad-api.gemspec → airbrake-api.gemspec
... ...
@@ -1,18 +1,18 @@
1 1
 # -*- encoding: utf-8 -*-
2 2
 $:.push File.expand_path("../lib", __FILE__)
3  
-require "hoptoad-api/version"
  3
+require "airbrake-api/version"
4 4
 
5 5
 Gem::Specification.new do |s|
6  
-  s.name      = 'hoptoad-api'
7  
-  s.version   = Hoptoad::VERSION
  6
+  s.name      = 'airbrake-api'
  7
+  s.version   = Airbrake::VERSION
8 8
   s.platform  = Gem::Platform::RUBY
9 9
 
10  
-  s.summary = "A ruby wrapper for the Hoptoad API"
11  
-  s.description = "A ruby wrapper for the Hoptoad API"
  10
+  s.summary = "A ruby wrapper for the Airbrake API"
  11
+  s.description = "A ruby wrapper for the Airbrake API"
12 12
 
13 13
   s.authors   = ['Steve Agalloco']
14 14
   s.email     = ['steve.agalloco@gmail.com']
15  
-  s.homepage  = 'http://github.com/spagalloco/hoptoad-api'
  15
+  s.homepage  = 'http://github.com/spagalloco/hoptoad-api' # FIXME: change to airbrake-api when repo has been renamed
16 16
 
17 17
   s.add_dependency(%q<httparty>, [">= 0.5.2"])
18 18
   s.add_dependency(%q<hashie>, [">= 0.2.0"])
16  lib/hoptoad-api.rb → lib/airbrake-api.rb
... ...
@@ -1,11 +1,11 @@
1 1
 require 'hashie'
2 2
 require 'httparty'
3 3
 
4  
-module Hoptoad
  4
+module Airbrake
5 5
   extend self
6 6
   attr_accessor :account, :auth_token, :secure
7 7
 
8  
-  class HoptoadError < StandardError; end
  8
+  class AirbrakeError < StandardError; end
9 9
 
10 10
   def configure(options={})
11 11
     @account = options[:account] if options.has_key?(:account)
@@ -14,7 +14,7 @@ def configure(options={})
14 14
   end
15 15
 
16 16
   def account_path
17  
-    "#{protocol}://#{@account}.hoptoadapp.com"
  17
+    "#{protocol}://#{@account}.airbrakeapp.com"
18 18
   end
19 19
 
20 20
   def protocol
@@ -23,8 +23,8 @@ def protocol
23 23
 
24 24
 end
25 25
 
26  
-require 'hoptoad-api/core_extensions'
27  
-require 'hoptoad-api/client'
28  
-require 'hoptoad-api/error'
29  
-require 'hoptoad-api/notice'
30  
-require 'hoptoad-api/project'
  26
+require 'airbrake-api/core_extensions'
  27
+require 'airbrake-api/client'
  28
+require 'airbrake-api/error'
  29
+require 'airbrake-api/notice'
  30
+require 'airbrake-api/project'
41  lib/airbrake-api/client.rb
... ...
@@ -0,0 +1,41 @@
  1
+module Airbrake
  2
+  class Base
  3
+    include HTTParty
  4
+    format :xml
  5
+
  6
+    private
  7
+
  8
+    def self.setup
  9
+      base_uri Airbrake.account_path
  10
+      default_params :auth_token => Airbrake.auth_token
  11
+
  12
+      check_configuration
  13
+    end
  14
+
  15
+    def self.check_configuration
  16
+      raise AirbrakeError.new('API Token cannot be nil') if default_options.nil? || default_options[:default_params].nil? || !default_options[:default_params].has_key?(:auth_token)
  17
+      raise AirbrakeError.new('Account cannot be nil') unless default_options.has_key?(:base_uri)
  18
+    end
  19
+
  20
+    def self.fetch(path, options)
  21
+      response = get(path, { :query => options })
  22
+      if response.code == 403
  23
+        raise AirbrakeError.new('SSL should be enabled - use Airbrake.secure = true in configuration')
  24
+      end
  25
+
  26
+      Hashie::Mash.new(response)
  27
+    end
  28
+
  29
+  end
  30
+end
  31
+
  32
+# airbrake sometimes returns broken xml with strange utmz stuff
  33
+# so we remove this
  34
+require 'httparty/parser'
  35
+class HTTParty::Parser
  36
+  alias utmz_unaware_xml xml
  37
+  def xml
  38
+    body.gsub!(/<__utmz>.*?<\/__utmz>/m,'')
  39
+    utmz_unaware_xml
  40
+  end
  41
+end
0  lib/hoptoad-api/core_extensions.rb → lib/airbrake-api/core_extensions.rb
File renamed without changes
14  lib/hoptoad-api/error.rb → lib/airbrake-api/error.rb
... ...
@@ -1,5 +1,5 @@
1  
-module Hoptoad
2  
-  class Error < Hoptoad::Base
  1
+module Airbrake
  2
+  class Error < Airbrake::Base
3 3
 
4 4
     def self.find(*args)
5 5
       setup
@@ -10,11 +10,11 @@ def self.find(*args)
10 10
         when :all
11 11
           find_all(args)
12 12
         else
13  
-          raise HoptoadError.new('Invalid argument')
  13
+          raise AirbrakeError.new('Invalid argument')
14 14
       end
15 15
 
16  
-      raise HoptoadError.new('No results found.') if results.nil?
17  
-      raise HoptoadError.new(results.errors.error) if results.errors
  16
+      raise AirbrakeError.new('No results found.') if results.nil?
  17
+      raise AirbrakeError.new(results.errors.error) if results.errors
18 18
 
19 19
       results.group || results.groups
20 20
     end
@@ -24,11 +24,11 @@ def self.update(error, options)
24 24
 
25 25
       response = put(error_path(error), { :query => options })
26 26
       if response.code == 403
27  
-        raise HoptoadError.new('SSL should be enabled - use Hoptoad.secure = true in configuration')
  27
+        raise AirbrakeError.new('SSL should be enabled - use Airbrake.secure = true in configuration')
28 28
       end
29 29
       results = Hashie::Mash.new(response)
30 30
 
31  
-      raise HoptoadError.new(results.errors.error) if results.errors
  31
+      raise AirbrakeError.new(results.errors.error) if results.errors
32 32
       results.group
33 33
     end
34 34
 
10  lib/hoptoad-api/notice.rb → lib/airbrake-api/notice.rb
... ...
@@ -1,7 +1,7 @@
1 1
 require 'parallel'
2 2
 
3  
-module Hoptoad
4  
-  class Notice < Hoptoad::Base
  3
+module Airbrake
  4
+  class Notice < Airbrake::Base
5 5
     PER_PAGE = 30
6 6
     PARALLEL_WORKERS = 10
7 7
 
@@ -11,7 +11,7 @@ def self.find(id, error_id, options={})
11 11
       hash = fetch(find_path(id, error_id), options)
12 12
 
13 13
       if hash.errors
14  
-        raise HoptoadError.new(results.errors.error)
  14
+        raise AirbrakeError.new(results.errors.error)
15 15
       end
16 16
 
17 17
       hash.notice
@@ -27,7 +27,7 @@ def self.find_all_by_error_id(error_id, notice_options = {})
27 27
         options[:page] = page
28 28
         hash = fetch(all_path(error_id), options)
29 29
         if hash.errors
30  
-          raise HoptoadError.new(results.errors.error)
  30
+          raise AirbrakeError.new(results.errors.error)
31 31
         end
32 32
 
33 33
         batch = Parallel.map(hash.notices, :in_threads => PARALLEL_WORKERS) do |notice_stub|
@@ -47,7 +47,7 @@ def self.find_by_error_id(error_id, options={ 'page' => 1})
47 47
 
48 48
       hash = fetch(all_path(error_id), options)
49 49
       if hash.errors
50  
-        raise HoptoadError.new(results.errors.error)
  50
+        raise AirbrakeError.new(results.errors.error)
51 51
       end
52 52
 
53 53
       hash.notices
6  lib/hoptoad-api/project.rb → lib/airbrake-api/project.rb
... ...
@@ -1,5 +1,5 @@
1  
-module Hoptoad
2  
-  class Project < Hoptoad::Base
  1
+module Airbrake
  2
+  class Project < Airbrake::Base
3 3
 
4 4
     def self.find(*args)
5 5
       setup
@@ -7,7 +7,7 @@ def self.find(*args)
7 7
 
8 8
       results = fetch(collection_path, options)
9 9
 
10  
-      raise HoptoadError.new(results.errors.error) if results.errors
  10
+      raise AirbrakeError.new(results.errors.error) if results.errors
11 11
       results.projects.project
12 12
     end
13 13
 
2  lib/hoptoad-api/version.rb → lib/airbrake-api/version.rb
... ...
@@ -1,3 +1,3 @@
1  
-module Hoptoad
  1
+module Airbrake
2 2
   VERSION = '2.5.0'
3 3
 end
41  lib/hoptoad-api/client.rb
... ...
@@ -1,41 +0,0 @@
1  
-module Hoptoad
2  
-  class Base
3  
-    include HTTParty
4  
-    format :xml
5  
-
6  
-    private
7  
-
8  
-    def self.setup
9  
-      base_uri Hoptoad.account_path
10  
-      default_params :auth_token => Hoptoad.auth_token
11  
-
12  
-      check_configuration
13  
-    end
14  
-
15  
-    def self.check_configuration
16  
-      raise HoptoadError.new('API Token cannot be nil') if default_options.nil? || default_options[:default_params].nil? || !default_options[:default_params].has_key?(:auth_token)
17  
-      raise HoptoadError.new('Account cannot be nil') unless default_options.has_key?(:base_uri)
18  
-    end
19  
-
20  
-    def self.fetch(path, options)
21  
-      response = get(path, { :query => options })
22  
-      if response.code == 403
23  
-        raise HoptoadError.new('SSL should be enabled - use Hoptoad.secure = true in configuration')
24  
-      end
25  
-
26  
-      Hashie::Mash.new(response)
27  
-    end
28  
-
29  
-  end
30  
-end
31  
-
32  
-# hoptoad sometimes returns broken xml with strange utmz stuff
33  
-# so we remove this
34  
-require 'httparty/parser'
35  
-class HTTParty::Parser
36  
-  alias utmz_unaware_xml xml
37  
-  def xml
38  
-    body.gsub!(/<__utmz>.*?<\/__utmz>/m,'')
39  
-    utmz_unaware_xml
40  
-  end
41  
-end
24  spec/hoptoad_api/error_spec.rb → spec/airbrake_api/error_spec.rb
... ...
@@ -1,51 +1,51 @@
1 1
 require 'spec_helper'
2 2
 
3  
-describe Hoptoad::Error do
  3
+describe Airbrake::Error do
4 4
   before(:all) do
5  
-    Hoptoad.account = 'myapp'
6  
-    Hoptoad.auth_token = 'abcdefg123456'
7  
-    Hoptoad.secure = false
  5
+    Airbrake.account = 'myapp'
  6
+    Airbrake.auth_token = 'abcdefg123456'
  7
+    Airbrake.secure = false
8 8
   end
9 9
 
10 10
   it "should have correct collection path" do
11  
-    Hoptoad::Error.collection_path.should == "/errors.xml"
  11
+    Airbrake::Error.collection_path.should == "/errors.xml"
12 12
   end
13 13
 
14 14
   it "should generate correct error path given an id" do
15  
-    Hoptoad::Error.error_path(1234).should == "/errors/1234.xml"
  15
+    Airbrake::Error.error_path(1234).should == "/errors/1234.xml"
16 16
   end
17 17
 
18 18
   describe '.find' do
19 19
     it "should find a page of the 30 most recent errors" do
20  
-      errors = Hoptoad::Error.find(:all)
  20
+      errors = Airbrake::Error.find(:all)
21 21
       ordered = errors.sort_by(&:most_recent_notice_at).reverse
22 22
       ordered.should == errors
23 23
       errors.size.should == 30
24 24
     end
25 25
 
26 26
     it "should paginate errors" do
27  
-      errors = Hoptoad::Error.find(:all, :page => 2)
  27
+      errors = Airbrake::Error.find(:all, :page => 2)
28 28
       ordered = errors.sort_by(&:most_recent_notice_at).reverse
29 29
       ordered.should == errors
30 30
       errors.size.should == 2
31 31
     end
32 32
 
33 33
     it "should find an individual error" do
34  
-      error = Hoptoad::Error.find(1696170)
  34
+      error = Airbrake::Error.find(1696170)
35 35
       error.action.should == 'index'
36 36
       error.id.should == 1696170
37 37
     end
38 38
 
39 39
     it "should raise an error when not passed an id" do
40 40
       lambda do
41  
-        Hoptoad::Error.find
42  
-      end.should raise_error(Hoptoad::HoptoadError)
  41
+        Airbrake::Error.find
  42
+      end.should raise_error(Airbrake::AirbrakeError)
43 43
     end
44 44
   end
45 45
 
46 46
   describe '.update' do
47 47
     it 'should update the status of an error' do
48  
-      error = Hoptoad::Error.update(1696170, :group => { :resolved => true})
  48
+      error = Airbrake::Error.update(1696170, :group => { :resolved => true})
49 49
       error.resolved.should be_true
50 50
     end
51 51
   end
20  spec/hoptoad_api/notice_spec.rb → spec/airbrake_api/notice_spec.rb
... ...
@@ -1,31 +1,31 @@
1 1
 require 'spec_helper'
2 2
 
3  
-describe Hoptoad::Notice do
  3
+describe Airbrake::Notice do
4 4
   before(:all) do
5  
-    Hoptoad.account = 'myapp'
6  
-    Hoptoad.auth_token = 'abcdefg123456'
7  
-    Hoptoad.secure = false
  5
+    Airbrake.account = 'myapp'
  6
+    Airbrake.auth_token = 'abcdefg123456'
  7
+    Airbrake.secure = false
8 8
   end
9 9
 
10 10
   it "should find error notices" do
11  
-    notices = Hoptoad::Notice.find_by_error_id(1696170)
  11
+    notices = Airbrake::Notice.find_by_error_id(1696170)
12 12
     notices.size.should == 30
13 13
     notices.first.id.should == 1234
14 14
   end
15 15
 
16 16
   it "should find all error notices" do
17  
-    notices = Hoptoad::Notice.find_all_by_error_id(1696170)
  17
+    notices = Airbrake::Notice.find_all_by_error_id(1696170)
18 18
     notices.size.should == 42
19 19
   end
20 20
 
21 21
   it "should find all error notices with a page limit" do
22  
-    notices = Hoptoad::Notice.find_all_by_error_id(1696171, :pages => 2)
  22
+    notices = Airbrake::Notice.find_all_by_error_id(1696171, :pages => 2)
23 23
     notices.size.should == 60
24 24
   end
25 25
 
26 26
   it "yields batches" do
27 27
     batches = []
28  
-    notices = Hoptoad::Notice.find_all_by_error_id(1696171, :pages => 2) do |batch|
  28
+    notices = Airbrake::Notice.find_all_by_error_id(1696171, :pages => 2) do |batch|
29 29
       batches << batch
30 30
     end
31 31
     notices.size.should == 60
@@ -33,10 +33,10 @@
33 33
   end
34 34
 
35 35
   it "should find individual notices" do
36  
-    Hoptoad::Notice.find(1234, 1696170).should_not == nil
  36
+    Airbrake::Notice.find(1234, 1696170).should_not == nil
37 37
   end
38 38
 
39 39
   it "should find a broken notices" do
40  
-    Hoptoad::Notice.find(666, 1696170).should_not == nil
  40
+    Airbrake::Notice.find(666, 1696170).should_not == nil
41 41
   end
42 42
 end
21  spec/airbrake_api/project_spec.rb
... ...
@@ -0,0 +1,21 @@
  1
+require 'spec_helper'
  2
+
  3
+describe Airbrake::Project do
  4
+  before(:all) do
  5
+    Airbrake.account = 'myapp'
  6
+    Airbrake.auth_token = 'abcdefg123456'
  7
+    Airbrake.secure = false
  8
+  end
  9
+
  10
+  it "should have correct projects path" do
  11
+    Airbrake::Project.collection_path.should == "/data_api/v1/projects.xml"
  12
+  end
  13
+
  14
+  it "should find projects" do
  15
+    projects = Airbrake::Project.find(:all)
  16
+    projects.size.should == 4
  17
+    projects.first.id.should == '1'
  18
+    projects.first.name.should == 'Venkman'
  19
+  end
  20
+
  21
+end
59  spec/airbrake_api_spec.rb
... ...
@@ -0,0 +1,59 @@
  1
+require 'spec_helper'
  2
+
  3
+describe Airbrake do
  4
+
  5
+  context "configuration" do
  6
+    before(:each) do
  7
+      Airbrake.account = nil
  8
+      Airbrake.auth_token = nil
  9
+      Airbrake.secure = false
  10
+    end
  11
+
  12
+    it "should allow setting of the account" do
  13
+      Airbrake.account = 'myapp'
  14
+      Airbrake.account.should == 'myapp'
  15
+      Airbrake.account_path.should == 'http://myapp.airbrakeapp.com'
  16
+    end
  17
+
  18
+    it "should allow setting of the auth token" do
  19
+      Airbrake.auth_token = '123456'
  20
+      Airbrake.auth_token.should == '123456'
  21
+    end
  22
+
  23
+    it "should allow setting of ssl protocol" do
  24
+      Airbrake.secure = true
  25
+      Airbrake.protocol.should == 'https'
  26
+    end
  27
+
  28
+    it "should default to standard http" do
  29
+      Airbrake.protocol.should == 'http'
  30
+    end
  31
+
  32
+    it "should should implement #configure" do
  33
+      Airbrake.configure(:account => 'anapp', :auth_token => 'abcdefg', :secure => true)
  34
+      Airbrake.protocol.should == 'https'
  35
+      Airbrake.auth_token.should == 'abcdefg'
  36
+      Airbrake.account.should == 'anapp'
  37
+      Airbrake.account_path.should == 'https://anapp.airbrakeapp.com'
  38
+    end
  39
+  end
  40
+
  41
+  context "when using SSL" do
  42
+    before(:each) do
  43
+      Airbrake.configure(:account => 'sslapp', :auth_token => 'abcdefg123456', :secure => true)
  44
+    end
  45
+
  46
+    it "should find an error if account is SSL enabled" do
  47
+      error = Airbrake::Error.find(1696170)
  48
+      error.id.should == 1696170
  49
+    end
  50
+
  51
+    it "should raise an exception if trying to access SSL enabled account with unsecure connection" do
  52
+      Airbrake.secure = false
  53
+      lambda do
  54
+        Airbrake::Error.find(1696170)
  55
+      end.should raise_error(Airbrake::AirbrakeError)
  56
+    end
  57
+  end
  58
+
  59
+end
21  spec/hoptoad_api/project_spec.rb
... ...
@@ -1,21 +0,0 @@
1  
-require 'spec_helper'
2  
-
3  
-describe Hoptoad::Project do
4  
-  before(:all) do
5  
-    Hoptoad.account = 'myapp'
6  
-    Hoptoad.auth_token = 'abcdefg123456'
7  
-    Hoptoad.secure = false
8  
-  end
9  
-
10  
-  it "should have correct projects path" do
11  
-    Hoptoad::Project.collection_path.should == "/data_api/v1/projects.xml"
12  
-  end
13  
-
14  
-  it "should find projects" do
15  
-    projects = Hoptoad::Project.find(:all)
16  
-    projects.size.should == 4
17  
-    projects.first.id.should == '1'
18  
-    projects.first.name.should == 'Venkman'
19  
-  end
20  
-
21  
-end
59  spec/hoptoad_api_spec.rb
... ...
@@ -1,59 +0,0 @@
1  
-require 'spec_helper'
2  
-
3  
-describe Hoptoad do
4  
-
5  
-  context "configuration" do
6  
-    before(:each) do
7  
-      Hoptoad.account = nil
8  
-      Hoptoad.auth_token = nil
9  
-      Hoptoad.secure = false
10  
-    end
11  
-
12  
-    it "should allow setting of the account" do
13  
-      Hoptoad.account = 'myapp'
14  
-      Hoptoad.account.should == 'myapp'
15  
-      Hoptoad.account_path.should == 'http://myapp.hoptoadapp.com'
16  
-    end
17  
-
18  
-    it "should allow setting of the auth token" do
19  
-      Hoptoad.auth_token = '123456'
20  
-      Hoptoad.auth_token.should == '123456'
21  
-    end
22  
-
23  
-    it "should allow setting of ssl protocol" do
24  
-      Hoptoad.secure = true
25  
-      Hoptoad.protocol.should == 'https'
26  
-    end
27  
-
28  
-    it "should default to standard http" do
29  
-      Hoptoad.protocol.should == 'http'
30  
-    end
31  
-
32  
-    it "should should implement #configure" do
33  
-      Hoptoad.configure(:account => 'anapp', :auth_token => 'abcdefg', :secure => true)
34  
-      Hoptoad.protocol.should == 'https'
35  
-      Hoptoad.auth_token.should == 'abcdefg'
36  
-      Hoptoad.account.should == 'anapp'
37  
-      Hoptoad.account_path.should == 'https://anapp.hoptoadapp.com'
38  
-    end
39  
-  end
40  
-
41  
-  context "when using SSL" do
42  
-    before(:each) do
43  
-      Hoptoad.configure(:account => 'sslapp', :auth_token => 'abcdefg123456', :secure => true)
44  
-    end
45  
-
46  
-    it "should find an error if account is SSL enabled" do
47  
-      error = Hoptoad::Error.find(1696170)
48  
-      error.id.should == 1696170
49  
-    end
50  
-
51  
-    it "should raise an exception if trying to access SSL enabled account with unsecure connection" do
52  
-      Hoptoad.secure = false
53  
-      lambda do
54  
-        Hoptoad::Error.find(1696170)
55  
-      end.should raise_error(Hoptoad::HoptoadError)
56  
-    end
57  
-  end
58  
-
59  
-end
40  spec/spec_helper.rb
... ...
@@ -1,10 +1,10 @@
1 1
 require 'simplecov'
2 2
 SimpleCov.start do
3  
-  add_group 'Hoptoad API', 'lib/hoptoad-api'
  3
+  add_group 'Airbrake API', 'lib/airbrake-api'
4 4
   add_group 'Specs', 'spec'
5 5
 end
6 6
 
7  
-require File.expand_path('../../lib/hoptoad-api', __FILE__)
  7
+require File.expand_path('../../lib/airbrake-api', __FILE__)
8 8
 
9 9
 require 'rspec'
10 10
 require 'fakeweb'
@@ -18,28 +18,28 @@ def fixture_request(verb, url, file)
18 18
 end
19 19
 
20 20
 # errors
21  
-fixture_request :get, 'http://myapp.hoptoadapp.com/errors.xml?auth_token=abcdefg123456', 'errors.xml'
22  
-fixture_request :get, "http://myapp.hoptoadapp.com/errors.xml?auth_token=abcdefg123456&page=2", 'paginated_errors.xml'
23  
-fixture_request :get, "http://myapp.hoptoadapp.com/errors/1696170.xml?auth_token=abcdefg123456", 'individual_error.xml'
24  
-fixture_request :put, 'http://myapp.hoptoadapp.com/errors/1696170.xml?auth_token=abcdefg123456&group[resolved]=true', 'update_error.xml'
  21
+fixture_request :get, 'http://myapp.airbrakeapp.com/errors.xml?auth_token=abcdefg123456', 'errors.xml'
  22
+fixture_request :get, "http://myapp.airbrakeapp.com/errors.xml?auth_token=abcdefg123456&page=2", 'paginated_errors.xml'
  23
+fixture_request :get, "http://myapp.airbrakeapp.com/errors/1696170.xml?auth_token=abcdefg123456", 'individual_error.xml'
  24
+fixture_request :put, 'http://myapp.airbrakeapp.com/errors/1696170.xml?auth_token=abcdefg123456&group[resolved]=true', 'update_error.xml'
25 25
 
26 26
 # notices
27  
-fixture_request :get, "http://myapp.hoptoadapp.com/errors/1696170/notices.xml?auth_token=abcdefg123456", 'notices.xml'
28  
-fixture_request :get, "http://myapp.hoptoadapp.com/errors/1696170/notices.xml?auth_token=abcdefg123456&page=1", 'notices.xml'
29  
-fixture_request :get, "http://myapp.hoptoadapp.com/errors/1696170/notices.xml?page=1&auth_token=abcdefg123456", 'notices.xml'
30  
-fixture_request :get, "http://myapp.hoptoadapp.com/errors/1696170/notices.xml?auth_token=abcdefg123456&page=2", 'paginated_notices.xml'
31  
-fixture_request :get, "http://myapp.hoptoadapp.com/errors/1696170/notices/1234.xml?auth_token=abcdefg123456", 'individual_notice.xml'
32  
-fixture_request :get, "http://myapp.hoptoadapp.com/errors/1696170/notices/666.xml?auth_token=abcdefg123456", 'broken_notice.xml'
33  
-fixture_request :get, "http://myapp.hoptoadapp.com/errors/1696171/notices.xml?auth_token=abcdefg123456", 'notices.xml'
34  
-fixture_request :get, "http://myapp.hoptoadapp.com/errors/1696171/notices.xml?auth_token=abcdefg123456&page=1", 'notices.xml'
35  
-fixture_request :get, "http://myapp.hoptoadapp.com/errors/1696171/notices.xml?auth_token=abcdefg123456&page=2", 'notices.xml'
36  
-fixture_request :get, "http://myapp.hoptoadapp.com/errors/1696171/notices.xml?auth_token=abcdefg123456&page=3", 'paginated_notices.xml'
37  
-fixture_request :get, "http://myapp.hoptoadapp.com/errors/1696171/notices/1234.xml?auth_token=abcdefg123456", 'notices.xml'
  27
+fixture_request :get, "http://myapp.airbrakeapp.com/errors/1696170/notices.xml?auth_token=abcdefg123456", 'notices.xml'
  28
+fixture_request :get, "http://myapp.airbrakeapp.com/errors/1696170/notices.xml?auth_token=abcdefg123456&page=1", 'notices.xml'
  29
+fixture_request :get, "http://myapp.airbrakeapp.com/errors/1696170/notices.xml?page=1&auth_token=abcdefg123456", 'notices.xml'
  30
+fixture_request :get, "http://myapp.airbrakeapp.com/errors/1696170/notices.xml?auth_token=abcdefg123456&page=2", 'paginated_notices.xml'
  31
+fixture_request :get, "http://myapp.airbrakeapp.com/errors/1696170/notices/1234.xml?auth_token=abcdefg123456", 'individual_notice.xml'
  32
+fixture_request :get, "http://myapp.airbrakeapp.com/errors/1696170/notices/666.xml?auth_token=abcdefg123456", 'broken_notice.xml'
  33
+fixture_request :get, "http://myapp.airbrakeapp.com/errors/1696171/notices.xml?auth_token=abcdefg123456", 'notices.xml'
  34
+fixture_request :get, "http://myapp.airbrakeapp.com/errors/1696171/notices.xml?auth_token=abcdefg123456&page=1", 'notices.xml'
  35
+fixture_request :get, "http://myapp.airbrakeapp.com/errors/1696171/notices.xml?auth_token=abcdefg123456&page=2", 'notices.xml'
  36
+fixture_request :get, "http://myapp.airbrakeapp.com/errors/1696171/notices.xml?auth_token=abcdefg123456&page=3", 'paginated_notices.xml'
  37
+fixture_request :get, "http://myapp.airbrakeapp.com/errors/1696171/notices/1234.xml?auth_token=abcdefg123456", 'notices.xml'
38 38
 
39 39
 
40 40
 # projects
41  
-fixture_request :get, "http://myapp.hoptoadapp.com/data_api/v1/projects.xml?auth_token=abcdefg123456", 'projects.xml'
  41
+fixture_request :get, "http://myapp.airbrakeapp.com/data_api/v1/projects.xml?auth_token=abcdefg123456", 'projects.xml'
42 42
 
43 43
 # ssl responses
44  
-fixture_request :get, "https://sslapp.hoptoadapp.com/errors/1696170.xml?auth_token=abcdefg123456", 'individual_error.xml'
45  
-FakeWeb.register_uri(:get, "http://sslapp.hoptoadapp.com/errors/1696170.xml?auth_token=abcdefg123456", DEFAULTS.merge(:body => " ", :status => ["403", "Forbidden"]))
  44
+fixture_request :get, "https://sslapp.airbrakeapp.com/errors/1696170.xml?auth_token=abcdefg123456", 'individual_error.xml'
  45
+FakeWeb.register_uri(:get, "http://sslapp.airbrakeapp.com/errors/1696170.xml?auth_token=abcdefg123456", DEFAULTS.merge(:body => " ", :status => ["403", "Forbidden"]))

0 notes on commit e9abeef

Please sign in to comment.
Something went wrong with that request. Please try again.