def self.get_cartridges_list(libra_server, net_http, cart_type="standalone", print_result=nil)
puts "Obtaining list of cartridges (please excuse the delay)..."
data = {'cart_type' => cart_type}
if @mydebug
data[:debug] = true
end
print_post_data(data)
json_data = generate_json(data)
url = URI.parse("https://#{libra_server}/broker/cartlist")
response = http_post(net_http, url, json_data, "none")
unless response.code == '200'
print_response_err(response)
return []
end
begin
json_resp = JSON.parse(response.body)
rescue JSON::ParserError
exit 1
end
update_server_api_v(json_resp)
if print_result
print_response_success(json_resp)
end
begin
carts = (JSON.parse(json_resp['data']))['carts']
rescue JSON::ParserError
exit 1
end
carts
end