fcc 0.1.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/package.json ADDED
@@ -0,0 +1,92 @@
1
+ {
2
+ "name": "fcc",
3
+ "version": "1.x.x-semantic-release",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "git+https://github.com/jkeen/fcc.git"
7
+ },
8
+ "author": "jkeen",
9
+ "license": "MIT",
10
+ "bugs": {
11
+ "url": "https://github.com/jkeen/fcc/issues"
12
+ },
13
+ "homepage": "https://github.com/jkeen/fcc#readme",
14
+ "scripts": {
15
+ "semantic-release": "semantic-release"
16
+ },
17
+ "devDependencies": {
18
+ "semantic-release-rubygem": "^1.2.0",
19
+ "semantic-release": "^19.0.3",
20
+ "@semantic-release/changelog": "^6.0.1",
21
+ "@semantic-release/git": "^10.0.1"
22
+ },
23
+ "release": {
24
+ "branches": ["main"],
25
+ "plugins": [
26
+ [
27
+ "@semantic-release/commit-analyzer",
28
+ {
29
+ "releaseRules": [
30
+ {
31
+ "type": "*!",
32
+ "release": "major"
33
+ },
34
+ {
35
+ "type": "feat",
36
+ "release": "minor"
37
+ },
38
+ {
39
+ "type": "build",
40
+ "release": "patch"
41
+ },
42
+ {
43
+ "type": "ci",
44
+ "release": "patch"
45
+ },
46
+ {
47
+ "type": "chore",
48
+ "release": "patch"
49
+ },
50
+ {
51
+ "type": "docs",
52
+ "release": "patch"
53
+ },
54
+ {
55
+ "type": "refactor",
56
+ "release": "patch"
57
+ },
58
+ {
59
+ "type": "style",
60
+ "release": "patch"
61
+ },
62
+ {
63
+ "type": "test",
64
+ "release": "patch"
65
+ }
66
+ ],
67
+ "parserOpts": {
68
+ "noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES", "BREAKING"]
69
+ }
70
+ }
71
+ ],
72
+ "@semantic-release/release-notes-generator",
73
+ [
74
+ "@semantic-release/changelog",
75
+ {
76
+ "changelogTitle": "fcc changelog",
77
+ "changelogFile": "CHANGELOG.md"
78
+ }
79
+ ],
80
+ "semantic-release-rubygem",
81
+ "@semantic-release/github",
82
+ [
83
+ "@semantic-release/git",
84
+ {
85
+ "assets": ["CHANGELOG.md"],
86
+ "message": "${nextRelease.version} CHANGELOG [skip ci]\n\n${nextRelease.notes}"
87
+ }
88
+ ]
89
+ ],
90
+ "debug": false,
91
+ "dryRun": false
92
+ }}
data/spec/fcc_spec.rb ADDED
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+ require_relative 'spec_helper'
3
+
4
+ RSpec.describe FCC, type: :model do
5
+
6
+
7
+ end
@@ -0,0 +1,7 @@
1
+ require 'fcc'
2
+
3
+ RSpec.configure do |config|
4
+ config.mock_with :rspec do |mocks|
5
+ mocks.syntax = [:should, :expect]
6
+ end
7
+ end
metadata CHANGED
@@ -1,154 +1,188 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: fcc
3
- version: !ruby/object:Gem::Version
4
- hash: 27
5
- prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 0
10
- version: 0.1.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Jeff Keen
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2011-01-30 00:00:00 -06:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- version_requirements: &id001 !ruby/object:Gem::Requirement
23
- none: false
24
- requirements:
11
+ date: 2023-02-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
25
17
  - - ">="
26
- - !ruby/object:Gem::Version
27
- hash: 3
28
- segments:
29
- - 0
30
- version: "0"
31
- requirement: *id001
32
- prerelease: false
33
- name: nokogiri
18
+ - !ruby/object:Gem::Version
19
+ version: '6.1'
34
20
  type: :runtime
