cellularity 0.0.2.1 → 1.0.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a45b9bf4d0c6797332b1bc9dc9c980fd9511690b
4
- data.tar.gz: d2fa86c953129642a4c3f040b7ece7452b875413
3
+ metadata.gz: 13c1cee26e5e86e93538b6ae79b858e3c7fb0262
4
+ data.tar.gz: 4e93a6da8e78aab0eb29d1c0724ee79eaaba0310
5
5
  SHA512:
6
- metadata.gz: f78fbb49d80750af0eb5120945f9b2f6d4571e71bcf8ad72cf3f5162e187d12b67f02212f9664e58739305f3f1997b55fbd56b5c3b1a88b6772019963778c9a8
7
- data.tar.gz: 4022296557b2ad970e6795980d1ca73c70843a1ffae344a861250c05a2a7255754dccf70e1b8beed9cfd73f8bb557f2c66574f87fd6c01c1bfba25f6b2963f53
6
+ metadata.gz: d586d2534f92b1fd5eae550f83b1a0d5f608c94a11920d7d805d6f3ea7a96e292b34366bb7bf166d6b8fd0c80c966713692b397b6c8fb5b02e9f2696f103befc
7
+ data.tar.gz: 17f0d5619c1e265a3dc2c66807e5ebfd21c18d51e1ecb5dffb66cf68072bd036d210989fca755df77dd5fa47600ac7513c0151566dac8897afc290431e1bc0ab
data/.gitignore CHANGED
@@ -8,6 +8,9 @@ InstalledFiles
8
8
  _yardoc
9
9
  coverage
10
10
  doc/
11
+ =======
12
+ coverage
13
+ InstalledFiles
11
14
  lib/bundler/man
12
15
  pkg
13
16
  rdoc
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Cellularity
1
+ # Cellularity
2
2
 
3
3
  Determine whether a value is an ICCID, IMEI, or ESN.
4
4
 
@@ -26,11 +26,18 @@ Or install it yourself as:
26
26
  imei = 123456789012345 # It can be a string or a number
27
27
  esn = '0xabc12345' # The ESN class can also handle hex.
28
28
  iccid = 12345678901234567890
29
+ min = 1234567890
29
30
 
30
31
  ## Validate your values:
31
32
  Cellularity::Esn.new(esn).valid? # => true
32
33
  Cellularity::Esn.new(imei).valid? # => false
33
34
  Cellularity::Iccid.new(iccid).valid? # => true
