Sha256: c23f2bf2fed33b8b0671d25a6b8991cc19603ecf610814dfe2e4be803dc6bd10

Contents?: true

Size: 956 Bytes

Versions: 5

Compression:

Stored size: 956 Bytes

Contents

module Moip::Assinaturas
  class Invoice

    class << self

      def list(subscription_code, opts={})
        response = Moip::Assinaturas::Client.list_invoices(subscription_code, opts)
        hash     = JSON.load(response.body).with_indifferent_access

        case response.code
        when 200
          return {
            success:  true,
            invoices: hash[:invoices]
          }
        else
          raise(WebServerResponseError, "Ocorreu um erro no retorno do webservice")
        end
      end

      def details(id, opts={})
        response = Moip::Assinaturas::Client.details_invoice(id, opts)
        hash     = JSON.load(response.body).with_indifferent_access

        case response.code
        when 200
          return {
            success:  true,
            invoice:  hash
          }
        else
          raise(WebServerResponseError, "Ocorreu um erro no retorno do webservice")
        end
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
moip-assinaturas-0.3.0 lib/moip-assinaturas/invoice.rb
moip-assinaturas-0.2.3 lib/moip-assinaturas/invoice.rb
moip-assinaturas-0.2.2 lib/moip-assinaturas/invoice.rb
moip-assinaturas-0.2.1 lib/moip-assinaturas/invoice.rb
moip-assinaturas-0.2.0 lib/moip-assinaturas/invoice.rb