35
- - !ruby/object:Gem::Dependency
36
- version_requirements: &id002 !ruby/object:Gem::Requirement
37
- none: false
38
- requirements:
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
39
24
  - - ">="
40
- - !ruby/object:Gem::Version
41
- hash: 3
42
- segments:
43
- - 0
44
- version: "0"
45
- requirement: *id002
25
+ - !ruby/object:Gem::Version
26
+ version: '6.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: httparty
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.18'
34
+ type: :runtime
46
35
  prerelease: false
47
- name: shoulda
48
- type: :development
49
- - !ruby/object:Gem::Dependency
50
- version_requirements: &id003 !ruby/object:Gem::Requirement
51
- none: false
52
- requirements:
53
- - - ~>
54
- - !ruby/object:Gem::Version
55
- hash: 23
56
- segments:
57
- - 1
58
- - 0
59
- - 0
60
- version: 1.0.0
61
- requirement: *id003
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.18'
41
+ - !ruby/object:Gem::Dependency
42
+ name: lightly
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.3.3
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.3.3
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubyzip
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 2.3.2
62
+ type: :runtime
62
63
  prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 2.3.2
69
+ - !ruby/object:Gem::Dependency
70
+ name: logger
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
63
84
  name: bundler
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '2.1'
64
90
  type: :development
65
- - !ruby/object:Gem::Dependency
66
- version_requirements: &id004 !ruby/object:Gem::Requirement
67
- none: false
68
- requirements:
69
- - - ~>
70
- - !ruby/object:Gem::Version
71
- hash: 7
72
- segments:
73
- - 1
74
- - 5
75
- - 2
76
- version: 1.5.2
77
- requirement: *id004
78
91
  prerelease: false
79
- name: jeweler
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '2.1'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rake
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 12.3.3
80
104
  type: :development
81
- - !ruby/object:Gem::Dependency
82
- version_requirements: &id005 !ruby/object:Gem::Requirement
83
- none: false
84
- requirements:
85
- - - ">="
86
- - !ruby/object:Gem::Version
87
- hash: 3
88
- segments:
89
- - 0
90
- version: "0"
91
- requirement: *id005
92
105
  prerelease: false
93
- name: rcov
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 12.3.3
111
+ - !ruby/object:Gem::Dependency
112
+ name: rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 3.9.0
94
118
  type: :development
95
- description: ""
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 3.9.0
125
+ description: ''
96
126
  email: jeff@keen.me
97
- executables: []
98
-
127
+ executables:
128
+ - console
129
+ - setup
99
130
  extensions: []
100
-
101
- extra_rdoc_files:
102
- - LICENSE.txt
103
- - README.rdoc
104
- files:
105
- - .document
106
- - .rvmrc
131
+ extra_rdoc_files: []
132
+ files:
133
+ - ".document"
134
+ - ".github/workflows/release.yml"
135
+ - ".github/workflows/tests.yml"
136
+ - ".gitignore"
137
+ - CHANGELOG.md
107
138
  - Gemfile
108
139
  - Gemfile.lock
109
140
  - LICENSE.txt
110
- - README.rdoc
141
+ - README.md
111
142
  - Rakefile
112
- - VERSION
113
- - lib/am.rb
143
+ - bin/console
144
+ - bin/setup
145
+ - fcc.gemspec
114
146
  - lib/fcc.rb
115
- - lib/fm.rb
116
- - test/helper.rb
117
- - test/test_fcc.rb
118
- has_rdoc: true
147
+ - lib/fcc/station.rb
148
+ - lib/fcc/station/cache.rb
149
+ - lib/fcc/station/extended_info.rb
150
+ - lib/fcc/station/index.rb
151
+ - lib/fcc/station/info.rb
152
+ - lib/fcc/station/lms_data.rb
153
+ - lib/fcc/station/parsers/extended_info.rb
154
+ - lib/fcc/station/parsers/lms_data.rb
155
+ - lib/fcc/station/record_delegate.rb
156
+ - lib/fcc/station/record_group.rb
157
+ - lib/fcc/station/result.rb
158
+ - lib/version.rb
159
+ - package.json
160
+ - spec/fcc_spec.rb
161
+ - spec/spec_helper.rb
119
162
  homepage: http://github.com/jkeen/fcc
