Class: SlidePay::ACH::Balance

Inherits:
Object
  • Object
show all
Defined in:
lib/slidepay/ach/balance.rb

Class Method Summary collapse

Class Method Details

.retrieve(location_id, options = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/slidepay/ach/balance.rb', line 7

def retrieve(location_id, options={})
  token = options[:token]
  api_key = options[:api_key]
  endpoint = options[:endpoint]

  path = "settlement/balance/#{location_id}"

  response = SlidePay.post(path: path, data: {}.to_json, token: token, api_key: api_key, endpoint: endpoint)

  if response.was_successful?
    return response.data
  else
    error_text = response.error_text unless response.error == false

    if error_text != nil
      raise "Could not get settlement balance: #{error_text}"
    else
      raise "Could not get settlement balance."
    end
  end
end