rate_center 0.1.2 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.release-please-manifest.json +1 -1
- data/CHANGELOG.md +14 -0
- data/README.md +14 -15
- data/data/cities/us/ak.yml +1077 -3221
- data/data/cities/us/al.yml +1790 -5358
- data/data/cities/us/ar.yml +1892 -5712
- data/data/cities/us/az.yml +1422 -4236
- data/data/cities/us/ca.yml +5539 -16077
- data/data/cities/us/co.yml +2019 -5477
- data/data/cities/us/ct.yml +576 -1714
- data/data/cities/us/dc.yml +1 -3
- data/data/cities/us/de.yml +237 -711
- data/data/cities/us/fl.yml +2904 -8670
- data/data/cities/us/ga.yml +2010 -6030
- data/data/cities/us/hi.yml +474 -1422
- data/data/cities/us/ia.yml +3095 -9585
- data/data/cities/us/id.yml +726 -2178
- data/data/cities/us/il.yml +4724 -13974
- data/data/cities/us/in.yml +2955 -8835
- data/data/cities/us/ks.yml +2384 -6982
- data/data/cities/us/ky.yml +1665 -4987
- data/data/cities/us/la.yml +1464 -4392
- data/data/cities/us/ma.yml +381 -1143
- data/data/cities/us/md.yml +2087 -5859
- data/data/cities/us/me.yml +200 -598
- data/data/cities/us/mi.yml +2294 -6954
- data/data/cities/us/mn.yml +2730 -8232
- data/data/cities/us/mo.yml +4292 -11840
- data/data/cities/us/ms.yml +1316 -3918
- data/data/cities/us/mt.yml +1485 -4575
- data/data/cities/us/nc.yml +2401 -7169
- data/data/cities/us/nd.yml +1217 -3685
- data/data/cities/us/ne.yml +1770 -5310
- data/data/cities/us/nh.yml +123 -369
- data/data/cities/us/nj.yml +1984 -5942
- data/data/cities/us/nm.yml +1557 -4671
- data/data/cities/us/nv.yml +511 -1437
- data/data/cities/us/ny.yml +3107 -9163
- data/data/cities/us/oh.yml +3802 -11404
- data/data/cities/us/ok.yml +2548 -7610
- data/data/cities/us/or.yml +1287 -3851
- data/data/cities/us/pa.yml +5564 -16534
- data/data/cities/us/pr.yml +843 -2529
- data/data/cities/us/ri.yml +93 -279
- data/data/cities/us/sc.yml +1474 -4482
- data/data/cities/us/sd.yml +1466 -4412
- data/data/cities/us/tn.yml +1700 -4898
- data/data/cities/us/tx.yml +7453 -20437
- data/data/cities/us/ut.yml +1144 -3304
- data/data/cities/us/va.yml +2071 -6175
- data/data/cities/us/vt.yml +318 -954
- data/data/cities/us/wa.yml +2088 -6138
- data/data/cities/us/wi.yml +2489 -7407
- data/data/cities/us/wv.yml +1355 -4029
- data/data/cities/us/wy.yml +612 -1836
- data/data/rate_centers/us/ak.yml +254 -762
- data/data/rate_centers/us/al.yml +517 -1145
- data/data/rate_centers/us/ar.yml +824 -1620
- data/data/rate_centers/us/az.yml +160 -480
- data/data/rate_centers/us/ca.yml +763 -2273
- data/data/rate_centers/us/co.yml +245 -699
- data/data/rate_centers/us/ct.yml +198 -388
- data/data/rate_centers/us/dc.yml +1 -3
- data/data/rate_centers/us/de.yml +30 -90
- data/data/rate_centers/us/fl.yml +299 -885
- data/data/rate_centers/us/ga.yml +386 -1134
- data/data/rate_centers/us/hi.yml +6 -18
- data/data/rate_centers/us/ia.yml +822 -2716
- data/data/rate_centers/us/id.yml +177 -545
- data/data/rate_centers/us/il.yml +1094 -3164
- data/data/rate_centers/us/in.yml +699 -1757
- data/data/rate_centers/us/ks.yml +641 -1875
- data/data/rate_centers/us/ky.yml +384 -1128
- data/data/rate_centers/us/la.yml +312 -880
- data/data/rate_centers/us/ma.yml +267 -799
- data/data/rate_centers/us/md.yml +210 -558
- data/data/rate_centers/us/me.yml +251 -753
- data/data/rate_centers/us/mi.yml +755 -2093
- data/data/rate_centers/us/mn.yml +669 -2023
- data/data/rate_centers/us/mo.yml +1362 -3020
- data/data/rate_centers/us/ms.yml +253 -739
- data/data/rate_centers/us/mt.yml +260 -934
- data/data/rate_centers/us/nc.yml +930 -1826
- data/data/rate_centers/us/nd.yml +311 -957
- data/data/rate_centers/us/ne.yml +486 -1420
- data/data/rate_centers/us/nh.yml +156 -450
- data/data/rate_centers/us/nj.yml +358 -776
- data/data/rate_centers/us/nm.yml +163 -489
- data/data/rate_centers/us/nv.yml +115 -327
- data/data/rate_centers/us/ny.yml +843 -2303
- data/data/rate_centers/us/oh.yml +1107 -2623
- data/data/rate_centers/us/ok.yml +537 -1601
- data/data/rate_centers/us/or.yml +266 -798
- data/data/rate_centers/us/pa.yml +1346 -2914
- data/data/rate_centers/us/pr.yml +86 -254
- data/data/rate_centers/us/ri.yml +29 -79
- data/data/rate_centers/us/sc.yml +296 -854
- data/data/rate_centers/us/sd.yml +278 -844
- data/data/rate_centers/us/tn.yml +408 -1124
- data/data/rate_centers/us/tx.yml +1761 -4639
- data/data/rate_centers/us/ut.yml +154 -454
- data/data/rate_centers/us/va.yml +610 -1352
- data/data/rate_centers/us/vt.yml +141 -423
- data/data/rate_centers/us/wa.yml +296 -888
- data/data/rate_centers/us/wi.yml +888 -2106
- data/data/rate_centers/us/wv.yml +229 -687
- data/data/rate_centers/us/wy.yml +95 -281
- data/lib/rate_center/city.rb +3 -4
- data/lib/rate_center/data_prep.rb +3 -9
- data/lib/rate_center/data_source/local_calling_guide.rb +1 -1
- data/lib/rate_center/distance.rb +1 -1
- data/lib/rate_center/rate_center.rb +3 -4
- data/lib/rate_center/version.rb +1 -1
- metadata +2 -3
- data/lib/rate_center/vector.rb +0 -3
data/lib/rate_center/city.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
|
2
2
|
require "ostruct"
|
3
3
|
require_relative "collection"
|
4
|
-
require_relative "vector"
|
5
4
|
require_relative "distance"
|
6
5
|
|
7
6
|
module RateCenter
|
@@ -19,10 +18,10 @@ module RateCenter
|
|
19
18
|
data.map do |data|
|
20
19
|
city = new(**data)
|
21
20
|
city.nearby_rate_centers = Array(data["nearby_rate_centers"]).map do |rate_center|
|
22
|
-
|
23
|
-
|
21
|
+
distance_km = rate_center.fetch("distance_km")
|
22
|
+
Distance.new(
|
24
23
|
name: rate_center.fetch("name"),
|
25
|
-
|
24
|
+
distance_km:
|
26
25
|
)
|
27
26
|
end
|
28
27
|
city
|
@@ -32,10 +32,7 @@ module RateCenter
|
|
32
32
|
|
33
33
|
rate_center["closest_city"] = {
|
34
34
|
"name" => closest_city.name,
|
35
|
-
"
|
36
|
-
"value" => closest_city.distance.round(2),
|
37
|
-
"units" => "km"
|
38
|
-
}
|
35
|
+
"distance_km" => closest_city.distance.round(2)
|
39
36
|
}
|
40
37
|
end
|
41
38
|
end
|
@@ -66,10 +63,7 @@ module RateCenter
|
|
66
63
|
city["nearby_rate_centers"] = nearby_rate_centers.map do |rate_center|
|
67
64
|
{
|
68
65
|
"name" => rate_center.name,
|
69
|
-
"
|
70
|
-
"value" => rate_center.distance.round(2),
|
71
|
-
"units" => "km"
|
72
|
-
}
|
66
|
+
"distance_km" => rate_center.distance.round(2)
|
73
67
|
}
|
74
68
|
end
|
75
69
|
end
|
@@ -92,7 +86,7 @@ module RateCenter
|
|
92
86
|
)
|
93
87
|
end
|
94
88
|
|
95
|
-
distances_to.sort_by
|
89
|
+
distances_to.sort_by { |e| [ e.distance, e.name ] }
|
96
90
|
end
|
97
91
|
|
98
92
|
def write_data(type, country, data)
|
@@ -84,7 +84,7 @@ module RateCenter
|
|
84
84
|
"country" => "US",
|
85
85
|
"region" => region,
|
86
86
|
"exchange" => rate_center.exch,
|
87
|
-
"name" => rate_center.rcshort || rate_center.rc,
|
87
|
+
"name" => (rate_center.rcshort || rate_center.rc).strip.upcase,
|
88
88
|
"full_name" => rate_center.rc,
|
89
89
|
"lata" => rate_center.lata,
|
90
90
|
"ilec_name" => rate_center.ilec_name,
|
data/lib/rate_center/distance.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require "ostruct"
|
2
2
|
require_relative "collection"
|
3
|
-
require_relative "vector"
|
4
3
|
require_relative "distance"
|
5
4
|
|
6
5
|
module RateCenter
|
@@ -20,10 +19,10 @@ module RateCenter
|
|
20
19
|
closest_city = data["closest_city"]
|
21
20
|
next rate_center if closest_city.nil?
|
22
21
|
|
23
|
-
|
24
|
-
rate_center.closest_city =
|
22
|
+
distance_km = closest_city.fetch("distance_km")
|
23
|
+
rate_center.closest_city = Distance.new(
|
25
24
|
name: closest_city.fetch("name"),
|
26
|
-
|
25
|
+
distance_km:
|
27
26
|
)
|
28
27
|
|
29
28
|
rate_center
|
data/lib/rate_center/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rate_center
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Wilkie
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-10-
|
11
|
+
date: 2024-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_xml
|
@@ -368,7 +368,6 @@ files:
|
|
368
368
|
- lib/rate_center/distance.rb
|
369
369
|
- lib/rate_center/errors.rb
|
370
370
|
- lib/rate_center/rate_center.rb
|
371
|
-
- lib/rate_center/vector.rb
|
372
371
|
- lib/rate_center/version.rb
|
373
372
|
- release-please-config.json
|
374
373
|
homepage: https://github.com/somleng/rate_center
|
data/lib/rate_center/vector.rb
DELETED