120
- licenses:
163
+ licenses:
121
164
  - MIT
165
+ metadata: {}
122
166
  post_install_message:
123
167
  rdoc_options: []
124
-
125
- require_paths:
168
+ require_paths:
126
169
  - lib
127
- required_ruby_version: !ruby/object:Gem::Requirement
128
- none: false
129
- requirements:
170
+ required_ruby_version: !ruby/object:Gem::Requirement
171
+ requirements:
130
172
  - - ">="
131
- - !ruby/object:Gem::Version
132
- hash: 3
133
- segments:
134
- - 0
135
- version: "0"
136
- required_rubygems_version: !ruby/object:Gem::Requirement
137
- none: false
138
- requirements:
173
+ - !ruby/object:Gem::Version
174
+ version: '0'
175
+ required_rubygems_version: !ruby/object:Gem::Requirement
176
+ requirements:
139
177
  - - ">="
140
- - !ruby/object:Gem::Version
141
- hash: 3
142
- segments:
143
- - 0
144
- version: "0"
178
+ - !ruby/object:Gem::Version
179
+ version: '0'
145
180
  requirements: []
146
-
147
181
  rubyforge_project:
148
- rubygems_version: 1.4.1
182
+ rubygems_version: 2.7.6
149
183
  signing_key:
150
- specification_version: 3
151
- summary: Searches the FCC's FM and AM databases
152
- test_files:
153
- - test/helper.rb
154
- - test/test_fcc.rb
184
+ specification_version: 4
185
+ summary: Searches the FCC's FM, AM, and TV databases
186
+ test_files:
187
+ - spec/fcc_spec.rb
188
+ - spec/spec_helper.rb
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm 1.9.2-head@fccc
data/README.rdoc DELETED
@@ -1,28 +0,0 @@
1
- = fcc
2
-
3
- Queries the FCC database for FM information.
4
-
5
- FCC::FM.find("KUT") #=> KUT station info
6
-
7
- FCC::AM.find("KLBJ") #=> KLBJ station info
8
-
9
- FCC::FM.find_all(:city => "Austin", :state => "TX") #=> [FM::Station, FM::Station, FM::Station]
10
-
11
-
12
- TODO: Dry some of this out.
13
-
14
- == Contributing to fcc
15
-
16
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
17
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
18
- * Fork the project
19
- * Start a feature/bugfix branch
20
- * Commit and push until you are happy with your contribution
21
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
22
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
23
-
24
- == Copyright
25
-
26
- Copyright (c) 2011 Jeff Keen. See LICENSE.txt for
27
- further details.
28
-
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.1.0
data/lib/am.rb DELETED
@@ -1,126 +0,0 @@
1
- require 'open-uri'
2
-
3
- module FCC
4
- class AM
5
- class Station
6
- attr_reader :call_letters, :band, :hours, :file_number, :station_class, :fcc_id, :city, :state, :country, :licensed_to, :latitude, :longitude
7
- def initialize(*fields)
8
- @raw = fields
9
- @call_letters = fields[0]
10
- @frequency = fields[1]
11
- @band = fields[2]
12
- # fields[3] # Not used for AM
13
- # fields[4] # Directional Antenna (DA) or NonDirectional (ND)
14
- @hours = fields[5] # Hours of operation for this record (daytime, nighttime, or unlimited)
15
- @domestic_class = fields[6] # Domestic US Station class
16
- @international_class =fields[7] # International station class
17
- @fm_status = fields[8]
18
- @city = fields[9]
19
- @state = fields[10]
20
- @country = fields[11]
21
- @file_number = fields[12] # File Number (Application, Construction Permit or License) or Docket Number (Rulemaking)
22
- @signal_strength = fields[13] # Power
23
- # fields[14] # Not used
24
- # fields[15] # Not used
25
- # fields[16] # Not used
26
- @fcc_id = fields[17] # Facility ID Number (unique to each station)
27
- @latitude = latitude(fields[18], fields[19], fields[20], fields[21])
28
- @longitude = longitude(fields[22], fields[23], fields[24], fields[25])
29
-
30
- @licensed_to = fields[26] # Licensee or Permittee
31
- # fields[27] # Kilometers distant (radius) from entered latitude, longitude
32
- # fields[28] # Miles distant (radius) from entered latitude, longitude
33
- # fields[29] # Azimuth, looking from center Lat, Lon to this record's Lat, Lon
34
- # fields[30] # Application ID number (from CDBS database)***
35
- end
36
-
37
- private
38
-
39
- def longitude(direction, degrees, minutes, seconds)
40
- "#{(direction =~ /S/ ? "-" : "")}#{degrees}.#{minutes}"
41
- end
42
-
43
- def latitude(direction, degrees, minutes, seconds)
44
- "#{(direction =~ /S/ ? "-" : "")}#{degrees}.#{minutes}"
45
- end
46
-
47
- def signal_strength(raw_signal)
48
- raw_signal.gsub(/\.\s+/, ".0 ") if raw_signal
49
- end
50
-
51
- def frequency(freq)
52
- freq[/[0-9]+\.?[0-9]/] if freq
53
- end
54
- end
55
-
56
- BASE_URL = "http://www.fcc.gov/fcc-bin/amq"
57
-
58
- def self.find(call_letters)
59
- raise ArgumentError, "no call letters were supplied" if call_letters.nil? || call_letters.strip.length == 0
60
-
61
- find_all(:call_letters => call_letters).first
62
- end
63
-
64
- def self.find_all(conditions = {})
65
- results = []
66
- query(conditions.merge(:band => "AM")) do |feed|
67
- feed.each_line do |row|
68
- fields = row.split("|").select { |field| (field.strip! && !field.nil?)}
69
- results << Station.new(*fields)
70
- end
71
- end
72
- # if call letters are supplied, return matches that match call letters exactly.
73
- # FCC does partial matches (from the start of the string), so that "KUT" will return "KUTT", also
74
- if conditions[:call_letters]
75
- exact_matches = results.select { |d| d.call_letters == conditions[:call_letters] }
76
- results = exact_matches if (exact_matches)
77
- end
78
-
79
- #sort by signal strength
80
- if results.size > 1
81
- results.sort_by { |s| s.signal_strength}.reverse
82
- else
83
- results
84
- end
85
- end
86
-
87
- private
88
-
89
- def self.query(conditions = {})
90
- query = ""
91
- prepare_args(conditions).each { |k,v| query += "#{k}=#{v}&" }
92
- url = "#{BASE_URL}?#{query}"
93
- feed = open(url)
94
- yield feed
95
- end
96
-
97
- def self.prepare_args(params)
98
- return {
99
- :state => params[:state],
100
- :call => params[:call_letters],
101
- :city => params[:city],
102
- :arn => nil,
103
- :serv => params[:band],
104
- :vac => nil,
105
- :freq => params[:frequency] || params[:frequency_lower] || "530",
106
- :fre2 => params[:frequency] || params[:frequency_upper] || "1700",
107
- :facid => nil,
108
- :class => nil,
109
- :dkt => nil,
110
- :dist => nil,
111
- :dlat2 => nil,
112
- :dlon2 => nil,
113
- :mlon2 => nil,
114
- :mlat2 => nil,
115
- :slat2 => nil,
116
- :slon2 => nil,
117
- # :NS => "N",
118
- # :e => 9,
119
- :EW => "W",
120
- :list => 4, # pipe separated output
121
- :size => 9
122
- }
123
- end
124
-
125
- end
126
- end