Class: Toadhopper
- Inherits:
-
Object
- Object
- Toadhopper
- Defined in:
- lib/toadhopper.rb
Overview
Posts errors to the Hoptoad API
Defined Under Namespace
Classes: BacktraceLine, Response
Constant Summary collapse
- VERSION =
"1.1"
- FILTER_REPLACEMENT =
"[FILTERED]"
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
Instance Method Summary collapse
-
#deploy!(options = {}) ⇒ Response
Posts a deployment notification.
-
#filters=(*filters) ⇒ Object
Sets patterns to
[FILTER]
out sensitive data such as/password/
,/email/
and/credit_card_number/
. -
#initialize(api_key) ⇒ Toadhopper
constructor
A new instance of Toadhopper.
-
#post!(error, options = {}, http_headers = {}) ⇒ Response
Posts an exception to hoptoad.
Constructor Details
#initialize(api_key) ⇒ Toadhopper
Returns a new instance of Toadhopper.
15 16 17 |
# File 'lib/toadhopper.rb', line 15 def initialize(api_key) @api_key = api_key end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
13 14 15 |
# File 'lib/toadhopper.rb', line 13 def api_key @api_key end |
Instance Method Details
#deploy!(options = {}) ⇒ Response
Posts a deployment notification
64 65 66 67 68 69 70 71 72 73 |
# File 'lib/toadhopper.rb', line 64 def deploy!(={}) params = {} params['api_key'] = @api_key params['deploy[rails_env]'] = [:framework_env] || 'development' params['deploy[local_username]'] = [:username] || %x(whoami).strip params['deploy[scm_repository]'] = [:scm_repository] params['deploy[scm_revision]'] = [:scm_revision] response = Net::HTTP.post_form(URI.parse('http://hoptoadapp.com/deploys.txt'), params) parse_response(response) end |
#filters=(*filters) ⇒ Object
Sets patterns to [FILTER]
out sensitive data such as /password/
, /email/
and /credit_card_number/
20 21 22 |
# File 'lib/toadhopper.rb', line 20 def filters=(*filters) @filters = filters.flatten end |
#post!(error, options = {}, http_headers = {}) ⇒ Response
Posts an exception to hoptoad.
50 51 52 53 |
# File 'lib/toadhopper.rb', line 50 def post!(error, ={}, http_headers={}) [:notifier_name] ||= 'Toadhopper' post_document(document_for(error, ), {'X-Hoptoad-Client-Name' => [:notifier_name]}) end |