callsign 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README +32 -0
  2. data/lib/callsign.rb +110 -0
  3. metadata +56 -0
data/README ADDED
@@ -0,0 +1,32 @@
1
+ This RubyGem allows Ruby Coders to access the information contained on callook.info, an online Amateur Radio Callsign Lookup service, run by Joshua Dick, W1JDD.
2
+
3
+ The gem is easy to use and should work something like this:
4
+
5
+ #!/usr/bin/ruby
6
+ require 'rubygems'
7
+ require 'callsign'
8
+ call = CallSign.new("w1aw")
9
+ puts call.address
10
+
11
+
12
+ -------------------------------------------------
13
+
14
+ Well since I can't figure rdoc out, I'll tell you that CallSignRb has the following functions:
15
+
16
+ address(sep = "\n") - you can specify a separator if you don't want newlines.
17
+ name
18
+ callsign
19
+ previouscallsign
20
+ trusteecallsign
21
+ trusteename
22
+ type
23
+ status
24
+ class
25
+ previousclass
26
+ latitude
27
+ longitude
28
+ gridsquare
29
+ grantdate
30
+ expirydate
31
+ lastaction
32
+ frn
@@ -0,0 +1,110 @@
1
+ #!/usr/local/bin/ruby
2
+ require 'rexml/document'
3
+ require 'open-uri'
4
+ class CallSign
5
+ def initialize(callsign,prefixes=false)
6
+ @callinfo = REXML::Document.new(open("http://callook.info/index.php?callsign=#{callsign}&display=xml"))
7
+ end
8
+
9
+ def address(sep = "\n")
10
+ @callinfo.elements.each("callook/address") do |ele|
11
+ return ele.elements['line1'].text + sep + ele.elements['line2'].text
12
+ end
13
+ end
14
+
15
+ def name
16
+ @callinfo.elements.each("callook") do |ele|
17
+ return ele.elements['name'].text
18
+ end
19
+ end
20
+
21
+ def callsign
22
+ @callinfo.elements.each("callook/current") do |ele|
23
+ return ele.elements['callsign'].text
24
+ end
25
+ end
26
+
27
+ def previouscallsign
28
+ @callinfo.elements.each("callook/previous") do |ele|
29
+ return ele.elements['callsign'].text
30
+ end
31
+ end
32
+
33
+ def trusteecallsign
34
+ @callinfo.elements.each("callook/trustee") do |ele|
35
+ return ele.elements['callsign'].text
36
+ end
37
+ end
38
+
39
+ def trusteename
40
+ @callinfo.elements.each("callook/trustee") do |ele|
41
+ return ele.elements['name'].text
42
+ end
43
+ end
44
+
45
+ def type
46
+ @callinfo.elements.each("callook") do |ele|
47
+ return ele.elements['type'].text
48
+ end
49
+ end
50
+
51
+ def status
52
+ @callinfo.elements.each("callook") do |ele|
53
+ return ele.elements['status'].text
54
+ end
55
+ end
56
+
57
+ def class
58
+ @callinfo.elements.each("callook/current") do |ele|
59
+ return ele.elements['class'].text
60
+ end
61
+ end
62
+
63
+ def previousclass
64
+ @callinfo.elements.each("callook/previous") do |ele|
65
+ return ele.elements['class'].text
66
+ end
67
+ end
68
+
69
+ def latitude
70
+ @callinfo.elements.each("callook/location") do |ele|
71
+ return ele.elements['latitude'].text
72
+ end
73
+ end
74
+
75
+ def longitude
76
+ @callinfo.elements.each("callook/location") do |ele|
77
+ return ele.elements['logitude'].text
78
+ end
79
+ end
80
+
81
+ def gridsquare
82
+ @callinfo.elements.each("callook/location") do |ele|
83
+ return ele.elements['gridsquare'].text
84
+ end
85
+ end
86
+
87
+ def grantdate
88
+ @callinfo.elements.each("callook/otherinfo") do |ele|
89
+ return ele.elements['grantdate'].text
90
+ end
91
+ end
92
+
93
+ def expirydate
94
+ @callinfo.elements.each("callook/otherinfo") do |ele|
95
+ return ele.elements['expirydate'].text
96
+ end
97
+ end
98
+
99
+ def lastaction
100
+ @callinfo.elements.each("callook/otherinfo") do |ele|
101
+ return ele.elements['lastactiondate'].text
102
+ end
103
+ end
104
+
105
+ def frn
106
+ @callinfo.elements.each("callook/otherinfo") do |ele|
107
+ return ele.elements['frn'].text
108
+ end
109
+ end
110
+ end
metadata ADDED
@@ -0,0 +1,56 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: callsign
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Rick E.
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-07-30 00:00:00 -04:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: This RubyGem allows Ruby Coders to access the information contained on callook.info, an online Amateur Radio Callsign Lookup service, run by Joshua Dick, W1JDD.
17
+ email: codeblock@eighthbit.net
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - README
26
+ - lib/callsign.rb
27
+ has_rdoc: true
28
+ homepage: http://github.com/codeblock/CallSignRb
29
+ licenses: []
30
+
31
+ post_install_message:
32
+ rdoc_options: []
33
+
34
+ require_paths:
35
+ - lib
36
+ required_ruby_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: "0"
41
+ version:
42
+ required_rubygems_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: "0"
47
+ version:
48
+ requirements: []
49
+
50
+ rubyforge_project:
51
+ rubygems_version: 1.3.4
52
+ signing_key:
53
+ specification_version: 2
54
+ summary: This RubyGem allows Ruby Coders to access the information contained on callook.info, an online Amateur Radio Callsign Lookup service, run by Joshua Dick, W1JDD.
55
+ test_files: []
56
+