lib/bamboozled/api/base.rb in bamboozled-0.0.6 vs lib/bamboozled/api/base.rb in bamboozled-0.0.7

- old
+ new

@@ -1,6 +1,7 @@ require 'json' +require 'active_support/core_ext/hash/indifferent_access' module Bamboozled module API class Base attr_reader :subdomain, :api_key @@ -32,10 +33,10 @@ params[:response] = response.inspect.to_s case response.code when 200..201 begin - JSON.parse(response) + JSON.parse(response).with_indifferent_access rescue MultiXml.parse(response, symbolize_keys: true) end when 400 raise Bamboozled::BadRequest.new(response, params, 'The request was invalid or could not be understood by the server. Resubmitting the request will likely result in the same error.')