shack_kit 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a08827cfb7fd56b0f30338f7a4665f36d03a7b73
4
- data.tar.gz: 3f0016c6fced0a3f3d4ffbccee2ce6b7507ab4d3
3
+ metadata.gz: b484b4333de79ffc4b7c969d2786ec93bc4ea728
4
+ data.tar.gz: dd017f27e801f56a5b7b8e7654bded5b8e51814d
5
5
  SHA512:
6
- metadata.gz: 48245dd13db0fc60d90c04117eb8fb69e7b30bcaaf31882a6281892f294b3d98ac81bb8e80bf4af8a6d56f50e0a7dc5a1afa772537c1ac856ef8e1aae633bf82
7
- data.tar.gz: f88ee3d2586d2e8260289a590cd821267d8ebbe83262208b2ba318be9e03b08ae3d3d660a921e8a222aa674a3f6de65a070d71803fd802aee986c8b54b22d95e
6
+ metadata.gz: 67ef896c6ba5b8c274af4136033bac84141648d4f35045b057c93975fcf8f46136a9f2f99986f768cf948ceeac91bd18d4476a9e5390e28918037bab4e7786a4
7
+ data.tar.gz: 70172df8d6cadc9c64a14c4c012e379de0ced7b75b6641b0ed52e7710a66b03743925370bd7b6d7205b65b93cd4ce135cfb1e3acd62bb588b033f7b281d89d53
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015 Marcin Bajer
3
+ Copyright (c) 2015-2016 Marcin Bajer
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,12 +1,23 @@
1
1
  # ShackKit
2
2
 
