lib/moip-assinaturas/plan.rb in moip-assinaturas-0.3.0 vs lib/moip-assinaturas/plan.rb in moip-assinaturas-0.4.0

- old
+ new

@@ -39,18 +39,24 @@ end end def details(code, opts={}) response = Moip::Assinaturas::Client.details_plan(code, opts) - hash = JSON.load(response.body).with_indifferent_access + hash = JSON.load(response.body) + hash = hash.with_indifferent_access if hash case response.code when 200 return { success: true, plan: hash } + when 404 + return { + success: false, + message: 'not found' + } else raise(WebServerResponseError, "Ocorreu um erro no retorno do webservice") end end @@ -69,6 +75,6 @@ end end end end -end \ No newline at end of file +end