Class: Callsigns::RadioID

Inherits:
Object
  • Object
show all
Defined in:
lib/callsigns/radioid.rb

Class Method Summary collapse

Class Method Details

.dmr(id, client) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 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) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# 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