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

- old
+ new

@@ -18,21 +18,27 @@ end end def details(id, opts={}) response = Moip::Assinaturas::Client.details_invoice(id, 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, invoice: hash } + when 404 + return { + success: false, + message: 'not found' + } else raise(WebServerResponseError, "Ocorreu um erro no retorno do webservice") end end end end -end \ No newline at end of file +end