torasup 0.0.4 → 0.0.5

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
  SHA1:
3
- metadata.gz: 58441e57888b60e74180d3839b58228c9173dc1d
4
- data.tar.gz: e5ef2e5a914ae3fe5948226b26e2847a4d493ae8
3
+ metadata.gz: 2bcfb1ffbd42ca86f97773f2febf32f945141f60
4
+ data.tar.gz: 9c421d8d53db393fd4987159895616d4607e5ba0
5
5
  SHA512:
6
- metadata.gz: 458f7e38e714dbcabc1205d5036f7e769c691bd65596a69fa79c19dfece32c9781853b0e692b02d86e457096f34ecf90874fc7c4be895c19843d5626aecce598
7
- data.tar.gz: c05b9cbec59b960f4f75404a3a1d8cda1a27e3e21e1c2c66d9b26f0b261f9069b06b4e92c4d324b141263c117cd2147a26e9ba7b9dd75927d0d1e95851dc2e76
6
+ metadata.gz: f748990a8e8bd46ba202d18d6c833fc53cf9ba4cfaa34f252b1b89a9b056db57efed8fc6b063d7a99b1d7564808da9d3de9b1c7fd3d61b780f2aeb16a610c2ac
7
+ data.tar.gz: 34119686c1361a051652d5a532f0ad3876a882fd19608f621451820f35129c0663b50659c2ba1bafdd8eb975b924fea2ba94c85b1fac7bd8c303dee7bdfe7b38
data/README.md CHANGED
@@ -114,6 +114,9 @@ Sometimes you may only be interested in certain prefixes. For example let's say
114
114
  > register_operators("kh", "metfone")
115
115
  > end
116
116
 
117
+ > Torasup::Operator.registered
118
+ => {"kh"=>["metfone"]}
119
+
117
120
  > Torasup::Operator.registered_prefixes
118
121
  => ["85597", "85588"]
119
122
 
@@ -22,6 +22,10 @@ module Torasup
22
22
  Torasup.registered_prefixes
23
23
  end
24
24
 
25
+ def self.registered
26
+ Torasup.registered_operators
27
+ end
28
+
25
29
  def self.all
26
30
  operators = {}
27
31
  Torasup.prefixes.each do |prefix, metadata|
@@ -1,3 +1,3 @@
1
1
  module Torasup
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/lib/torasup.rb CHANGED
@@ -55,6 +55,10 @@ module Torasup
55
55
  @pstn_prefixes.dup
56
56
  end
57
57
 
58
+ def registered_operators
59
+ configuration.registered_operators.dup
60
+ end
61
+
58
62
  private
59
63
 
60
64
  def load_pstn_prefixes!
@@ -4,6 +4,31 @@ module Torasup
4
4
  describe Operator do
5
5
  include PstnHelpers
6
6
 
7
+ let(:operator) { sample_operator }
8
+
9
+ describe ".registered" do
10
+ context "given no operators have been registered" do
11
+ before do
12
+ clear_registered_operators
13
+ end
14
+
15
+ it "should return an empty hash" do
16
+ Operator.registered.should == {}
17
+ end
18
+ end
19
+
20
+ context "given one operator has been registered" do
21
+ before do
22
+ configure_registered_operators(operator[0], operator[1])
23
+ configure_with_custom_data(false)
24
+ end
25
+
26
+ it "should return a hash of countries with registerd operators" do
27
+ Operator.registered.should == {operator[0] => [operator[1]]}
28
+ end
29
+ end
30
+ end
31
+
7
32
  describe ".registered_prefixes" do
8
33
  context "given no operators have been registered" do
9
34
  before do
@@ -16,14 +41,12 @@ module Torasup
16
41
  end
17
42
 
18
43
  context "given one operator has been registered" do
19
- let(:operator) { sample_operator }
20
-
21
44
  before do
22
45
  configure_registered_operators(operator[0], operator[1])
23
46
  configure_with_custom_data(false)
24
47
  end
25
48
 
26
- it "should the prefixes for that operator" do
49
+ it "should return the prefixes for that operator" do
27
50
  Operator.registered_prefixes.should =~ prefixes(operator[0], operator[1])
28
51
  end
29
52
  end
data/torasup.gemspec CHANGED
@@ -11,6 +11,7 @@ Gem::Specification.new do |gem|
11
11
  gem.description = %q{"Retuns metadata about a phone number such as operator, area code and more"}
12
12
  gem.summary = %q{"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 = 'MIT'
14
15
 
15
16
  gem.files = `git ls-files`.split($/)
16
17
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
@@ -22,5 +23,5 @@ Gem::Specification.new do |gem|
22
23
  gem.add_runtime_dependency "deep_merge"
23
24
 
24
25
  gem.add_development_dependency "rspec"
25
- gem.add_development_dependency "rake"
26
+ gem.add_development_dependency "rake"
26
27
  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.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Wilkie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-28 00:00:00.000000000 Z
11
+ date: 2013-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: countries
@@ -113,7 +113,8 @@ files:
113
113
  - spec/torasup/phone_number_spec.rb
114
114
  - torasup.gemspec
115
115
  homepage: https://github.com/dwilkie/torasup/
116
- licenses: []
116
+ licenses:
117
+ - MIT
117
118
  metadata: {}
118
119
  post_install_message:
119
120
  rdoc_options: []