class SVBClient::ACHHandler

Public Class Methods

new(client) click to toggle source
# File lib/svbclient.rb, line 169
def initialize(client)
  raise 'provide an API client' if client.nil?
  @client = client
end

Public Instance Methods

all() click to toggle source
# File lib/svbclient.rb, line 184
def all
  find
end
create(ach_data) click to toggle source
# File lib/svbclient.rb, line 174
def create(ach_data)
  response = @client.post('/v1/ach', ach_data)
  SVBClient::ACH.new(@client, JSON.parse(response.body)["data"]["id"])
end
find(status: nil, effective_date: nil) click to toggle source
# File lib/svbclient.rb, line 188
def find(status: nil, effective_date: nil)
  query = []
  query << "filter%5Bstatus%5D=#{status}" unless status.nil?
  query << "filter%5Beffective_date%5D=#{effective_date}" unless effective_date.nil?
  response = @client.get("/v1/ach", query.join('&'))
  list = JSON.parse(response.body)["data"]
  list.map do |ach|
    SVBClient::ACH.new(@client, ach["id"])
  end
end
get(id) click to toggle source
# File lib/svbclient.rb, line 179
def get(id)
  @client.get("/v1/ach/#{id}")
  SVBClient::ACH.new(@client, id)
end