faker-medical 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,63 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{faker-medical}
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Tom & Russell"]
12
+ s.date = %q{2010-01-04}
13
+ s.description = %q{This gem is an extension of the Faker Gem to generate SSN, DEA, and NPI Numbers}
14
+ s.email = %q{thing2@jackhq.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".gitignore",
22
+ "LICENSE",
23
+ "README.rdoc",
24
+ "Rakefile",
25
+ "faker-medical.gemspec",
26
+ "lib/faker_dea.rb",
27
+ "lib/faker_npi.rb",
28
+ "lib/faker_ssn.rb",
29
+ "spec/lib/faker_dea_spec.rb",
30
+ "spec/lib/faker_ssn_spec.rb",
31
+ "spec/spec.opts",
32
+ "spec/spec_helper.rb",
33
+ "test/helper.rb",
34
+ "test/test_faker-medical.rb",
35
+ "version.yml"
36
+ ]
37
+ s.homepage = %q{http://github.com/jackhq/faker-medical}
38
+ s.rdoc_options = ["--charset=UTF-8"]
39
+ s.require_paths = ["lib"]
40
+ s.rubygems_version = %q{1.3.5}
41
+ s.summary = %q{Faker Extension for Medical Numbers}
42
+ s.test_files = [
43
+ "spec/lib/faker_dea_spec.rb",
44
+ "spec/lib/faker_ssn_spec.rb",
45
+ "spec/spec_helper.rb",
46
+ "test/helper.rb",
47
+ "test/test_faker-medical.rb"
48
+ ]
49
+
50
+ if s.respond_to? :specification_version then
51
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
52
+ s.specification_version = 3
53
+
54
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
55
+ s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
56
+ else
57
+ s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
58
+ end
59
+ else
60
+ s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
61
+ end
62
+ end
63
+
data/lib/faker_dea.rb ADDED
@@ -0,0 +1,26 @@
1
+ module Faker
2
+ class Dea
3
+ class << self
4
+ def dea(type="A",last_name="Smith")
5
+ prefix = type + last_name.split("")[0]
6
+ suffix = Faker.numerify('######')
7
+ prefix + suffix + check_digit(suffix)
8
+
9
+ end
10
+
11
+ def check_digit(dea_suffix_number)
12
+ n_array = dea_suffix_number.split("")
13
+ first_number = n_array[0].to_i + n_array[2].to_i + n_array[4].to_i
14
+ #puts first_number
15
+ sec_number = n_array[1].to_i + n_array[3].to_i + n_array[5].to_i
16
+ sec_number = sec_number * 2
17
+ #puts sec_number
18
+ check_digit = first_number + sec_number
19
+ #puts check_digit
20
+ check_digit.to_s.split("").last
21
+ end
22
+
23
+ end
24
+
25
+ end
26
+ end
File without changes
File without changes
@@ -0,0 +1,11 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper.rb'
2
+
3
+ describe Faker::Dea do
4
+
5
+ it "should return a ssn with dashes" do
6
+ #puts Faker::Dea.dea
7
+ Faker::Dea.dea.should match(/^[A|B|F|M|P|R][A-Z](?!000000)\d{6}/)
8
+ end
9
+
10
+
11
+ end
@@ -0,0 +1,10 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper.rb'
2
+
3
+ describe Faker::Ssn do
4
+
5
+ it "should return a ssn with dashes" do
6
+ Faker::Ssn.en_ssn.should match(/^(?!000)([0-6]\d{2}|7([0-6]\d|7[012]))([ -]?)(?!00)\d\d\3(?!0000)\d{4}$/)
7
+ end
8
+
9
+
10
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1,4 @@
1
+ --colour
2
+ --format progress
3
+ --loadby mtime
4
+ --reverse
@@ -0,0 +1,5 @@
1
+ require 'spec'
2
+ require 'faker'
3
+ require 'faker_dea'
4
+ require 'faker_ssn'
5
+ require 'faker_npi'
data/version.yml CHANGED
@@ -1,3 +1,5 @@
1
- major: 0
2
- minor: 0
3
- patch: 1
1
+ ---
2
+ :minor: 1
3
+ :patch: 0
4
+ :build:
5
+ :major: 0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faker-medical
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom & Russell
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-03 00:00:00 -05:00
12
+ date: 2010-01-04 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -37,9 +37,14 @@ files:
37
37
  - LICENSE
38
38
  - README.rdoc
39
39
  - Rakefile
40
- - lib/faker-dea.rb
41
- - lib/faker-npi.rb
42
- - lib/faker-ssn.rb
40
+ - faker-medical.gemspec
41
+ - lib/faker_dea.rb
42
+ - lib/faker_npi.rb
43
+ - lib/faker_ssn.rb
44
+ - spec/lib/faker_dea_spec.rb
45
+ - spec/lib/faker_ssn_spec.rb
46
+ - spec/spec.opts
47
+ - spec/spec_helper.rb
43
48
  - test/helper.rb
44
49
  - test/test_faker-medical.rb
45
50
  - version.yml
@@ -72,5 +77,8 @@ signing_key:
72
77
  specification_version: 3
73
78
  summary: Faker Extension for Medical Numbers
74
79
  test_files:
80
+ - spec/lib/faker_dea_spec.rb
81
+ - spec/lib/faker_ssn_spec.rb
82
+ - spec/spec_helper.rb
75
83
  - test/helper.rb
76
84
  - test/test_faker-medical.rb
data/lib/faker-npi.rb DELETED
File without changes