Sha256: f3a4cb72d79e0032bb301934db3a3485b796a1e33ee8e72726c46a815a65fccc

Contents?: true

Size: 912 Bytes

Versions: 5

Compression:

Stored size: 912 Bytes

Contents

module Moip::Assinaturas
  class Payment

    class << self

      def list(invoice_id)
        response = Moip::Assinaturas::Client.list_payments(invoice_id)
        hash     = JSON.load(response.body).with_indifferent_access

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

      def details(id)
        response = Moip::Assinaturas::Client.details_payment(id)
        hash     = JSON.load(response.body).with_indifferent_access

        case response.code
        when 200
          return {
            success:  true,
            payment:  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.1.3 lib/moip-assinaturas/payment.rb
moip-assinaturas-0.1.2 lib/moip-assinaturas/payment.rb
moip-assinaturas-0.1.1 lib/moip-assinaturas/payment.rb
moip-assinaturas-0.1.0 lib/moip-assinaturas/payment.rb
moip-assinaturas-0.0.3 lib/moip-assinaturas/payment.rb