Sha256: 6b1d43147898c46a3afb2f1479914a7775a344a92165019cc6277a41087fe1fa

Contents?: true

Size: 908 Bytes

Versions: 1

Compression:

Stored size: 908 Bytes

Contents

module Moip::Assinaturas
  class Payment

    class << self

      def list(invoice_id)
        response = Moip::Assinaturas::Client.list_payments(invoice_id)

        case response.code
        when 200
          hash = JSON.load(response.body).with_indifferent_access
          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)

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

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
moip-assinaturas-0.0.2 lib/moip-assinaturas/payment.rb