CodeBlock-callsign 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/README +13 -0
  2. data/callook.rb +113 -0
  3. metadata +55 -0
data/README ADDED
@@ -0,0 +1,13 @@
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
+
data/callook.rb ADDED
@@ -0,0 +1,113 @@
1
+ #!/usr/local/bin/ruby
2
+ require 'rexml/document'
3
+ require 'open-uri'
4
+ class CallSign
5
+ def initialize(callsign)
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
111
+
112
+ p = CallSign.new("w3ok")
113
+ puts p.trusteename
metadata ADDED
@@ -0,0 +1,55 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: CodeBlock-callsign
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
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 -07: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
+ - callook.rb
27
+ has_rdoc: false
28
+ homepage: http://github.com/codeblock/CallSignRb
29
+ licenses:
30
+ post_install_message:
31
+ rdoc_options: []
32
+
33
+ require_paths:
34
+ - lib
35
+ required_ruby_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: "0"
40
+ version:
41
+ required_rubygems_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: "0"
46
+ version:
47
+ requirements: []
48
+
49
+ rubyforge_project:
50
+ rubygems_version: 1.3.5
51
+ signing_key:
52
+ specification_version: 2
53
+ 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.
54
+ test_files: []
55
+