lib/toadhopper.rb in toadhopper-0.9.8 vs lib/toadhopper.rb in toadhopper-1.0.0
- old
+ new
@@ -1,12 +1,12 @@
require 'net/http'
require 'erb'
require 'ostruct'
# Posts errors to the Hoptoad API
-class ToadHopper
- VERSION = "0.9.8"
+class Toadhopper
+ VERSION = "1.0.0"
# Hoptoad API response
class Response < Struct.new(:status, :body, :errors); end
attr_reader :api_key
@@ -32,11 +32,11 @@
# @param [Hash] options
# @option options [String] url The url for the request, required to post but not useful in a console environment
# @option options [String] component Normally this is your Controller name in an MVC framework
# @option options [String] action Normally the action for your request in an MVC framework
# @option options [Hash] params A hash of the request's parameters
- # @option options [String] notifier_name Say you're a different notifier than ToadHopper
+ # @option options [String] notifier_name Say you're a different notifier than Toadhopper
# @option options [String] notifier_version Specify the version of your custom notifier
# @option options [String] notifier_url Specify the project URL of your custom notifier
# @option options [Hash] session A hash of the user session in a web request
# @option options [String] framework_env The framework environment your app is running under
# @option options [Array] backtrace Normally not needed, parsed automatically from the provided exception parameter
@@ -44,17 +44,17 @@
# @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('apikey').post! error,
+ # 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'
+ options[:notifier_name] ||= 'Toadhopper'
post_document(document_for(error, options), {'X-Hoptoad-Client-Name' => options[:notifier_name]})
end
# @private
def post_document(document, headers={})
@@ -138,11 +138,11 @@
def serializable?(value)
[Fixnum, Array, String, Hash, Bignum].any? {|c| value.is_a?(c)}
end
end
-# Convenience method for creating ToadHoppers
+# Convenience method for creating Toadhoppers
#
-# @return [ToadHopper]
-def ToadHopper(api_key)
- ToadHopper.new(api_key)
+# @return [Toadhopper]
+def Toadhopper(api_key)
+ Toadhopper.new(api_key)
end