fcc 1.4.5 → 1.4.6

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
  SHA256:
3
- metadata.gz: 3523585dc37f881c1a11d0d6498f4cb6822b17d46622c87fa2c8e4bda152504e
4
- data.tar.gz: 94e813ca0dea28c4135153e83a81fe6c5e6d337ba276588db7e2f5268e093ce1
3
+ metadata.gz: 3b1badea4f71c71fca305a42faf33d81b8d3bd790f2e3c6ffd06093887345608
4
+ data.tar.gz: ce292f11199f0415ebf887d25b51accd79d0531b9189f1c941e236e4ea5c80bc
5
5
  SHA512:
6
- metadata.gz: dbdb4ad161008c9e0017dcf7cfb8e2ca302ccb68d23eb6f7bf6e254c6afcef993705296cf8da2db6a6a44b6e1f421cc2f9fc0fd3499a0f958295c27e53c4de2a
7
- data.tar.gz: 0a257e7b264bded09d12a1fd41787b6c687da7998b8906b6407db4f6331b875181f4e95c86eb4d36097455768ed66d896942ed7ffdd0009221d58abf647b3c36
6
+ metadata.gz: 6f79be5bcddfc7001c7be7c6ef0e64e26acc7e59ae773aaacebea28d9627febe56ab8fecb85a0a1ccda7277b3373999d9ffd5cc2263492e688218c597235e836
7
+ data.tar.gz: b2280ae8d3dbdaacf447f5cbe880c9220a41b92ef22d2459bf850cfc238c370b58aa921d76d4977f6b4506d744dfff308de92a43827e79e54ad102ef2ae4eafc
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
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
+
3
10
  ## [1.4.5](https://github.com/jkeen/fcc/compare/v1.4.4...v1.4.5) (2024-03-20)
4
11
 
5
12
  ## [1.4.4](https://github.com/jkeen/fcc/compare/v1.4.3...v1.4.4) (2024-03-20)
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)
@@ -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.5'
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.5
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