Class: CallSign
- Inherits:
-
Object
- Object
- CallSign
- Defined in:
- lib/callsign.rb
Instance Method Summary collapse
- #address(sep = "\n") ⇒ Object
- #callsign ⇒ Object
- #class ⇒ Object
- #expirydate ⇒ Object
- #frn ⇒ Object
- #grantdate ⇒ Object
- #gridsquare ⇒ Object
-
#initialize(callsign, prefixes = false) ⇒ CallSign
constructor
A new instance of CallSign.
- #lastaction ⇒ Object
- #latitude ⇒ Object
- #longitude ⇒ Object
- #name ⇒ Object
- #previouscallsign ⇒ Object
- #previousclass ⇒ Object
- #status ⇒ Object
- #trusteecallsign ⇒ Object
- #trusteename ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(callsign, prefixes = false) ⇒ CallSign
Returns a new instance of CallSign.
5 6 7 |
# File 'lib/callsign.rb', line 5 def initialize(callsign,prefixes=false) @callinfo = REXML::Document.new(open("http://callook.info/index.php?callsign=#{callsign}&display=xml")) end |
Instance Method Details
#address(sep = "\n") ⇒ Object
9 10 11 12 13 |
# File 'lib/callsign.rb', line 9 def address(sep = "\n") @callinfo.elements.each("callook/address") do |ele| return ele.elements['line1'].text + sep + ele.elements['line2'].text end end |
#callsign ⇒ Object
21 22 23 24 25 |
# File 'lib/callsign.rb', line 21 def callsign @callinfo.elements.each("callook/current") do |ele| return ele.elements['callsign'].text end end |
#class ⇒ Object
57 58 59 60 61 |
# File 'lib/callsign.rb', line 57 def class @callinfo.elements.each("callook/current") do |ele| return ele.elements['class'].text end end |
#expirydate ⇒ Object
93 94 95 96 97 |
# File 'lib/callsign.rb', line 93 def expirydate @callinfo.elements.each("callook/otherinfo") do |ele| return ele.elements['expirydate'].text end end |
#frn ⇒ Object
105 106 107 108 109 |
# File 'lib/callsign.rb', line 105 def frn @callinfo.elements.each("callook/otherinfo") do |ele| return ele.elements['frn'].text end end |
#grantdate ⇒ Object
87 88 89 90 91 |
# File 'lib/callsign.rb', line 87 def grantdate @callinfo.elements.each("callook/otherinfo") do |ele| return ele.elements['grantdate'].text end end |
#gridsquare ⇒ Object
81 82 83 84 85 |
# File 'lib/callsign.rb', line 81 def gridsquare @callinfo.elements.each("callook/location") do |ele| return ele.elements['gridsquare'].text end end |
#lastaction ⇒ Object
99 100 101 102 103 |
# File 'lib/callsign.rb', line 99 def lastaction @callinfo.elements.each("callook/otherinfo") do |ele| return ele.elements['lastactiondate'].text end end |
#latitude ⇒ Object
69 70 71 72 73 |
# File 'lib/callsign.rb', line 69 def latitude @callinfo.elements.each("callook/location") do |ele| return ele.elements['latitude'].text end end |
#longitude ⇒ Object
75 76 77 78 79 |
# File 'lib/callsign.rb', line 75 def longitude @callinfo.elements.each("callook/location") do |ele| return ele.elements['logitude'].text end end |
#name ⇒ Object
15 16 17 18 19 |
# File 'lib/callsign.rb', line 15 def name @callinfo.elements.each("callook") do |ele| return ele.elements['name'].text end end |
#previouscallsign ⇒ Object
27 28 29 30 31 |
# File 'lib/callsign.rb', line 27 def previouscallsign @callinfo.elements.each("callook/previous") do |ele| return ele.elements['callsign'].text end end |
#previousclass ⇒ Object
63 64 65 66 67 |
# File 'lib/callsign.rb', line 63 def previousclass @callinfo.elements.each("callook/previous") do |ele| return ele.elements['class'].text end end |
#status ⇒ Object
51 52 53 54 55 |
# File 'lib/callsign.rb', line 51 def status @callinfo.elements.each("callook") do |ele| return ele.elements['status'].text end end |
#trusteecallsign ⇒ Object
33 34 35 36 37 |
# File 'lib/callsign.rb', line 33 def trusteecallsign @callinfo.elements.each("callook/trustee") do |ele| return ele.elements['callsign'].text end end |
#trusteename ⇒ Object
39 40 41 42 43 |
# File 'lib/callsign.rb', line 39 def trusteename @callinfo.elements.each("callook/trustee") do |ele| return ele.elements['name'].text end end |
#type ⇒ Object
45 46 47 48 49 |
# File 'lib/callsign.rb', line 45 def type @callinfo.elements.each("callook") do |ele| return ele.elements['type'].text end end |