lib/lumberg/format_whm.rb in lumberg-2.0.0.pre4 vs lib/lumberg/format_whm.rb in lumberg-2.0.0.pre5

- old
+ new

@@ -1,8 +1,8 @@ module Lumberg class FormatWhm < Faraday::Response::Middleware - + def initialize(env, *args, &block) @type = args[0] @key = args[1] @boolean_params = args[2] super(env) @@ -11,15 +11,15 @@ def on_complete(env) env[:body] = format_response(env[:body]) end def response_values(env) - {:status => env[:status], :headers => env[:response_headers], :body => env[:body]} + {status: env[:status], headers: env[:response_headers], body: env[:body]} end - + private - + def format_response(response) success, message, params = false, nil, {} case @type || response_type(response) when :action @@ -31,16 +31,16 @@ when :error message = response['error'] when :unknown message = "Unknown error occurred #{response.inspect}" end - + params = Whm::symbolize_keys(params) params = Whm::to_bool(params, @boolean_params) - {:success => success, :message => message, :params => params} + {success: success, message: message, params: params} end - + def response_type(response) if !response.respond_to?(:has_key?) :unknown elsif response.has_key?('error') :error