class SVBClient::WireHandler
Public Class Methods
new(client)
click to toggle source
# File lib/svbclient.rb, line 256 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 271 def all find end
create(wire_data)
click to toggle source
# File lib/svbclient.rb, line 261 def create(wire_data) response = @client.post('/v1/wire', wire_data) SVBClient::Wire.new(@client, JSON.parse(response.body)["data"]["id"]) end
find(status: nil, effective_date_start: nil, effective_date_end: nil)
click to toggle source
# File lib/svbclient.rb, line 275 def find(status: nil, effective_date_start: nil, effective_date_end: nil) query = [] query << "filter%5Bstatus%5D=#{status}" unless status.nil? query << "filter%5Beffective_date_start%5D=#{effective_date_start}" unless effective_date_start.nil? query << "filter%5Beffective_date_end%5D=#{effective_date_end}" unless effective_date_end.nil? response = @client.get("/v1/wire", query.join('&')) list = JSON.parse(response.body)["data"] list.map do |wire| SVBClient::Wire.new(@client, wire["id"]) end end
get(id)
click to toggle source
# File lib/svbclient.rb, line 266 def get(id) @client.get("/v1/wire/#{id}") SVBClient::Wire.new(@client, id) end