Class: PinPayment::Balance

Inherits:
Base
  • Object
show all
Defined in:
lib/pin_payment/balance.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Balance

Returns a new instance of Balance.



7
8
9
10
# File 'lib/pin_payment/balance.rb', line 7

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

Instance Attribute Details

#availableObject

Returns the value of attribute available.



4
5
6
# File 'lib/pin_payment/balance.rb', line 4

def available
  @available
end

#pendingObject

Returns the value of attribute pending.



4
5
6
# File 'lib/pin_payment/balance.rb', line 4

def pending
  @pending
end

Class Method Details

.current_balancePinPayment::Balance

Uses the pin API to fetch your accounts balance.

Returns:



15
16
17
18
# File 'lib/pin_payment/balance.rb', line 15

def self.current_balance
  response = get(URI.parse(PinPayment.api_url).tap{|uri| uri.path = '/1/balance' }, {})
  new(response)
end