lib/toadhopper.rb in toadhopper-1.2 vs lib/toadhopper.rb in toadhopper-1.3

- old
+ new

@@ -2,11 +2,11 @@ require 'erb' require 'ostruct' # Posts errors to the Hoptoad API class Toadhopper - VERSION = "1.2" + VERSION = "1.3" FILTER_REPLACEMENT = "[FILTERED]" # Hoptoad API response class Response < Struct.new(:status, :body, :errors); end @@ -54,11 +54,11 @@ options[:notifier_name] ||= 'Toadhopper' post_document(document_for(error, options), {'X-Hoptoad-Client-Name' => options[:notifier_name]}) end # Posts a deployment notification - # + # # @param [Hash] options # @option options [String] framework_env The framework environment your app is running under, defaults to development # @option options [String] scm_repository The repository URL # @option options [String] scm_revision The current repository revision # @option options [String] username Your name, defaults to `whoami` @@ -119,11 +119,11 @@ rescue TimeoutError => e Response.new(500, '', ['Timeout error']) end end end - + def parse_response(response) Response.new(response.code.to_i, response.body, response.body.scan(%r{<error>(.+)<\/error>}).flatten) end @@ -156,24 +156,20 @@ File.read(::File.join(::File.dirname(__FILE__), 'notice.erb')) end def clean(hash) hash.inject({}) do |acc, (k, v)| - acc[k] = (v.is_a?(Hash) ? clean(v) : filtered_value(k,v)) if serializable?(v) + acc[k] = (v.is_a?(Hash) ? clean(v) : filtered_value(k,v)) acc end end def filtered_value(key, value) if filters.any? {|f| key.to_s =~ Regexp.new(f)} FILTER_REPLACEMENT else - value + value.to_s end - end - - def serializable?(value) - [Fixnum, Array, String, Hash, Bignum].any? {|c| value.is_a?(c)} end end # Convenience method for creating Toadhoppers #