class SVBClient::BookTransferHandler

Public Class Methods

new(client) click to toggle source
# File lib/svbclient.rb, line 216
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 231
def all
  response = @client.get("/v1/book")
  list = JSON.parse(response.body)["data"]
  list.map do |transfer|
    SVBClient::BookTransfer.new(@client, transfer["id"])
  end
end
create(transfer_data) click to toggle source
# File lib/svbclient.rb, line 221
def create(transfer_data)
  response = @client.post('/v1/book', transfer_data)
  SVBClient::BookTransfer.new(@client, JSON.parse(response.body)["data"]["id"])
end
get(id) click to toggle source
# File lib/svbclient.rb, line 226
def get(id)
  @client.get("/v1/book/#{id}")
  SVBClient::BookTransfer.new(@client, id)
end