3
- Collection of HAM radio utilities packaged as Ruby gem, by SQ9OZM
3
+ [![Gem Version](https://badge.fury.io/rb/shack_kit.svg)](https://badge.fury.io/rb/shack_kit)
4
+ [![Code Climate](https://codeclimate.com/github/rrrodrigo/shack_kit/badges/gpa.svg)](https://codeclimate.com/github/rrrodrigo/shack_kit)
5
+
6
+ Collection of HAM radio utilities packaged as Ruby gem, by Marcin Bajer, SQ9OZM
4
7
 
5
8
  ## Functionality
9
+
6
10
  ### Data lookup
7
- * SOTA callsigns checker, using ON6ZQ database of SOTA activators and chasers (http://www.on6zq.be/w/index.php/SOTA/MasterDta)
8
- * SOTA summits checker, using the database of SOTA summits published at http://sotadata.org.uk/summits.aspx by Summits on the Air
9
- * SP operators callsigns checker, using data published by Republic of Poland Office of Electronic Communication (https://amator.uke.gov.pl/?locale=en)
11
+
12
+ #### Offline
13
+ * SOTA callsigns checker, using [ON6ZQ database of SOTA activators and chasers](http://www.on6zq.be/w/index.php/SOTA/MasterDta).
14
+ * SOTA summits checker, using [the database of SOTA summits](http://sotadata.org.uk/summits.aspx) published by Summits on the Air.
15
+ * SP callsigns checker, using licensing data published by [Republic of Poland Office of Electronic Communication](https://amator.uke.gov.pl/?locale=en).
16
+
17
+ #### Online
18
+ * [QRZ.com](https://www.qrz.com) callsign lookup, using [the XML API](http://www.qrz.com/page/xml_data.html) of the most popular callbook ("phone book" for radio amateurs) worldwide. Note that paid subscription is needed to access complete datasets.
19
+ * [HamQTH.com](https://www.hamqth.com) callsign lookup, using [the XML API](https://www.hamqth.com/developers.php) of a less popular, but free callbook service.
20
+ * [QRZ.pl](http://qrz.pl) callsign lookup, using the most popular callbook service in Poland - and hence limited to SP callsigns.
10
21
 
11
22
  ## Installation
12
23
 
@@ -38,7 +49,7 @@ Now you are all set to use ShackKit in your code or from Ruby console!
38
49
 
39
50
  ## Usage
40
51
 
41
- #### How to use the data lookup functionality?
52
+ #### Offline data lookup
42
53
 
43
54
  ```ruby
44
55
  require 'shack_kit'
@@ -75,13 +86,92 @@ ShackKit::Data::SOTASummits.check('SP/BZ-059')
75
86
 
76
87
  ```
77
88
 
78
- #### How to refresh the data in ShackKit database?
89
+ #### Online data lookup
90
+
91
+ Online means here that you need Internet access to perform a lookup and that the services you are querying are available when you do it.
92
+
93
+ ```ruby
94
+ require 'shack_kit'
95
+
96
+ # To be able to query QRZ.com from your Ruby code you need to have created an account there.
97
+ # First, create a query object like this, substituting your own callsign and password:
98
+ qrz = ShackKit::Data::QRZ.new(login: "SQ9OZM", password: "t0ps3cr37")
99
+ => #<ShackKit::Data::QRZ:0x007fc1424be8e8 @session_key="72e0ab57811969fd98f64692875d2c98">
100
+
101
+ # After that, you can make multiple queries until the session key expires (after one hour)
102
+ qrz.lookup("SQ9OZM")
103
+ => {:call=>"SQ9OZM", :fname=>"Marcin", :name=>"Bajer", :addr2=>"Dobczyce", :country=>"Poland", :message=>"A subscription is required to access the complete record."}
104
+
105
+ qrz.lookup("EA0JC")
106
+ => {:call=>"EA0JC", :fname=>"ex King of Spain", :name=>"- QSL ONLY via EA4URE", :addr2=>"P.O. Box: 55.055 - Madrid", :country=>"Spain", :message=>"A subscription is required to access the complete record."}
107
+
108
+ qrz.lookup("SP9KDR")
109
+ => {:call=>"SP9KDR", :fname=>"Klub Krótkofalowców", :name=>"Dolina Raby", :addr2=>"Pcim", :country=>"Poland", :message=>"A subscription is required to access the complete record."}
110
+
111
+ qrz.lookup("N0CALL")
112
+ => {:error=>"Not found: N0CALL"}
113
+
114
+ # To be able to query HamQTH from your Ruby code you need to have created an account there.
115
+ # First, create a query object like this, substituting your own callsign and password:
116
+ hamqth = ShackKit::Data::HamQTH.new(login: "SQ9OZM", password: "an07h3rs3cr37")
117
+ => #<ShackKit::Data::HamQTH:0x007fc1427378b8 @session_key="984ebf6d925ee0bb12daaad00367d2c79d3c0e1e">
118
+
119
+ # After that, you can make multiple queries until the session key expires (after one hour)
120
+ hamqth.lookup("SQ9OZM")
121
+ => {:callsign=>"SQ9OZM", :nick=>"Marcin", :qth=>"Dobczyce", :country=>"Poland", :adif=>"269", :itu=>"28", :cq=>"15", :grid=>"KN09BV", :adr_name=>"Marcin Bajer", :adr_street1=>"Marwin 199", :adr_city=>"Dobczyce", :adr_zip=>"32-410", :adr_country=>"Poland", :adr_adif=>"269", :district=>"M", :lotw=>"Y", :qsldirect=>"Y", :qsl=>"Y", :eqsl=>"Y", :email=>"sq9ozm@tigana.pl", :web=>"http://sq9ozm.tumblr.com", :latitude=>"49.880729", :longitude=>"20.116471", :continent=>"EU", :utc_offset=>"-1"}
122
+
123
+ hamqth.lookup("EA0JC")
124
+ => {:callsign=>"ea0jc", :nick=>"King", :qth=>"Madrid", :country=>"Spain", :adif=>"281", :itu=>"37", :cq=>"14", :grid=>"IN80DJ", :adr_name=>"King Juan Carlos De Borb~n", :adr_street1=>"Royal Palace", :adr_city=>"Madrid", :adr_zip=>"", :adr_country=>"Spain", :adr_adif=>"281", :lotw=>"?", :qsldirect=>"?", :qsl=>"?", :eqsl=>"?", :latitude=>"40.416648864746094", :longitude=>"-3.7144553661346436", :continent=>"EU", :utc_offset=>"-1"}
125
+
126
+ hamqth.lookup("SP9KDR")
127
+ => {:error=>"Callsign not found"}
128
+
129
+ hamqth.lookup("N0CALL")
130
+ => {:error=>"Callsign not found"}
131
+
132
+ # In case you do not want to enter the QRZ.com/HamQTH.com password in your code,
133
+ # create a shack_kit config file at `~/.shack_kit/config.yml`
134
+ # with the following structure (subsitute your own callsigns and passwords):
135
+ qrz_com:
136
+ login: SQ9OZM
137
+ password: t0ps3cr37
138
+ ham_qth:
139
+ login: SQ9OZM
140
+ password: an07h3rs3cr37
141
+
142
+ # After that, the query objects can be created simply:
143
+
144
+ qrz = ShackKit::Data::hamqth.new
145
+ => #<ShackKit::Data::QRZ:0x007fc1427cf8e8 @session_key="72e0ab57811969fd98f64692875d2c98">
146
+
147
+ hamqth = ShackKit::Data::HamQTH.new
148
+ => #<ShackKit::Data::HamQTH:0x007fc142774380 @session_key="f0d0f750193b936927fdd841f459f4fb8de1a2a3">
149
+
150
+ # To get callsign information at qrz.pl from your Ruby code you do not need any account there.
151
+ # Just run the lookup like this:
152
+
153
+ ShackKit::Data::QRZ_PL.lookup("SP9AMH")
154
+ => {:callsign=>"SP9AMH", :details=>["Data rejestracji: 2009-03-27 10:42:00", "Licznik odwiedzin strony: sp9amh.qrz.pl wskazuje: 6916"], :grid=>nil}
155
+
156
+ ShackKit::Data::QRZ_PL.lookup("SP9KDR")
157
+ => {:callsign=>"SP9KDR", :details=>["Klub Krotkofalowcow Doliny Raby", "Pcim 597", "32-432 Pcim", "POLSKA", "LOKATOR: JN99XS", "QSL MANAGER: PZK OT-12", "QRG: FM: 145.450MHz DV: 438.150MHz", "SP9KDR na mapie kompaktowej lub pe\xB3noekranowej", "Data rejestracji: 2012-12-06 22:14:58", "Licznik odwiedzin strony: sp9kdr.qrz.pl wskazuje: 1575"], :grid=>"JN99XS"}
158
+
159
+ ShackKit::Data::QRZ_PL.lookup("SP9KGP")
160
+ => {:callsign=>"SP9KGP", :details=>["Klub Turystyczno-Radiowo-Astronomiczny 'Ryjek' SP9KGP", "Schronisko PTTK na Luboniu Wielkim", "34 - 701 Rabka Zaryte 165", "Polska", "LOKATOR: JN99XP", "QSL MANAGER: SQ9MCK", "QRG: 145.550 MHz", "SP9KGP na mapie kompaktowej lub pe\xB3noekranowej", "Data rejestracji: 2006-07-29 01:35:41", "Licznik odwiedzin strony: sp9kgp.qrz.pl wskazuje: 21432"], :grid=>"JN99XP"}
161
+
162
+ ShackKit::Data::QRZ_PL.lookup("EA0JC")
163
+ => {:error=>"Not found: EA0JC"}
164
+ ```
165
+
166
+
167
+ #### Refreshing the data in ShackKit database
79
168
 
80
169
  ##### SOTA callsigns
81
170
  Christophe ON6ZQ compiles the reference data every night and publishes them at http://www.on6zq.be/w/index.php/SOTA/MasterDta in a [zip file](http://www.on6zq.be/p/SOTA/SOTAdata/masterSOTA.zip). Upon extracting the zip, check for file named `masterSOTA.scp` and load its content into ShackKit database like this:
82
171
 
83
172
  ```ruby
84
- ShackKit::Data::SOTACalls.update('masterSOTA.scp') #=> 6328 (this is the count of loaded callsigns)
173
+ ShackKit::Data::SOTACalls.update('masterSOTA.scp')
174
+ => 6328 (this is the count of loaded callsigns)
85
175
  ```
86
176
 
87
177
  ##### SOTA summits
@@ -89,7 +179,8 @@ Summits on the Air Management Team maintains the database of SOTA award program
89
179
  updated daily, available for download in CSV format by following a link from the bottom of the [summits page](http://www.sotadata.org.uk/summits.aspx).
90
180
  The file can be loaded into ShackKit database like this:
91
181
  ```ruby
92
- ShackKit::Data::SOTASummits.update("db/sources/summitslist.csv") #=> 95618 (this is the count of loaded summits)
182
+ ShackKit::Data::SOTASummits.update("db/sources/summitslist.csv")
183
+ => 95618 (this is the count of loaded summits)
93
184
  ```
94
185
  It is a large dataset and will take a while to load.
95
186
 
@@ -97,7 +188,8 @@ It is a large dataset and will take a while to load.
97
188
  [UKE, the Office of Electronic Communication](https://en.uke.gov.pl) has the authority over issuing amateur radio licenses in Poland. The current lists of valid licenses are published separately for individual and club stations and are downloadable as CSV files from these pages: https://amator.uke.gov.pl/individuals?locale=en (Individuals) and https://amator.uke.gov.pl/clubs?locale=en (Clubs). There is a blue "Download" button on the bottom left of each page. Both datasets can be then loaded into ShackKit database like this:
98
189
 
99
190
  ```ruby
100
- ShackKit::Data::SPCalls.update("db/sources/individuals_2016-04-01.csv", "db/sources/clubs_2016-04-01.csv") #=> 13321 (number of loaded calls)
191
+ ShackKit::Data::SPCalls.update("db/sources/individuals_2016-04-01.csv", "db/sources/clubs_2016-04-01.csv")
192
+ => 13321 (number of loaded calls)
101
193
  ```
102
194
 
103
195
  ## Development