Sha256: 0b85c0ebe0b5029164bfae516777d4cfb163501af12e8968ddfb145a02c1cbc8

Contents?: true

Size: 586 Bytes

Versions: 4

Compression:

Stored size: 586 Bytes

Contents

module PinPayment
  class Balance < Base

    attr_accessor :available,  :pending
    protected     :available=, :pending=

    def initialize options = {}
      self.available = options["available"][0]
      self.pending = options["pending"][0]
    end

    # Uses the pin API to fetch your accounts balance.
    #
    # @return [PinPayment::Balance]
    def self.current_balance
      response = get(URI.parse(PinPayment.api_url).tap{|uri| uri.path = '/1/balance' }, {})
      new(response)
    end

  private

    def self.attributes
      [:available, :pending]
    end


  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pin_payment-0.5.2 lib/pin_payment/balance.rb
pin_payment-0.5.1 lib/pin_payment/balance.rb
pin_payment-0.5.0 lib/pin_payment/balance.rb
pin_payment-0.4.0 lib/pin_payment/balance.rb