2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/callsigns/callook.rb', line 2
def self.lookup(callsign, client)
callook_uri = "https://callook.info/" + callsign.downcase + "/json"
response = HTTParty.get(callook_uri).parsed_response
if response["status"] == "INVALID"
client.puts "Invalid callsign. Please make sure you entered a valid USA-Based callsign"
elsif response["status"] == "VALID"
client.puts "Callsign " + callsign.upcase + " is found!\n\n"
if response["previous"]["callsign"] == callsign.upcase
client.puts "ATTENTION: The callsign " + callsign.upcase + " is out-of-date. Operator changed callsign to: " + response["current"]["callsign"]
end
client.puts response["current"]["callsign"]
client.puts "========="
client.puts "Type: " + response["type"].capitalize
client.puts "Name: " + response["name"].upcase
if response["type"] == "CLUB"
client.puts "Trustee: " + response["trustee"]["name"].upcase + " [" + response["trustee"]["callsign"] + "]"
elsif response["type"] == "PERSON"
client.puts "Class: " + response["current"]["operClass"]
end
client.puts "Address: " + response["address"]["line1"]
client.puts " " + response["address"]["line2"]
client.puts " " + response["address"]["attn"] if response["address"]["attn"] != ""
client.puts "Previous callsign: " + response["previous"]["callsign"]
radioid_dmr_uri = "https://database.radioid.net/api/dmr/user/?callsign=" + callsign.downcase
response = HTTParty.get(radioid_dmr_uri).parsed_response
client.puts "DMR IDs: " + response["count"].to_s + " IDs found"
if response["count"].to_i > 0
response["results"].each do |r|
client.puts " " + r["id"].to_s
end
end
radioid_nxdn_uri = "https://database.radioid.net/api/nxdn/user/?callsign=" + callsign.downcase
response = HTTParty.get(radioid_nxdn_uri).parsed_response
client.puts "NXDN IDs: " + response["count"].to_s + " IDs found"
if response["count"].to_i > 0
response["results"].each do |r|
client.puts " " + r["id"].to_s
end
end
end
end
|