torasup 0.2.0 → 0.3.1
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 +5 -5
- data/.github/workflows/build.yml +35 -0
- data/.rubocop.yml +11 -0
- data/.tool-versions +1 -0
- data/Gemfile +1 -6
- data/README.md +1 -3
- data/lib/torasup.rb +31 -16
- data/lib/torasup/configuration.rb +1 -1
- data/lib/torasup/data/pstn.yaml +63 -0
- data/lib/torasup/phone_number.rb +1 -0
- data/lib/torasup/test/helpers.rb +9 -10
- data/lib/torasup/version.rb +1 -1
- data/spec/support/custom_pstn.yaml +14 -0
- data/spec/support/pstn_spec.yaml +42 -0
- data/spec/torasup/operator_spec.rb +19 -8
- data/spec/torasup_spec.rb +2 -2
- data/torasup.gemspec +12 -12
- metadata +19 -19
- data/.ruby-version +0 -1
- data/.travis.yml +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: cedd183219513e1a11ff1bbf1c8f5be0a3592d2825ec2ceefeb1c8e0b1b91b0f
|
4
|
+
data.tar.gz: 3a0ecf5fe7762bb4641ba035cdf1a3170d0164edf83b54098e89df7f756a4523
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8d3d92f14854785d4aa03318329a8d14da730ed4477eef30eb3cf0bfb0399a20205a61d9b677c1e5b21a6ce2eade9eedb6b024c58fc0a082e77ccbe64b05c66
|
7
|
+
data.tar.gz: 3ae6e4b84fa084774d954dcfd4c80bb88b00aafeb1b30bed0908083f6dc050f1852a205eca857cedb338ea960423de5a4b086411736d5c76da6fa4cbe49ff1c5
|
@@ -0,0 +1,35 @@
|
|
1
|
+
name: Build
|
2
|
+
|
3
|
+
on: [push]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
|
10
|
+
steps:
|
11
|
+
- uses: actions/checkout@v2
|
12
|
+
|
13
|
+
- name: Set up Ruby
|
14
|
+
uses: actions/setup-ruby@v1
|
15
|
+
with:
|
16
|
+
ruby-version: 2.7.x
|
17
|
+
|
18
|
+
- name: Install Dependencies
|
19
|
+
run: |
|
20
|
+
gem install bundler
|
21
|
+
bundle install --jobs 4 --retry 3
|
22
|
+
|
23
|
+
- name: Deploy
|
24
|
+
if: github.ref == 'refs/heads/master' && !contains(github.event.commits[0].message, '[skip deploy]')
|
25
|
+
env:
|
26
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
27
|
+
GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }}
|
28
|
+
|
29
|
+
run: |
|
30
|
+
git config --global user.email "dwilkie@gmail.com"
|
31
|
+
git config --global user.name "David Wilkie"
|
32
|
+
mkdir -p ~/.gem
|
33
|
+
echo -e "---\r\n:rubygems_api_key: $GEM_HOST_API_KEY" > ~/.gem/credentials
|
34
|
+
chmod 0600 ~/.gem/credentials
|
35
|
+
bundle exec rake release
|
data/.rubocop.yml
ADDED
data/.tool-versions
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby 2.7.1
|
data/Gemfile
CHANGED
@@ -1,9 +1,4 @@
|
|
1
|
-
source
|
2
|
-
|
3
|
-
git_source(:github) do |repo_name|
|
4
|
-
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
|
5
|
-
"https://github.com/#{repo_name}.git"
|
6
|
-
end
|
1
|
+
source "https://rubygems.org"
|
7
2
|
|
8
3
|
# Specify your gem's dependencies in torasup.gemspec
|
9
4
|
gemspec
|
data/README.md
CHANGED
@@ -2,9 +2,7 @@
|
|
2
2
|
|
3
3
|
Retuns metadata about a phone number such as operator info, area code and more.
|
4
4
|
|
5
|
-
|
6
|
-
[](https://codeclimate.com/github/somleng/torasup/coverage)
|
7
|
-
[](https://codeclimate.com/github/somleng/torasup)
|
5
|
+

|
8
6
|
|
9
7
|
## Installation
|
10
8
|
|
data/lib/torasup.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
1
|
+
require "yaml"
|
2
|
+
require "phony"
|
3
|
+
require "countries"
|
4
|
+
require "deep_merge/rails_compat"
|
5
5
|
|
6
6
|
require "torasup/version"
|
7
7
|
require "torasup/configuration"
|
@@ -10,12 +10,16 @@ require "torasup/operator"
|
|
10
10
|
require "torasup/location"
|
11
11
|
|
12
12
|
module Torasup
|
13
|
+
ALL_PREFIXES_KEYS = ["*", "all"].freeze
|
14
|
+
DEFAULT_OPERATOR_PREFIX_MIN = "10".freeze
|
15
|
+
DEFAULT_OPERATOR_PREFIX_MAX = "99".freeze
|
16
|
+
|
13
17
|
module Test
|
14
|
-
autoload :Helpers,
|
18
|
+
autoload :Helpers, "torasup/test/helpers"
|
15
19
|
end
|
16
20
|
|
17
21
|
class << self
|
18
|
-
def configure
|
22
|
+
def configure
|
19
23
|
yield(configuration)
|
20
24
|
end
|
21
25
|
|
@@ -23,12 +27,14 @@ module Torasup
|
|
23
27
|
@international_dialing_codes = {}
|
24
28
|
ISO3166::Country.all.each do |country|
|
25
29
|
dialing_code = country.country_code
|
26
|
-
|
30
|
+
if !@international_dialing_codes[dialing_code] || configuration.default_countries.include?(country.alpha2)
|
31
|
+
@international_dialing_codes[dialing_code] = country.alpha2
|
32
|
+
end
|
27
33
|
end
|
28
34
|
end
|
29
35
|
|
30
36
|
def load_pstn_data!
|
31
|
-
@pstn_data = load_yaml_file(File.join(File.dirname(__FILE__),
|
37
|
+
@pstn_data = load_yaml_file(File.join(File.dirname(__FILE__), "torasup/data/pstn.yaml"))
|
32
38
|
configuration.custom_pstn_data_files.compact.each do |pstn_data_file|
|
33
39
|
@pstn_data.deeper_merge!(
|
34
40
|
load_yaml_file(pstn_data_file)
|
@@ -38,7 +44,7 @@ module Torasup
|
|
38
44
|
end
|
39
45
|
|
40
46
|
def country_id(country_code)
|
41
|
-
@international_dialing_codes[country_code]
|
47
|
+
@international_dialing_codes[country_code]&.downcase
|
42
48
|
end
|
43
49
|
|
44
50
|
def area_code(country_id, code)
|
@@ -76,7 +82,9 @@ module Torasup
|
|
76
82
|
).merge(prefix_data)
|
77
83
|
|
78
84
|
@pstn_prefixes[operator_prefix] = prefix_properties
|
79
|
-
|
85
|
+
if operator_registered?(country_id, operator)
|
86
|
+
@registered_pstn_prefixes[operator_prefix] = prefix_properties
|
87
|
+
end
|
80
88
|
end
|
81
89
|
end
|
82
90
|
end
|
@@ -115,7 +123,7 @@ module Torasup
|
|
115
123
|
end
|
116
124
|
|
117
125
|
def operator_metadata(country_id, operator)
|
118
|
-
{"country_id" => country_id, "id" => operator}.merge(operator_data(country_id, operator)["metadata"] || {})
|
126
|
+
{ "country_id" => country_id, "id" => operator }.merge(operator_data(country_id, operator)["metadata"] || {})
|
119
127
|
end
|
120
128
|
|
121
129
|
def operator_area_code_prefixes(country_id, operator)
|
@@ -125,7 +133,7 @@ module Torasup
|
|
125
133
|
def prefix_defaults(country_properties, operator_properties, prefix_properties)
|
126
134
|
defaults = {}
|
127
135
|
prefix_type = prefix_properties["type"]
|
128
|
-
[
|
136
|
+
%i[min max pattern].each do |prefix_key|
|
129
137
|
result_key = "subscriber_number_#{prefix_key}"
|
130
138
|
default_key = "default_#{prefix_type}_#{result_key}"
|
131
139
|
result_value = prefix_properties[result_key] || operator_properties[default_key] || country_properties[default_key]
|
@@ -137,11 +145,18 @@ module Torasup
|
|
137
145
|
def operator_mobile_prefixes(country_id, operator)
|
138
146
|
full_prefixes = {}
|
139
147
|
operator_data = operator_data(country_id, operator)
|
140
|
-
|
148
|
+
if operator_data["prefixes"].is_a?(String) && ALL_PREFIXES_KEYS.include?(operator_data["prefixes"])
|
149
|
+
operator_prefix_min = country_data(country_id).fetch("operator_prefix_min", DEFAULT_OPERATOR_PREFIX_MIN)
|
150
|
+
operator_prefix_max = country_data(country_id).fetch("operator_prefix_max", DEFAULT_OPERATOR_PREFIX_MAX)
|
151
|
+
prefixes = (operator_prefix_min.to_s..operator_prefix_max).to_a
|
152
|
+
end
|
153
|
+
prefixes ||= operator_data["prefixes"]
|
154
|
+
prefixes ||= []
|
155
|
+
mobile_prefixes = array_to_hash(prefixes)
|
141
156
|
mobile_prefixes.each do |mobile_prefix, prefix_metadata|
|
142
157
|
full_prefixes[operator_full_prefix(country_id, mobile_prefix)] = {
|
143
158
|
"type" => "mobile",
|
144
|
-
"prefix" => mobile_prefix
|
159
|
+
"prefix" => mobile_prefix
|
145
160
|
}.merge(prefix_metadata)
|
146
161
|
end
|
147
162
|
full_prefixes
|
@@ -155,7 +170,7 @@ module Torasup
|
|
155
170
|
operator_prefixes = operator_mobile_prefixes(country_id, operator)
|
156
171
|
area_code_prefixes = array_to_hash(operator_area_code_prefixes(country_id, operator))
|
157
172
|
area_code_prefixes.each do |operator_area_code_prefix, prefix_metadata|
|
158
|
-
area_codes(country_id).each do |area_code,
|
173
|
+
area_codes(country_id).each do |area_code, _area|
|
159
174
|
operator_prefixes[operator_full_prefix(country_id, area_code, operator_area_code_prefix)] = {
|
160
175
|
"type" => "landline",
|
161
176
|
"prefix" => operator_area_code_prefix,
|
@@ -167,7 +182,7 @@ module Torasup
|
|
167
182
|
end
|
168
183
|
|
169
184
|
def array_to_hash(array)
|
170
|
-
array.map { |n| n.is_a?(Hash) ? n : {n => {}} }.reduce(
|
185
|
+
array.map { |n| n.is_a?(Hash) ? n : { n => {} } }.reduce({}, :merge)
|
171
186
|
end
|
172
187
|
end
|
173
188
|
|
data/lib/torasup/data/pstn.yaml
CHANGED
@@ -220,3 +220,66 @@ sl:
|
|
220
220
|
- '30'
|
221
221
|
- '77'
|
222
222
|
- '88'
|
223
|
+
orange:
|
224
|
+
metadata:
|
225
|
+
name: "Orange"
|
226
|
+
prefixes:
|
227
|
+
- '75'
|
228
|
+
- '76'
|
229
|
+
- '78'
|
230
|
+
- '79'
|
231
|
+
br:
|
232
|
+
# https://en.wikipedia.org/wiki/Telecommunications_in_Brazil
|
233
|
+
# https://en.wikipedia.org/wiki/List_of_mobile_network_operators_of_the_Americas#Brazil
|
234
|
+
international_dialing_code: "55"
|
235
|
+
|
236
|
+
mx:
|
237
|
+
international_dialing_code: "52"
|
238
|
+
|
239
|
+
in:
|
240
|
+
# https://en.wikipedia.org/wiki/Mobile_telephone_numbering_in_India
|
241
|
+
international_dialing_code: "91"
|
242
|
+
operator_prefix_min: "6000"
|
243
|
+
operator_prefix_max: "9999"
|
244
|
+
|
245
|
+
gh:
|
246
|
+
international_dialing_code: "233"
|
247
|
+
# https://en.m.wikipedia.org/wiki/Telephone_numbers_in_Ghana
|
248
|
+
operators:
|
249
|
+
globacom:
|
250
|
+
# https://en.wikipedia.org/wiki/Glo_(company)
|
251
|
+
metadata:
|
252
|
+
name: "Globacom"
|
253
|
+
prefixes:
|
254
|
+
- '23'
|
255
|
+
mtn:
|
256
|
+
# https://en.wikipedia.org/wiki/MTN_Group
|
257
|
+
metadata:
|
258
|
+
name: "MTN"
|
259
|
+
prefixes:
|
260
|
+
- '24'
|
261
|
+
- '54'
|
262
|
+
- '55'
|
263
|
+
- '59'
|
264
|
+
airtel_tigo:
|
265
|
+
# https://en.wikipedia.org/wiki/Airtel_Africa#Tigo_Ghana_merger
|
266
|
+
metadata:
|
267
|
+
name: "AirtelTigo"
|
268
|
+
prefixes:
|
269
|
+
- '27'
|
270
|
+
- '57'
|
271
|
+
- '26'
|
272
|
+
- '56'
|
273
|
+
expresso:
|
274
|
+
# https://en.wikipedia.org/wiki/Expresso_Telecom
|
275
|
+
metadata:
|
276
|
+
name: "Expresso"
|
277
|
+
prefixes:
|
278
|
+
- '28'
|
279
|
+
vodafone:
|
280
|
+
# https://en.wikipedia.org/wiki/Vodafone_Ghana
|
281
|
+
metadata:
|
282
|
+
name: "Vodafone"
|
283
|
+
prefixes:
|
284
|
+
- '20'
|
285
|
+
- '50'
|
data/lib/torasup/phone_number.rb
CHANGED
data/lib/torasup/test/helpers.rb
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
module Torasup
|
2
2
|
module Test
|
3
3
|
module Helpers
|
4
|
-
|
5
4
|
private
|
6
5
|
|
7
|
-
def yaml_file(
|
6
|
+
def yaml_file(_filename)
|
8
7
|
raise "Override this method to return the full path of the yaml spec"
|
9
8
|
end
|
10
9
|
|
@@ -26,17 +25,17 @@ module Torasup
|
|
26
25
|
custom_spec ? data.deeper_merge(load_yaml_file(custom_spec)) : data
|
27
26
|
end
|
28
27
|
|
29
|
-
def with_operators(options = {}
|
28
|
+
def with_operators(options = {})
|
30
29
|
operator_assertions = {}
|
31
30
|
with_pstn_data(options) do |country_id, country_data, country_prefix|
|
32
31
|
operator_assertions[country_prefix] = {}
|
33
32
|
local_number = country_data["local_number"]
|
34
|
-
default_assertions = {"country_code" => country_prefix}
|
33
|
+
default_assertions = { "country_code" => country_prefix }
|
35
34
|
with_operator_data(country_id, options) do |operator, operator_data|
|
36
35
|
default_operator_assertions = operator_data["assertions"].merge(
|
37
36
|
"country_id" => country_id, "id" => operator
|
38
37
|
).merge(default_assertions)
|
39
|
-
with_operator_area_codes(country_data, operator_data) do |area_code_prefix, area_code,
|
38
|
+
with_operator_area_codes(country_data, operator_data) do |area_code_prefix, area_code, _area|
|
40
39
|
if area_code_prefix.is_a?(Hash)
|
41
40
|
custom_local_number = area_code_prefix.values.first
|
42
41
|
area_code_prefix = area_code_prefix.keys.first
|
@@ -58,7 +57,7 @@ module Torasup
|
|
58
57
|
custom_local_number = prefix.values.first
|
59
58
|
prefix = prefix.keys.first
|
60
59
|
end
|
61
|
-
prefix_assertions =
|
60
|
+
prefix_assertions = operator_assertions[country_prefix][prefix] = {}
|
62
61
|
no_area_code_assertions = prefix_assertions[nil] = {}
|
63
62
|
|
64
63
|
custom_local_number ||= local_number
|
@@ -84,21 +83,21 @@ module Torasup
|
|
84
83
|
end
|
85
84
|
end
|
86
85
|
|
87
|
-
def with_pstn_data(options = {}
|
86
|
+
def with_pstn_data(options = {})
|
88
87
|
pstn_data(options[:with_custom_pstn_data]).each do |country_id, country_data|
|
89
88
|
next if options[:only_registered] && !options[:only_registered].include?(country_id)
|
90
89
|
yield country_id, country_data, country_data["prefix"]
|
91
90
|
end
|
92
91
|
end
|
93
92
|
|
94
|
-
def with_operator_data(country_id, options = {}
|
93
|
+
def with_operator_data(country_id, options = {})
|
95
94
|
country_data(country_id, options[:with_custom_pstn_data])["operators"].each do |operator, operator_data|
|
96
95
|
next if options[:only_registered] && !options[:only_registered][country_id].include?(operator)
|
97
96
|
yield operator, operator_data
|
98
97
|
end
|
99
98
|
end
|
100
99
|
|
101
|
-
def with_operator_area_codes(country_data, operator_data
|
100
|
+
def with_operator_area_codes(country_data, operator_data)
|
102
101
|
(operator_data["area_code_prefixes"] || {}).each do |area_code_prefix|
|
103
102
|
country_data["area_codes"].each do |area_code, area|
|
104
103
|
yield area_code_prefix, area_code, area
|
@@ -106,7 +105,7 @@ module Torasup
|
|
106
105
|
end
|
107
106
|
end
|
108
107
|
|
109
|
-
def with_operator_prefixes(operator_data
|
108
|
+
def with_operator_prefixes(operator_data)
|
110
109
|
(operator_data["prefixes"] || {}).each do |prefix|
|
111
110
|
yield prefix
|
112
111
|
end
|
data/lib/torasup/version.rb
CHANGED
data/spec/support/pstn_spec.yaml
CHANGED
@@ -187,3 +187,45 @@ sl:
|
|
187
187
|
- '30'
|
188
188
|
- '77'
|
189
189
|
- '88'
|
190
|
+
|
191
|
+
gh:
|
192
|
+
prefix: "233"
|
193
|
+
local_number: "2437103"
|
194
|
+
operators:
|
195
|
+
# https://en.m.wikipedia.org/wiki/Telephone_numbers_in_Ghana
|
196
|
+
globacom:
|
197
|
+
# https://en.wikipedia.org/wiki/Glo_(company)
|
198
|
+
assertions:
|
199
|
+
name: "Globacom"
|
200
|
+
prefixes:
|
201
|
+
- '23'
|
202
|
+
mtn:
|
203
|
+
# https://en.wikipedia.org/wiki/MTN_Group
|
204
|
+
assertions:
|
205
|
+
name: "MTN"
|
206
|
+
prefixes:
|
207
|
+
- '24'
|
208
|
+
- '54'
|
209
|
+
- '55'
|
210
|
+
airtel_tigo:
|
211
|
+
# https://en.wikipedia.org/wiki/Airtel_Africa#Tigo_Ghana_merger
|
212
|
+
assertions:
|
213
|
+
name: "AirtelTigo"
|
214
|
+
prefixes:
|
215
|
+
- '27'
|
216
|
+
- '57'
|
217
|
+
- '26'
|
218
|
+
- '56'
|
219
|
+
expresso:
|
220
|
+
# https://en.wikipedia.org/wiki/Expresso_Telecom
|
221
|
+
assertions:
|
222
|
+
name: "Expresso"
|
223
|
+
prefixes:
|
224
|
+
- '28'
|
225
|
+
vodafone:
|
226
|
+
# https://en.wikipedia.org/wiki/Vodafone_Ghana
|
227
|
+
assertions:
|
228
|
+
name: "Vodafone"
|
229
|
+
prefixes:
|
230
|
+
- '20'
|
231
|
+
- '50'
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
module Torasup
|
4
4
|
describe Operator do
|
@@ -11,7 +11,7 @@ module Torasup
|
|
11
11
|
it "should return the operators with their metadata" do
|
12
12
|
operators = Operator.send(method)
|
13
13
|
operators = Operator.send(method) # run it twice to highlight the duplication problem
|
14
|
-
with_operators do |
|
14
|
+
with_operators do |_number_parts, assertions|
|
15
15
|
operator = operators[assertions["country_id"]][assertions["id"]]
|
16
16
|
expect(operator["country_id"]).to eq(assertions["country_id"])
|
17
17
|
expect(operator["id"]).to eq(assertions["id"])
|
@@ -53,7 +53,7 @@ module Torasup
|
|
53
53
|
let(:method) { :registered }
|
54
54
|
|
55
55
|
def with_operators(&block)
|
56
|
-
super(:
|
56
|
+
super(only_registered: { sample_operator[0] => [sample_operator[1]] }, &block)
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
@@ -65,10 +65,10 @@ module Torasup
|
|
65
65
|
subject = Operator.new(*number_parts)
|
66
66
|
assertions.each do |method, assertion|
|
67
67
|
args = []
|
68
|
-
args << {:
|
68
|
+
args << { interpolation: nil } unless subject.respond_to?(method)
|
69
69
|
result = subject.send(method, *args)
|
70
70
|
result_error = result.nil? ? "nil" : "'#{result}'"
|
71
|
-
expect(result).to(eq(interpolated_assertion(assertion, :
|
71
|
+
expect(result).to(eq(interpolated_assertion(assertion, interpolation: nil)), "expected Operator.new('#{number_parts}').#{method} to return '#{assertion}' but got #{result_error}")
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|
@@ -87,14 +87,25 @@ module Torasup
|
|
87
87
|
|
88
88
|
context "with a single configuration file" do
|
89
89
|
let(:configuration_options) { {} }
|
90
|
+
let(:options) { { with_custom_pstn_data: true } }
|
90
91
|
|
91
|
-
it_should_behave_like "an operator"
|
92
|
-
|
92
|
+
it_should_behave_like "an operator"
|
93
|
+
|
94
|
+
it "handles default prefixes" do
|
95
|
+
torasup_number = Torasup::PhoneNumber.new("5582999489999")
|
96
|
+
operator = torasup_number.operator
|
97
|
+
expect(operator.id).to eq("mundivox")
|
98
|
+
end
|
99
|
+
|
100
|
+
it "handles long prefixes" do
|
101
|
+
torasup_number = Torasup::PhoneNumber.new("919560234567")
|
102
|
+
operator = torasup_number.operator
|
103
|
+
expect(operator.id).to eq("imimobile")
|
93
104
|
end
|
94
105
|
end
|
95
106
|
|
96
107
|
context "with multiple configuration files" do
|
97
|
-
let(:configuration_options) { {:
|
108
|
+
let(:configuration_options) { { multiple_files: true } }
|
98
109
|
|
99
110
|
def assert_overridden_data!
|
100
111
|
torasup_number = Torasup::PhoneNumber.new("85515234567")
|
data/spec/torasup_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe Torasup do
|
4
4
|
describe "#prefixes" do
|
@@ -6,7 +6,7 @@ describe Torasup do
|
|
6
6
|
|
7
7
|
context "metadata" do
|
8
8
|
it "should include the correct min, max and pattern values" do
|
9
|
-
with_operators do |
|
9
|
+
with_operators do |_number_parts, assertions|
|
10
10
|
prefix = assertions["country_code"].to_s + assertions["area_code"].to_s + assertions["prefix"].to_s
|
11
11
|
prefix_metadata = prefixes[prefix]
|
12
12
|
local_number = assertions["local_number"]
|
data/torasup.gemspec
CHANGED
@@ -1,29 +1,29 @@
|
|
1
|
-
|
2
|
-
lib = File.expand_path(
|
1
|
+
|
2
|
+
lib = File.expand_path("lib", __dir__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
4
|
+
require "torasup/version"
|
5
5
|
|
6
6
|
Gem::Specification.new do |gem|
|
7
7
|
gem.name = "torasup"
|
8
8
|
gem.version = Torasup::VERSION
|
9
9
|
gem.authors = ["David Wilkie"]
|
10
10
|
gem.email = ["dwilkie@gmail.com"]
|
11
|
-
gem.description =
|
12
|
-
gem.summary =
|
11
|
+
gem.description = '"Retuns metadata about a phone number such as operator, area code and more"'
|
12
|
+
gem.summary = '"Retuns metadata about a phone number such as operator, area code and more"'
|
13
13
|
gem.homepage = "https://github.com/dwilkie/torasup/"
|
14
|
-
gem.license =
|
14
|
+
gem.license = "MIT"
|
15
15
|
|
16
|
-
gem.files = `git ls-files`.split(
|
17
|
-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
16
|
+
gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
17
|
+
gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
18
18
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
19
|
gem.require_paths = ["lib"]
|
20
20
|
|
21
|
-
gem.add_runtime_dependency "countries"
|
22
|
-
gem.add_runtime_dependency "phony", '>= 2.15.47'
|
21
|
+
gem.add_runtime_dependency "countries"
|
23
22
|
gem.add_runtime_dependency "deep_merge"
|
23
|
+
gem.add_runtime_dependency "phony"
|
24
24
|
|
25
|
-
gem.add_development_dependency "
|
25
|
+
gem.add_development_dependency "codeclimate-test-reporter"
|
26
26
|
gem.add_development_dependency "rake"
|
27
|
+
gem.add_development_dependency "rspec"
|
27
28
|
gem.add_development_dependency "simplecov"
|
28
|
-
gem.add_development_dependency "codeclimate-test-reporter", "~> 1.0.0"
|
29
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: torasup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Wilkie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: countries
|
@@ -16,30 +16,30 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: deep_merge
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: phony
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: codeclimate-test-reporter
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
@@ -95,19 +95,19 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: simplecov
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: '0'
|
111
111
|
description: '"Retuns metadata about a phone number such as operator, area code and
|
112
112
|
more"'
|
113
113
|
email:
|
@@ -116,10 +116,11 @@ executables: []
|
|
116
116
|
extensions: []
|
117
117
|
extra_rdoc_files: []
|
118
118
|
files:
|
119
|
+
- ".github/workflows/build.yml"
|
119
120
|
- ".gitignore"
|
120
121
|
- ".rspec"
|
121
|
-
- ".
|
122
|
-
- ".
|
122
|
+
- ".rubocop.yml"
|
123
|
+
- ".tool-versions"
|
123
124
|
- Gemfile
|
124
125
|
- LICENSE.txt
|
125
126
|
- README.md
|
@@ -163,8 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
163
164
|
- !ruby/object:Gem::Version
|
164
165
|
version: '0'
|
165
166
|
requirements: []
|
166
|
-
|
167
|
-
rubygems_version: 2.6.13
|
167
|
+
rubygems_version: 3.1.4
|
168
168
|
signing_key:
|
169
169
|
specification_version: 4
|
170
170
|
summary: '"Retuns metadata about a phone number such as operator, area code and more"'
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.4.2
|
data/.travis.yml
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
sudo: false
|
3
|
-
env:
|
4
|
-
global:
|
5
|
-
- START_SIMPLECOV=1
|
6
|
-
addons:
|
7
|
-
code_climate:
|
8
|
-
repo_token:
|
9
|
-
secure: "Xk7T8ZyorwO85WfXC7OB2HfIM9Z/GO85u97P1qwXukL1ZjjDffr3mzhh706AVA9JPpTQGDbLNU5aStxX6NVLjBXyflvEpSGmYLl0aHDVikcNvZA/jBGlIfJH/6/V5bJA11X3V2/9FeO5l2fPkusWxbcpAIowe7xclDXfujdoNGk="
|
10
|
-
after_success:
|
11
|
-
- bundle exec codeclimate-test-reporter
|