lib/toadhopper.rb in toadhopper-0.9.2 vs lib/toadhopper.rb in toadhopper-0.9.4

- old
+ new

@@ -3,11 +3,11 @@ require 'haml/engine' require 'nokogiri' # Posts errors to the Hoptoad API class ToadHopper - VERSION = "0.9.2" + VERSION = "0.9.4" # Hoptoad API response class Response < Struct.new(:status, :body, :errors); end attr_reader :api_key @@ -45,13 +45,13 @@ # @option options [String] project_root The root directory of your app # # @param [Hash] http_headers extra HTTP headers to be sent in the post to the API # # @example - # Toadhopper.new('apikey').post! error, - # {:action => 'show', :controller => 'Users'}, - # {'X-Hoptoad-Client-Name' => 'My Awesome Notifier'} + # ToadHopper('apikey').post! error, + # {:action => 'show', :controller => 'Users'}, + # {'X-Hoptoad-Client-Name' => 'My Awesome Notifier'} # # @return [Response] def post!(error, options={}, http_headers={}) options[:notifier_name] ||= 'ToadHopper' post_document(document_for(error, options), {'X-Hoptoad-Client-Name' => options[:notifier_name]}) @@ -127,5 +127,12 @@ # @private def serializable?(value) [Fixnum, Array, String, Hash, Bignum].any? {|c| value.is_a?(c)} end end + +# Convenience method for creating ToadHoppers +# +# @return [ToadHopper] +def ToadHopper(api_key) + ToadHopper.new(api_key) +end \ No newline at end of file