rate_center 0.1.2
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 +7 -0
- data/.release-please-manifest.json +3 -0
- data/.rspec +3 -0
- data/.rubocop.yml +26 -0
- data/.tool-versions +1 -0
- data/CHANGELOG.md +17 -0
- data/LICENSE.txt +21 -0
- data/README.md +102 -0
- data/Rakefile +12 -0
- data/data/cities/us/ak.yml +6420 -0
- data/data/cities/us/al.yml +10684 -0
- data/data/cities/us/ar.yml +11308 -0
- data/data/cities/us/az.yml +8396 -0
- data/data/cities/us/ca.yml +30626 -0
- data/data/cities/us/co.yml +9787 -0
- data/data/cities/us/ct.yml +3388 -0
- data/data/cities/us/dc.yml +12 -0
- data/data/cities/us/de.yml +1424 -0
- data/data/cities/us/fl.yml +17198 -0
- data/data/cities/us/ga.yml +12062 -0
- data/data/cities/us/hi.yml +2846 -0
- data/data/cities/us/ia.yml +18822 -0
- data/data/cities/us/id.yml +4324 -0
- data/data/cities/us/il.yml +27206 -0
- data/data/cities/us/in.yml +17594 -0
- data/data/cities/us/ks.yml +13626 -0
- data/data/cities/us/ky.yml +9958 -0
- data/data/cities/us/la.yml +8786 -0
- data/data/cities/us/ma.yml +2288 -0
- data/data/cities/us/md.yml +10738 -0
- data/data/cities/us/me.yml +1194 -0
- data/data/cities/us/mi.yml +13662 -0
- data/data/cities/us/mn.yml +16378 -0
- data/data/cities/us/mo.yml +21572 -0
- data/data/cities/us/ms.yml +7762 -0
- data/data/cities/us/mt.yml +9032 -0
- data/data/cities/us/nc.yml +14140 -0
- data/data/cities/us/nd.yml +7300 -0
- data/data/cities/us/ne.yml +10622 -0
- data/data/cities/us/nh.yml +740 -0
- data/data/cities/us/nj.yml +11848 -0
- data/data/cities/us/nm.yml +9352 -0
- data/data/cities/us/nv.yml +2652 -0
- data/data/cities/us/ny.yml +17946 -0
- data/data/cities/us/oh.yml +22704 -0
- data/data/cities/us/ok.yml +15154 -0
- data/data/cities/us/or.yml +7680 -0
- data/data/cities/us/pa.yml +32546 -0
- data/data/cities/us/pr.yml +5121 -0
- data/data/cities/us/ri.yml +560 -0
- data/data/cities/us/sc.yml +8768 -0
- data/data/cities/us/sd.yml +8768 -0
- data/data/cities/us/tn.yml +9404 -0
- data/data/cities/us/tx.yml +36996 -0
- data/data/cities/us/ut.yml +6308 -0
- data/data/cities/us/va.yml +12194 -0
- data/data/cities/us/vt.yml +1910 -0
- data/data/cities/us/wa.yml +11900 -0
- data/data/cities/us/wi.yml +14564 -0
- data/data/cities/us/wv.yml +7984 -0
- data/data/cities/us/wy.yml +3674 -0
- data/data/rate_centers/us/.keep +0 -0
- data/data/rate_centers/us/ak.yml +4584 -0
- data/data/rate_centers/us/al.yml +9798 -0
- data/data/rate_centers/us/ar.yml +15882 -0
- data/data/rate_centers/us/as.yml +119 -0
- data/data/rate_centers/us/az.yml +4159 -0
- data/data/rate_centers/us/ca.yml +21059 -0
- data/data/rate_centers/us/co.yml +6502 -0
- data/data/rate_centers/us/ct.yml +4086 -0
- data/data/rate_centers/us/dc.yml +16 -0
- data/data/rate_centers/us/de.yml +1133 -0
- data/data/rate_centers/us/fl.yml +10773 -0
- data/data/rate_centers/us/ga.yml +10143 -0
- data/data/rate_centers/us/gu.yml +218 -0
- data/data/rate_centers/us/hi.yml +1130 -0
- data/data/rate_centers/us/ia.yml +15438 -0
- data/data/rate_centers/us/id.yml +4357 -0
- data/data/rate_centers/us/il.yml +25322 -0
- data/data/rate_centers/us/in.yml +13924 -0
- data/data/rate_centers/us/ks.yml +12312 -0
- data/data/rate_centers/us/ky.yml +18629 -0
- data/data/rate_centers/us/la.yml +7785 -0
- data/data/rate_centers/us/ma.yml +7947 -0
- data/data/rate_centers/us/md.yml +6956 -0
- data/data/rate_centers/us/me.yml +9213 -0
- data/data/rate_centers/us/mi.yml +15653 -0
- data/data/rate_centers/us/mn.yml +15195 -0
- data/data/rate_centers/us/mo.yml +18238 -0
- data/data/rate_centers/us/mp.yml +29 -0
- data/data/rate_centers/us/ms.yml +7913 -0
- data/data/rate_centers/us/mt.yml +5659 -0
- data/data/rate_centers/us/nc.yml +11641 -0
- data/data/rate_centers/us/nd.yml +7341 -0
- data/data/rate_centers/us/ne.yml +8727 -0
- data/data/rate_centers/us/nh.yml +4499 -0
- data/data/rate_centers/us/nj.yml +13710 -0
- data/data/rate_centers/us/nm.yml +4636 -0
- data/data/rate_centers/us/nv.yml +2629 -0
- data/data/rate_centers/us/ny.yml +34576 -0
- data/data/rate_centers/us/oh.yml +20184 -0
- data/data/rate_centers/us/ok.yml +9970 -0
- data/data/rate_centers/us/or.yml +6867 -0
- data/data/rate_centers/us/pa.yml +40360 -0
- data/data/rate_centers/us/pr.yml +1899 -0
- data/data/rate_centers/us/ri.yml +1225 -0
- data/data/rate_centers/us/sc.yml +6251 -0
- data/data/rate_centers/us/sd.yml +6256 -0
- data/data/rate_centers/us/tn.yml +9289 -0
- data/data/rate_centers/us/tx.yml +27690 -0
- data/data/rate_centers/us/ut.yml +4712 -0
- data/data/rate_centers/us/va.yml +17679 -0
- data/data/rate_centers/us/vi.yml +146 -0
- data/data/rate_centers/us/vt.yml +4667 -0
- data/data/rate_centers/us/wa.yml +8151 -0
- data/data/rate_centers/us/wi.yml +12872 -0
- data/data/rate_centers/us/wv.yml +14818 -0
- data/data/rate_centers/us/wy.yml +2852 -0
- data/lib/rate_center/city.rb +33 -0
- data/lib/rate_center/collection.rb +23 -0
- data/lib/rate_center/data_loader.rb +75 -0
- data/lib/rate_center/data_prep.rb +121 -0
- data/lib/rate_center/data_source/local_calling_guide.rb +107 -0
- data/lib/rate_center/data_source/simple_maps.rb +93 -0
- data/lib/rate_center/distance.rb +3 -0
- data/lib/rate_center/errors.rb +6 -0
- data/lib/rate_center/rate_center.rb +34 -0
- data/lib/rate_center/vector.rb +3 -0
- data/lib/rate_center/version.rb +5 -0
- data/lib/rate_center.rb +21 -0
- data/release-please-config.json +15 -0
- metadata +400 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 9db3ac1a24873d160945edd60490f3af04715c4858f232a73c408cd48783a5d3
|
|
4
|
+
data.tar.gz: 8223be2c58e26f85eab8c48f7e688184ad328718a5227295dfcfe143522c3bed
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: d27eec5024e6119026e587230de98ae8fafa0312bae05809c39d7a937163595babaa0fdf8bbf112a527c334dcae6c89e6df0be61b3fd98552f35a3d437630d62
|
|
7
|
+
data.tar.gz: 7e1e1fa432a40960500f0d45a4322300a533bc43b5997a976297ee244988c52b887d04149676398839f9e26cc0431612337a89fb69c2ecfaa0da4c45328e717b
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
require:
|
|
2
|
+
- rubocop-rspec
|
|
3
|
+
- rubocop-performance
|
|
4
|
+
|
|
5
|
+
# Omakase Ruby styling for Rails
|
|
6
|
+
inherit_gem:
|
|
7
|
+
rubocop-rails-omakase: rubocop.yml
|
|
8
|
+
|
|
9
|
+
AllCops:
|
|
10
|
+
NewCops: enable
|
|
11
|
+
TargetRubyVersion: 3.3
|
|
12
|
+
|
|
13
|
+
Lint:
|
|
14
|
+
Enabled: true
|
|
15
|
+
|
|
16
|
+
Style/FrozenStringLiteralComment:
|
|
17
|
+
Enabled: false
|
|
18
|
+
|
|
19
|
+
RSpec/DescribedClass:
|
|
20
|
+
Enabled: false
|
|
21
|
+
|
|
22
|
+
RSpec/ExampleLength:
|
|
23
|
+
Enabled: false
|
|
24
|
+
|
|
25
|
+
RSpec/MultipleExpectations:
|
|
26
|
+
Enabled: false
|
data/.tool-versions
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ruby 3.3.5
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.1.2](https://github.com/somleng/rate_center/compare/v0.1.1...v0.1.2) (2024-10-05)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* Gemspec ([#9](https://github.com/somleng/rate_center/issues/9)) ([9f3a313](https://github.com/somleng/rate_center/commit/9f3a3138f005523c48b98ec64c827f73f67e25d1))
|
|
9
|
+
|
|
10
|
+
## [0.1.1](https://github.com/somleng/rate_center/compare/v0.1.0...v0.1.1) (2024-10-05)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* Test Deploy ([#8](https://github.com/somleng/rate_center/issues/8)) ([8fa90ac](https://github.com/somleng/rate_center/commit/8fa90ace1d9cf4aa9be8a8ef98c2cb93712f13ca))
|
|
16
|
+
* Test release ([#7](https://github.com/somleng/rate_center/issues/7)) ([ddc802d](https://github.com/somleng/rate_center/commit/ddc802d9bb2e3b5c3d4ce69774ec34d850837474))
|
|
17
|
+
* test release 2 ([#3](https://github.com/somleng/rate_center/issues/3)) ([4ca433a](https://github.com/somleng/rate_center/commit/4ca433a4ddeb936899969e2ac146a200ca3cef5b))
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 David Wilkie
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# RateCenter
|
|
2
|
+
|
|
3
|
+
[](https://github.com/somleng/rate_center/actions/workflows/main.yml)
|
|
4
|
+
|
|
5
|
+
A collection of useful data about [NANPA Rate Centers](https://en.wikipedia.org/wiki/Rate_center).
|
|
6
|
+
|
|
7
|
+
Data is currently sourced from [Simple Maps](https://simplemaps.com/data/us-cities) and [Local Calling Guide](https://localcallingguide.com/).
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
Install the gem and add to the application's Gemfile by executing:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
bundle add rate_centers
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
gem install rate_centers
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
### Working with Rate Centers
|
|
26
|
+
|
|
27
|
+
```rb
|
|
28
|
+
# Load rate centers
|
|
29
|
+
RateCenter.load(:rate_centers, only: { us: [:ny, :ca] }) # Loads rate centers in New York and California
|
|
30
|
+
# RateCenter.load(:rate_centers, only: { us: { ny: [ "NWYRCYZN01" ], ca: [ "LSAN DA 01"] } }) # Loads only specific rate centers
|
|
31
|
+
# RateCenter.load(:rate_centers, only: { [ :us ] }) # Load all rate centers in US
|
|
32
|
+
# RateCenter.load(:rate_centers, :all) # Load all rate centers
|
|
33
|
+
|
|
34
|
+
# RateCenter::RateCenter.all # returns all rate centers loaded
|
|
35
|
+
|
|
36
|
+
rate_center = RateCenter::RateCenter.find_by!(country: "US", region: "NY", name: "NWYRCYZN01")
|
|
37
|
+
rate_center.full_name # "New York City Zone 01"
|
|
38
|
+
rate_center.lata # 132
|
|
39
|
+
rate_center.ilec_name # "VERIZON NEW YORK, INC."
|
|
40
|
+
rate_center.lat # "40.739362"
|
|
41
|
+
rate_center.long # "-73.991043"
|
|
42
|
+
rate_center.closest_city.name # "Manhattan"
|
|
43
|
+
rate_center.closest_city.distance.value # 5.33
|
|
44
|
+
rate_center.closest_city.distance.units # km
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Working with Cities
|
|
48
|
+
|
|
49
|
+
```rb
|
|
50
|
+
# Load cities
|
|
51
|
+
RateCenter.load(:cities, only: { us: [:ny, :ca] }) # Loads cities in New York and California
|
|
52
|
+
# RateCenter.load(:cities, only: { us: { ny: [ "New York" ], ca: [ "Los Angeles"] } }) # Loads only specific cities
|
|
53
|
+
# RateCenter.load(:cities, only: { [ :us ] }) # Load all cities in US
|
|
54
|
+
# RateCenter.load(:cities, :all) # Load all cities
|
|
55
|
+
|
|
56
|
+
# RateCenter::City.all # returns all cities loaded
|
|
57
|
+
|
|
58
|
+
city = RateCenter::City.find_by!(country: "US", region: "NY", name: "New York")
|
|
59
|
+
city.lat # "40.6943"
|
|
60
|
+
city.log # "-73.9249"
|
|
61
|
+
city.nearby_rate_centers.each do |rate_center|
|
|
62
|
+
puts "Rate Center: #{rate_center.name}, Distance: #{rate_center.distance.value} #{rate_center.distance.units}"
|
|
63
|
+
end
|
|
64
|
+
# Rate Center: NWYRCYZN14, Distance: 7.5 km
|
|
65
|
+
# Rate Center: NWYRCYZN15, Distance: 7.5 km
|
|
66
|
+
# Rate Center: NWYRCYZN11, Distance: 7.5 km
|
|
67
|
+
# Rate Center: NWYRCYZN10, Distance: 7.5 km
|
|
68
|
+
# Rate Center: NWYRCYZN13, Distance: 7.5 km
|
|
69
|
+
# Rate Center: NWYRCYZN09, Distance: 7.5 km
|
|
70
|
+
# Rate Center: NWYRCYZN08, Distance: 7.5 km
|
|
71
|
+
# Rate Center: NWYRCYZN07, Distance: 7.5 km
|
|
72
|
+
# Rate Center: NWYRCYZN06, Distance: 7.5 km
|
|
73
|
+
# Rate Center: NWYRCYZN05, Distance: 7.5 km
|
|
74
|
+
# Rate Center: NWYRCYZN12, Distance: 7.5 km
|
|
75
|
+
# Rate Center: NWYRCYZN04, Distance: 7.5 km
|
|
76
|
+
# Rate Center: NWYRCYZN03, Distance: 7.5 km
|
|
77
|
+
# Rate Center: NWYRCYZN01, Distance: 7.5 km
|
|
78
|
+
# Rate Center: NASSAUZN02, Distance: 18.96 km
|
|
79
|
+
# Rate Center: NASSAUZN03, Distance: 20.16 km
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Updating Data
|
|
83
|
+
|
|
84
|
+
In order to pull data from the sources, run the following script
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
bin/update_data
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Development
|
|
91
|
+
|
|
92
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
93
|
+
|
|
94
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
|
95
|
+
|
|
96
|
+
## Contributing
|
|
97
|
+
|
|
98
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/somleng/rate_center.
|
|
99
|
+
|
|
100
|
+
## License
|
|
101
|
+
|
|
102
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|