Sha256: 2aafec3477ab0d97b1946f98f69507f0395f4f74f2d531334510a21106a90741

Contents?: true

Size: 942 Bytes

Versions: 11

Compression:

Stored size: 942 Bytes

Contents

module Moip::Assinaturas
  class Payment

    class << self

      def list(invoice_id, opts={})
        response = Moip::Assinaturas::Client.list_payments(invoice_id, opts)
        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, opts={})
        response = Moip::Assinaturas::Client.details_payment(id, opts)
        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

11 entries across 11 versions & 1 rubygems

Version Path
moip-assinaturas-0.6.0 lib/moip-assinaturas/payment.rb
moip-assinaturas-0.5.1 lib/moip-assinaturas/payment.rb
moip-assinaturas-0.5.0 lib/moip-assinaturas/payment.rb
moip-assinaturas-0.4.2 lib/moip-assinaturas/payment.rb
moip-assinaturas-0.4.1 lib/moip-assinaturas/payment.rb
moip-assinaturas-0.4.0 lib/moip-assinaturas/payment.rb
moip-assinaturas-0.3.0 lib/moip-assinaturas/payment.rb
moip-assinaturas-0.2.3 lib/moip-assinaturas/payment.rb
moip-assinaturas-0.2.2 lib/moip-assinaturas/payment.rb
moip-assinaturas-0.2.1 lib/moip-assinaturas/payment.rb
moip-assinaturas-0.2.0 lib/moip-assinaturas/payment.rb