Module: Hoptoad

Extended by:
Hoptoad
Included in:
Hoptoad
Defined in:
lib/hoptoad-api/client.rb,
lib/hoptoad-api.rb,
lib/hoptoad-api/version.rb

Overview

Ruby lib for working with the Hoptoad API’s XML interface. The first thing you need to set is the account name. This is the same as the web address for your account.

Hoptoad. = 'myaccount'

Then, you should set the authentication token.

Hoptoad.auth_token = 'abcdefg'

If no token or authentication info is given, a HoptoadError exception will be raised.

If your account uses ssl then turn it on:

Hoptoad.secure = true

For more details, check out the hoptoad docs at hoptoadapp.com/pages/api.

Find errors

Errors are paginated. You get 25 at a time.
errors = Hoptoad::Error.find(:all)

with pagination:
Hoptoad::Error.find(:all, :params => { :page => 2 })

find individual error by ID
Hoptoad::Error.find(44)

Find all notices by error_id

notices = Hoptoad::Notice.all(1234) # 1234 == error id

Find notice by id + error_id

notice = Hoptoad::Notice.find(12345, 1234) # 12345 == notice id, 1234 == error id

Defined Under Namespace

Classes: Base, Error, HoptoadError, Notice

Constant Summary collapse

VERSION =
'2.2.0'

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#accountObject

Returns the value of attribute account.



6
7
8
# File 'lib/hoptoad-api.rb', line 6

def 
  @account
end

#auth_tokenObject

Returns the value of attribute auth_token.



6
7
8
# File 'lib/hoptoad-api.rb', line 6

def auth_token
  @auth_token
end

#secureObject

Returns the value of attribute secure.



6
7
8
# File 'lib/hoptoad-api.rb', line 6

def secure
  @secure
end

Instance Method Details

#account_pathObject



16
17
18
# File 'lib/hoptoad-api.rb', line 16

def 
  "#{protocol}://#{@account}.hoptoadapp.com"
end

#configure(options = {}) ⇒ Object



10
11
12
13
14
# File 'lib/hoptoad-api.rb', line 10

def configure(options={})
  @account = options[:account] if options.has_key?(:account)
  @auth_token = options[:auth_token] if options.has_key?(:auth_token)
  @secure = options[:secure] if options.has_key?(:secure)
end

#protocolObject



20
21
22
# File 'lib/hoptoad-api.rb', line 20

def protocol
  secure ? "https" : "http"
end