class Callsigns::RadioID
Public Class Methods
dmr(id, client)
click to toggle source
# File lib/callsigns/radioid.rb, line 2 def self.dmr(id, client) radioid_dmr_uri = "https://database.radioid.net/api/dmr/user/?id=" + id.to_s response = HTTParty.get(radioid_dmr_uri).parsed_response if response["count"].to_i == 1 client.puts "DMR ID " + id.to_s + " is found!\n\n" client.puts "DMR: " + response["results"][0]["id"].to_s client.puts "=========" client.puts "Callsign: " + response["results"][0]["callsign"].upcase client.puts "Name: " + response["results"][0]["fname"] + " " + + response["results"][0]["surname"] client.puts "City: " + response["results"][0]["city"] client.puts "State: " + response["results"][0]["state"] client.puts "Country: " + response["results"][0]["country"] if ["A", "K", "N", "W"].include? response["results"][0]["callsign"][0] client.puts "\nFor more information about this operator, enter [Lookup " + response["results"][0]["callsign"].upcase + "]" end else client.puts id.to_s + " is not a valid DMR ID." end end
nxdn(id, client)
click to toggle source
# File lib/callsigns/radioid.rb, line 24 def self.nxdn(id, client) radioid_nxdn_uri = "https://database.radioid.net/api/nxdn/user/?id=" + id.to_s response = HTTParty.get(radioid_nxdn_uri).parsed_response if response["count"].to_i > 0 && response["results"][0]["id"].to_s == id.to_s client.puts "NXDN ID " + id.to_s + " is found!\n\n" client.puts "NXDN: " + response["results"][0]["id"].to_s client.puts "=========" client.puts "Callsign: " + response["results"][0]["callsign"].upcase client.puts "Name: " + response["results"][0]["fname"] + " " + + response["results"][0]["surname"] client.puts "City: " + response["results"][0]["city"] client.puts "State: " + response["results"][0]["state"] client.puts "Country: " + response["results"][0]["country"] if ["A", "K", "N", "W"].include? response["results"][0]["callsign"][0] client.puts "\nFor more information about this operator, enter [Lookup " + response["results"][0]["callsign"].upcase + "]" end else client.puts id.to_s + " is not a valid NXDN ID." end end