35
+ Cellularity::Min.new(min).valid? # => true
36
+ Cellularity::Min.new(:invalid).valid? # => false
37
+
38
+ # Dynamically determine your id type:
39
+ Cellularity.determine_id_type(esn) # => :esn
40
+ Cellularity.determine_id_type(iccid) # => :iccid
34
41
  ```
35
42
 
36
43
  ## Contributing
@@ -39,4 +46,4 @@ Cellularity::Iccid.new(iccid).valid? # => true
39
46
  2. Create your feature branch (`git checkout -b my-new-feature`)
40
47
  3. Commit your changes (`git commit -am 'Add some feature'`)
41
48
  4. Push to the branch (`git push origin my-new-feature`)
42
- 5. Create new Pull Request
49
+ 5. Create new Pull Request
data/Rakefile CHANGED
@@ -1 +1,11 @@
1
- require "bundler/gem_tasks"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new
5
+
6
+ task default: :spec
7
+ task test: :spec
8
+
9
+ task :build do
10
+ system "gem build uceem_gem.gemspec"
11
+ end
@@ -1,5 +1,6 @@
1
1
  require "cellularity/version"
2
2
 
3
+ require 'cellularity/min'
3
4
  require 'cellularity/esn'
4
5
  require 'cellularity/imei'
5
6
  require 'cellularity/iccid'
@@ -9,6 +10,7 @@ module Cellularity
9
10
  return :esn if Cellularity::Esn.new(id).valid?
10
11
  return :imei if Cellularity::Imei.new(id).valid?
11
12
  return :iccid if Cellularity::Iccid.new(id).valid?
13
+ return :min if Cellularity::Min.new(id).valid?
12
14
  end
13
15
 
14
16
  def self.parse_id(id)
@@ -16,7 +18,8 @@ module Cellularity
16
18
  when :esn then Cellularity::Esn.new(id)
17
19
  when :imei then Cellularity::Imei.new(id)
18
20
  when :iccid then Cellularity::Iccid.new(id)
21
+ when :min then Cellularity::Min.new(id)
19
22
  else nil
20
23
  end
21
24
  end
22
- end
25
+ end
@@ -0,0 +1,16 @@
1
+ module Cellularity
2
+ class Min
3
+
4
+ attr_accessor :min
5
+
6
+ def initialize(min = '')
7
+ self.min = min.to_s
8
+ end
9
+
10
+ def valid?
11
+ self.min.length == 10 && !!Integer(self.min)
12
+ rescue ArgumentError, TypeError
13
+ false
14
+ end
15
+ end
16
+ end
@@ -1,3 +1,3 @@
1
1
  module Cellularity
2
- VERSION = "0.0.2.1"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -5,6 +5,7 @@ describe Cellularity do
5
5
  let(:esn) { '0xabc12345' }
6
6
  let(:imei) { '123456789012345' }
7
7
  let(:iccid) { 12345678901234567890 }
8
+ let(:min) { 1234567890 }
8
9
  let(:nada) { :not_an_id }
9
10
 
10
11
  context 'when an esn' do
@@ -36,4 +37,14 @@ describe Cellularity do
36
37
  Cellularity.parse_id(iccid).is_a?(Cellularity::Iccid).should be_true
37
38
  end
38
39
  end
40
+
41
+ context 'when an min' do
42
+ it 'should think it is an min' do
43
+ Cellularity.determine_id_type(min).should == :min
44
+ end
45
+
46
+ it 'should return an Min object' do
47
+ Cellularity.parse_id(min).is_a?(Cellularity::Min).should be_true
48
+ end
49
+ end
39
50
  end
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe Cellularity::Esn do
4
4
 
5
5
  let(:invalid_esn) { ['blah', 12345, :abcdfeghj, '0x123456'] }
6
- let(:valid_esn) { [12345678909, '0xabc12345', 'abc12345', '01234567890'] }
6
+ let(:valid_esn) { [12345678909, '0xabc12345', 'abc12345', '01234567890'] }
7
7
 
8
8
  it 'should think that valid esns are, in fact, valid' do
9
9
  valid_esn.each { |esn| Cellularity::Esn.new(esn).valid?.should be_true }
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ describe Cellularity::Min do
4
+
5
+ let(:invalid_min) { ['blah', 1234, :ansdfsdf, 12345678901] }
6
+ let(:valid_min) { [1234567890, '1234567890'] }
7
+
8
+ it 'should think that valid mins are valid' do
9
+ valid_min.each { |min| Cellularity::Min.new(min).valid?.should be_true }
10
+ end
11
+
12
+ it 'should think that invalid mins are invalid' do
13
+ invalid_min.each { |min| Cellularity::Min.new(min).valid?.should be_false }
14
+ end
15
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cellularity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - johnotander
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-18 00:00:00.000000000 Z
11
+ date: 2013-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -60,6 +60,7 @@ extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
62
  - .gitignore
63
+ - .travis.yml
63
64
  - Gemfile
64
65
  - LICENSE.txt
65
66
  - README.md
@@ -69,11 +70,13 @@ files:
69
70
  - lib/cellularity/esn.rb
70
71
  - lib/cellularity/iccid.rb
71
72
  - lib/cellularity/imei.rb
73
+ - lib/cellularity/min.rb
72
74
  - lib/cellularity/version.rb
73
75
  - spec/cellularity_spec.rb
74
76
  - spec/esn_spec.rb
75
77
  - spec/iccid_spec.rb
76
78
  - spec/imei_spec.rb
79
+ - spec/min_spec.rb
77
80
  - spec/spec_helper.rb
78
81
  homepage: https://www.github.com/johnotander/cellularity
79
82
  licenses:
@@ -104,4 +107,5 @@ test_files:
104
107
  - spec/esn_spec.rb
105
108
  - spec/iccid_spec.rb
106
109
  - spec/imei_spec.rb
110
+ - spec/min_spec.rb
107
111
  - spec/spec_helper.rb