fcc 1.4.4 → 1.4.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 51925187328d074d19232a09b99b61c053859729c4211dd1931a34f4eff3a26e
4
- data.tar.gz: fc4c2b54c8a19af760ff5c07895932b34fde18ec412ef64f6600a0a6db88650d
3
+ metadata.gz: 3b1badea4f71c71fca305a42faf33d81b8d3bd790f2e3c6ffd06093887345608
4
+ data.tar.gz: ce292f11199f0415ebf887d25b51accd79d0531b9189f1c941e236e4ea5c80bc
5
5
  SHA512:
6
- metadata.gz: 760c5a264f59c673cfed8ba5f58f4638edbf6defc4c3ebfad6bad0080d4e58cd7fa068f2a4be05de72dda3037d0aaa74ce6db43fdc5fc0e19622c02c02a35d66
7
- data.tar.gz: 5235a78530dd7b939fde6d88d8d7dd668d59adc35f485e90470d98304e8cfd9692c639f1ca22c7006d89897919539185b111f766ec846d3f468488aca113b0b3
6
+ metadata.gz: 6f79be5bcddfc7001c7be7c6ef0e64e26acc7e59ae773aaacebea28d9627febe56ab8fecb85a0a1ccda7277b3373999d9ffd5cc2263492e688218c597235e836
7
+ data.tar.gz: b2280ae8d3dbdaacf447f5cbe880c9220a41b92ef22d2459bf850cfc238c370b58aa921d76d4977f6b4506d744dfff308de92a43827e79e54ad102ef2ae4eafc
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  fcc changelog
2
2
 
3
+ ## [1.4.6](https://github.com/jkeen/fcc/compare/v1.4.5...v1.4.6) (2024-05-06)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * Update some syntax to get things working better with some FCC changes ([9020eee](https://github.com/jkeen/fcc/commit/9020eeee85f1e9689ccff108f9438e48fcbe550c))
9
+
10
+ ## [1.4.5](https://github.com/jkeen/fcc/compare/v1.4.4...v1.4.5) (2024-03-20)
11
+
3
12
  ## [1.4.4](https://github.com/jkeen/fcc/compare/v1.4.3...v1.4.4) (2024-03-20)
4
13
 
5
14
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fcc (1.4.0)
4
+ fcc (1.4.4)
5
5
  activesupport (>= 6.1)
6
6
  csv
7
7
  httparty (~> 0.21)
@@ -24,9 +24,10 @@ GEM
24
24
  tzinfo (~> 2.0)
25
25
  base64 (0.2.0)
26
26
  bigdecimal (3.1.7)
27
+ byebug (11.1.3)
27
28
  concurrent-ruby (1.2.3)
28
29
  connection_pool (2.4.1)
29
- csv (3.2.8)
30
+ csv (3.3.0)
30
31
  diff-lcs (1.5.1)
31
32
  drb (2.2.1)
32
33
  httparty (0.21.0)
@@ -63,6 +64,7 @@ PLATFORMS
63
64
 
64
65
  DEPENDENCIES
65
66
  bundler
67
+ byebug
66
68
  fcc!
67
69
  rake (~> 12.3.3)
68
70
  rspec (~> 3.9.0)
data/fcc.gemspec CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
15
15
  spec.require_paths = ["lib"]
