localcallingguide 0.0.1.pre → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.codeclimate.yml +23 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +5 -0
- data/.rubocop_todo.yml +103 -0
- data/.travis.yml +4 -1
- data/README.md +4 -1
- data/lib/localcallingguide.rb +24 -22
- data/lib/localcallingguide/version.rb +1 -1
- data/localcallingguide.gemspec +6 -5
- metadata +26 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ee7376947a601fb44449f0c459fe8d23a36b69aa90dc92e52bbf51d9075d97e2
|
4
|
+
data.tar.gz: dda4c6833cc420f3aed1fc72d311fcf7be4dd518e2390a4bd2f5433a335a06b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df93d1e008c312da5526e4c96d21554859721c952653d1f39524c99962d4659d54d6b5281bf74a7a770ef8d8e3d0dc8b6fc72977026ba6610c97531990fc45ca
|
7
|
+
data.tar.gz: ce1b2178864a2794b58835735c7edc95b5089c5fd2a263653f806026c31fb4348ac531eaa5fed38dbb3260a84f39646498185a8042a20b2429705c716f601a34
|
data/.codeclimate.yml
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
---
|
2
|
+
engines:
|
3
|
+
duplication:
|
4
|
+
enabled: true
|
5
|
+
config:
|
6
|
+
languages:
|
7
|
+
- ruby
|
8
|
+
- javascript
|
9
|
+
fixme:
|
10
|
+
enabled: true
|
11
|
+
rubocop:
|
12
|
+
enabled: true
|
13
|
+
ratings:
|
14
|
+
paths:
|
15
|
+
- "**.inc"
|
16
|
+
- "**.js"
|
17
|
+
- "**.jsx"
|
18
|
+
- "**.module"
|
19
|
+
- "**.php"
|
20
|
+
- "**.py"
|
21
|
+
- "**.rb"
|
22
|
+
exclude_paths:
|
23
|
+
- test/
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2016-06-09 13:26:57 -0400 using RuboCop version 0.34.0.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 19
|
10
|
+
# Configuration parameters: AllowURI, URISchemes.
|
11
|
+
Metrics/LineLength:
|
12
|
+
Max: 257
|
13
|
+
|
14
|
+
# Offense count: 1
|
15
|
+
# Cop supports --auto-correct.
|
16
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
17
|
+
Style/BracesAroundHashParameters:
|
18
|
+
Exclude:
|
19
|
+
- 'lib/localcallingguide.rb'
|
20
|
+
|
21
|
+
# Offense count: 8
|
22
|
+
Style/Documentation:
|
23
|
+
Exclude:
|
24
|
+
- 'lib/localcallingguide.rb'
|
25
|
+
- 'lib/localcallingguide/version.rb'
|
26
|
+
- 'test/localcallingguide_test.rb'
|
27
|
+
|
28
|
+
# Offense count: 1
|
29
|
+
# Cop supports --auto-correct.
|
30
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
31
|
+
Style/EmptyLinesAroundClassBody:
|
32
|
+
Exclude:
|
33
|
+
- 'test/localcallingguide_test.rb'
|
34
|
+
|
35
|
+
# Offense count: 2
|
36
|
+
# Cop supports --auto-correct.
|
37
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
38
|
+
Style/EmptyLinesAroundModuleBody:
|
39
|
+
Exclude:
|
40
|
+
- 'lib/localcallingguide.rb'
|
41
|
+
|
42
|
+
# Offense count: 1
|
43
|
+
# Cop supports --auto-correct.
|
44
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues.
|
45
|
+
Style/HashSyntax:
|
46
|
+
Enabled: false
|
47
|
+
|
48
|
+
# Offense count: 2
|
49
|
+
# Cop supports --auto-correct.
|
50
|
+
# Configuration parameters: PreferredDelimiters.
|
51
|
+
Style/PercentLiteralDelimiters:
|
52
|
+
Exclude:
|
53
|
+
- 'localcallingguide.gemspec'
|
54
|
+
|
55
|
+
# Offense count: 1
|
56
|
+
# Cop supports --auto-correct.
|
57
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
58
|
+
Style/SignalException:
|
59
|
+
Exclude:
|
60
|
+
- 'localcallingguide.gemspec'
|
61
|
+
|
62
|
+
# Offense count: 3
|
63
|
+
# Cop supports --auto-correct.
|
64
|
+
Style/SpaceAfterColon:
|
65
|
+
Exclude:
|
66
|
+
- 'test/localcallingguide_test.rb'
|
67
|
+
|
68
|
+
# Offense count: 1
|
69
|
+
# Cop supports --auto-correct.
|
70
|
+
Style/SpaceAfterComma:
|
71
|
+
Exclude:
|
72
|
+
- 'test/localcallingguide_test.rb'
|
73
|
+
|
74
|
+
# Offense count: 3
|
75
|
+
# Cop supports --auto-correct.
|
76
|
+
# Configuration parameters: SupportedStyles.
|
77
|
+
Style/SpaceAroundEqualsInParameterDefault:
|
78
|
+
EnforcedStyle: no_space
|
79
|
+
|
80
|
+
# Offense count: 42
|
81
|
+
# Cop supports --auto-correct.
|
82
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
83
|
+
Style/StringLiterals:
|
84
|
+
Enabled: false
|
85
|
+
|
86
|
+
# Offense count: 1
|
87
|
+
# Cop supports --auto-correct.
|
88
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
89
|
+
Style/TrailingBlankLines:
|
90
|
+
Exclude:
|
91
|
+
- 'Rakefile'
|
92
|
+
|
93
|
+
# Offense count: 2
|
94
|
+
# Cop supports --auto-correct.
|
95
|
+
Style/TrailingWhitespace:
|
96
|
+
Exclude:
|
97
|
+
- 'localcallingguide.gemspec'
|
98
|
+
|
99
|
+
# Offense count: 2
|
100
|
+
# Cop supports --auto-correct.
|
101
|
+
Style/UnneededPercentQ:
|
102
|
+
Exclude:
|
103
|
+
- 'localcallingguide.gemspec'
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,8 @@
|
|
1
1
|
# Ruby Wrapper for Local Calling Guide
|
2
|
+
[![Build Status](https://travis-ci.org/joshaidan/localcallingguide.svg?branch=master)](https://travis-ci.org/joshaidan/localcallingguide)
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/localcallingguide.svg)](https://badge.fury.io/rb/localcallingguide)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/joshaidan/localcallingguide/badges/gpa.svg)](https://codeclimate.com/github/joshaidan/localcallingguide)
|
5
|
+
[![Test Coverage](https://codeclimate.com/github/joshaidan/localcallingguide/badges/coverage.svg)](https://codeclimate.com/github/joshaidan/localcallingguide/coverage)
|
2
6
|
|
3
7
|
This gem is a Ruby Wrapper for [Local Calling Guide](http://www.localcallingguide.com), a website for retrieving information on local calling, area codes and telephone prefixes for North America and other countries.
|
4
8
|
|
@@ -44,4 +48,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/joshai
|
|
44
48
|
## License
|
45
49
|
|
46
50
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
47
|
-
|
data/lib/localcallingguide.rb
CHANGED
@@ -3,45 +3,47 @@ require 'open-uri'
|
|
3
3
|
require 'xmlsimple'
|
4
4
|
|
5
5
|
module LocalCallingGuide
|
6
|
-
|
7
|
-
|
8
|
-
data
|
9
|
-
|
6
|
+
def get_results(url)
|
7
|
+
data = URI.open(url).read
|
8
|
+
XmlSimple.xml_in(data, 'ForceArray' => false, 'KeyToSymbol' => false)
|
9
|
+
# It would be nice to use KeyToSymbol but I have to figure out how to
|
10
|
+
# handle hyphened keys, i.e. "company-name"
|
10
11
|
end
|
11
|
-
|
12
|
-
|
12
|
+
|
13
|
+
module_function :get_results
|
14
|
+
|
15
|
+
class LocalExchange
|
13
16
|
def self.prefixes(exch, dir=1, rconly=0)
|
14
|
-
exch_data = LocalCallingGuide
|
15
|
-
|
17
|
+
exch_data = LocalCallingGuide.get_results("http://www.localcallingguide.com/xmllocalexch.php?exch=#{exch}&dir=#{dir}&rconly=#{rconly}")
|
18
|
+
exch_data['lca-data']['prefix']
|
16
19
|
end
|
17
20
|
end
|
18
|
-
|
21
|
+
|
19
22
|
class LocalPrefix
|
20
23
|
def self.prefixes(npa, nxx, dir=1)
|
21
|
-
prefix_data = LocalCallingGuide
|
22
|
-
|
24
|
+
prefix_data = LocalCallingGuide.get_results("http://www.localcallingguide.com/xmllocalprefix.php?npa=#{npa}&nxx=#{nxx}&dir=#{dir}")
|
25
|
+
prefix_data['lca-data']['prefix']
|
23
26
|
end
|
24
27
|
end
|
25
|
-
|
28
|
+
|
26
29
|
class Prefix
|
27
30
|
def self.npanxx(npa, nxx)
|
28
|
-
prefix_data = LocalCallingGuide
|
29
|
-
|
31
|
+
prefix_data = LocalCallingGuide.get_results("http://www.localcallingguide.com/xmlprefix.php?npa=#{npa}&nxx=#{nxx}")
|
32
|
+
prefix_data['prefixdata']
|
30
33
|
end
|
31
34
|
end
|
32
|
-
|
35
|
+
|
33
36
|
class RateCentre
|
34
|
-
def self.rate_centre(
|
35
|
-
rc_data = LocalCallingGuide
|
36
|
-
|
37
|
+
def self.rate_centre(options)
|
38
|
+
rc_data = LocalCallingGuide.get_results("http://www.localcallingguide.com/xmlrc.php?npa=#{options[:npa]}&rc=#{options[:rate_centre]}®ion=#{options[:region]}&lata=#{options[:lata]}&lir=#{options[:lir]}&ocn=#{options[:ocn]}&udate=#{options[:udate]}")
|
39
|
+
rc_data['rcdata']
|
37
40
|
end
|
38
41
|
end
|
39
|
-
|
42
|
+
|
40
43
|
class Distance
|
41
44
|
def self.rc_dist(npa1, nxx1, npa2, nxx2)
|
42
|
-
dist_data = LocalCallingGuide
|
43
|
-
|
45
|
+
dist_data = LocalCallingGuide.get_results("http://www.localcallingguide.com/xmlrcdist.php?npa1=#{npa1}&nxx1=#{nxx1}&npa2=#{npa2}&nxx2=#{nxx2}")
|
46
|
+
dist_data['rcdist']
|
44
47
|
end
|
45
48
|
end
|
46
|
-
|
47
49
|
end
|
data/localcallingguide.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
18
|
# delete this section to allow pushing this gem to any host.
|
19
19
|
if spec.respond_to?(:metadata)
|
20
|
-
|
20
|
+
|
21
21
|
else
|
22
22
|
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
23
|
end
|
@@ -27,10 +27,11 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
28
|
spec.require_paths = ["lib"]
|
29
29
|
|
30
|
-
spec.add_development_dependency "bundler", "~> 1.
|
31
|
-
spec.add_development_dependency "rake", "~>
|
30
|
+
spec.add_development_dependency "bundler", "~> 2.1.4"
|
31
|
+
spec.add_development_dependency "rake", "~> 13.0.1"
|
32
32
|
spec.add_development_dependency "minitest", "~> 5.0"
|
33
|
-
|
33
|
+
spec.add_development_dependency "rubocop", "~> 0.82"
|
34
|
+
# spec.add_development_dependency "codeclimate-test-reporter"
|
35
|
+
|
34
36
|
spec.add_runtime_dependency "xml-simple", "~> 1.1.5"
|
35
|
-
|
36
37
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: localcallingguide
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Jones
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 2.1.4
|
20
20
|
type: :development
|
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: 2.1.4
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 13.0.1
|
34
34
|
type: :development
|
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: 13.0.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '5.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubocop
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.82'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.82'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: xml-simple
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,7 +87,10 @@ executables: []
|
|
73
87
|
extensions: []
|
74
88
|
extra_rdoc_files: []
|
75
89
|
files:
|
90
|
+
- ".codeclimate.yml"
|
76
91
|
- ".gitignore"
|
92
|
+
- ".rubocop.yml"
|
93
|
+
- ".rubocop_todo.yml"
|
77
94
|
- ".travis.yml"
|
78
95
|
- CODE_OF_CONDUCT.md
|
79
96
|
- Gemfile
|
@@ -100,12 +117,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
100
117
|
version: '0'
|
101
118
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
119
|
requirements:
|
103
|
-
- - "
|
120
|
+
- - ">="
|
104
121
|
- !ruby/object:Gem::Version
|
105
|
-
version:
|
122
|
+
version: '0'
|
106
123
|
requirements: []
|
107
|
-
|
108
|
-
rubygems_version: 2.4.8
|
124
|
+
rubygems_version: 3.1.2
|
109
125
|
signing_key:
|
110
126
|
specification_version: 4
|
111
127
|
summary: Wrapper for localcallingguide.com
|