16
16
  spec.homepage = %q{http://github.com/jkeen/fcc}
17
17
  spec.licenses = ["MIT"]
18
- spec.rubygems_version = %q{1.4.1}
18
+ spec.required_ruby_version = ">= 2.7"
19
19
  spec.summary = %q{Searches the FCC's FM, AM, and TV databases}
20
20
  spec.add_dependency "activesupport", ">= 6.1"
21
21
  spec.add_dependency "httparty", "~> 0.21"
@@ -23,7 +23,7 @@ module FCC
23
23
  @lightly.get(key.to_s) do
24
24
  FCC.log "Loading up the cache with results for key: #{key}. This might take a minute…"
25
25
  value = yield
26
- if value && value.present?
26
+ if value
27
27
  value
28
28
  else
29
29
  nil
@@ -7,7 +7,7 @@ module FCC
7
7
  include HTTParty
8
8
  attr_accessor :results, :service
9
9
 
10
- base_uri 'https://fcc-cache.b-cdn.net/fcc-bin/'
10
+ base_uri 'https://transition.fcc.gov/fcc-bin/'
11
11
 
12
12
  def initialize(service)
13
13
  @service = service
@@ -48,7 +48,10 @@ module FCC
48
48
  cache_key = "#{self.class.instance_variable_get('@default_options')[:base_uri]}/#{@service.to_s.downcase}q"
49
49
  FCC.cache.fetch cache_key do
50
50
  response = self.class.get("/#{service.to_s.downcase}q", @options.merge(query: @query))
51
- FCC.log(response.request.uri.to_s.gsub('&list=4', '&list=0'))
51
+
52
+ FCC.log("Request: #{response.request.uri}")
53
+ FCC.log("Inspect: #{response.request.uri.to_s.gsub('&list=4', '&list=0')}")
54
+
52
55
  response.parsed_response
53
56
  end
54
57
  rescue StandardError => e
@@ -29,7 +29,7 @@ module FCC
29
29
 
30
30
  def results
31
31
  @results ||= begin
32
- response = self.class.get("/api/service/#{service.to_s.downcase}/facility/getall.json")
32
+ response = self.class.get("/api/service/#{service.to_s.downcase}/facility/getall")
33
33
  response.parsed_response['results']['facilityList']
34
34
  end
35
35
  end
@@ -19,7 +19,7 @@ module FCC
19
19
  Station.index(service).call_sign_to_id(id_or_call_sign)
20
20
  end
21
21
 
22
- response = self.class.get("/api/service/#{service.to_s.downcase}/facility/id/#{id}.json")
22
+ response = self.class.get("/api/service/#{service.to_s.downcase}/facility/id/#{id}")
23
23
 
24
24
  begin
25
25
  body = response['results']['facility']
@@ -12,7 +12,7 @@ module FCC
12
12
  fields = row.split('|').slice(1...-1).collect(&:strip).map { |v| v == '-' ? "" : v }
13
13
 
14
14
  attrs[:call_sign] = fields[0]
15
- attrs[:frequency] = parse_frequency(fields[1])
15
+ attrs[:frequency] = parse_frequency(fields[1]) rescue nil
16
16
  attrs[:band] = fields[2]
17
17
  attrs[:channel] = fields[3]
18
18
  attrs[:antenna_type] = fields[4] # Directional Antenna (DA) or NonDirectional (ND)
@@ -24,13 +24,13 @@ module FCC
24
24
  attrs[:state] = fields[10]
25
25
  attrs[:country] = fields[11]
26
26
  attrs[:file_number] = fields[12] #File Number (Application, Construction Permit or License) or
27
- attrs[:signal_strength] = parse_signal_strength(fields[13]) # Effective Radiated Power --
28
- attrs[:effective_radiated_power] = parse_signal_strength(fields[14]) # Effective Radiated Power -- vertically polarized (maximum)
27
+ attrs[:signal_strength] = parse_signal_strength(fields[13]) rescue nil # Effective Radiated Power --
28
+ attrs[:effective_radiated_power] = parse_signal_strength(fields[14]) rescue nil # Effective Radiated Power -- vertically polarized (maximum)
29
29
  attrs[:haat_horizontal] = fields[15] # Antenna Height Above Average Terrain (HAAT) -- horizontal polarization
30
30
  attrs[:haat_vertical] = fields[16] # Antenna Height Above Average Terrain (HAAT) -- vertical polarization
31
31
  attrs[:fcc_id] = fields[17] # Facility ID Number (unique to each station)
32
- attrs[:latitude] = parse_latitude(fields[18], fields[19], fields[20], fields[21])
33
- attrs[:longitude] = parse_longitude(fields[22], fields[23], fields[24], fields[25])
32
+ attrs[:latitude] = parse_latitude(fields[18], fields[19], fields[20], fields[21]) rescue nil
33
+ attrs[:longitude] = parse_longitude(fields[22], fields[23], fields[24], fields[25]) rescue nil
34
34
  attrs[:licensed_to] = fields[26] # Licensee or Permittee
35
35
 
36
36
  results << attrs
@@ -52,7 +52,7 @@ module FCC
52
52
  end
53
53
 
54
54
  def parse_signal_strength(power_string)
55
- return unless power_string.present?
55
+ return unless power_string
56
56
 
57
57
  number, unit = power_string.strip.scan(/^([0-9.]+)\s+(\w+)$?/).flatten
58
58
  multiplier = case unit&.downcase
@@ -98,7 +98,7 @@ module FCC
98
98
  end
99
99
 
100
100
  def inspect
101
- "<RecordDelegate:[#{band}] #{frequency} #{call_sign} — #{community.city} #{community.state} />"
101
+ "<RecordDelegate:[#{band}] #{frequency} #{call_sign} — #{community&.city} #{community&.state} />"
102
102
  end
103
103
 
104
104
  private
@@ -76,7 +76,8 @@ module FCC
76
76
  records.keys.map do |call|
77
77
  RecordDelegate.new(ExtendedInfo.new(@service).find(call))
78
78
  end.select { |f| f.status.upcase == "LIC" }
79
- rescue
79
+ rescue Exception => e
80
+ FCC.log "Error: #{e.message}"
80
81
  []
81
82
  end
82
83
  end
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FCC
4
- VERSION = '1.4.4'
4
+ VERSION = '1.4.6'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fcc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.4
4
+ version: 1.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Keen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-20 00:00:00.000000000 Z
11
+ date: 2024-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -186,7 +186,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
186
186
  requirements:
187
187
  - - ">="
188
188
  - !ruby/object:Gem::Version
189
- version: '0'
189
+ version: '2.7'
190
190
  required_rubygems_version: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - ">="