faker-medical 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/faker-medical.gemspec +4 -2
- data/lib/faker_npi.rb +22 -0
- data/lib/faker_patient.rb +10 -0
- data/spec/lib/faker_npi_spec.rb +10 -0
- data/spec/lib/faker_patient_spec.rb +10 -2
- data/spec/spec_helper.rb +2 -1
- data/version.yml +2 -2
- metadata +4 -2
data/faker-medical.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{faker-medical}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Tom & Russell"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-04-12}
|
13
13
|
s.description = %q{This gem is an extension of the Faker Gem to generate SSN, DEA, and NPI Numbers}
|
14
14
|
s.email = %q{thing2@jackhq.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
|
|
28
28
|
"lib/faker_patient.rb",
|
29
29
|
"lib/faker_ssn.rb",
|
30
30
|
"spec/lib/faker_dea_spec.rb",
|
31
|
+
"spec/lib/faker_npi_spec.rb",
|
31
32
|
"spec/lib/faker_patient_spec.rb",
|
32
33
|
"spec/lib/faker_ssn_spec.rb",
|
33
34
|
"spec/spec.opts",
|
@@ -43,6 +44,7 @@ Gem::Specification.new do |s|
|
|
43
44
|
s.summary = %q{Faker Extension for Medical Numbers}
|
44
45
|
s.test_files = [
|
45
46
|
"spec/lib/faker_dea_spec.rb",
|
47
|
+
"spec/lib/faker_npi_spec.rb",
|
46
48
|
"spec/lib/faker_patient_spec.rb",
|
47
49
|
"spec/lib/faker_ssn_spec.rb",
|
48
50
|
"spec/spec_helper.rb",
|
data/lib/faker_npi.rb
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
module Faker
|
2
|
+
class Npi
|
3
|
+
class << self
|
4
|
+
def npi
|
5
|
+
x = []
|
6
|
+
10.times do
|
7
|
+
x << rand(10)
|
8
|
+
end
|
9
|
+
x.join
|
10
|
+
end
|
11
|
+
|
12
|
+
def check_digits? num
|
13
|
+
odd = false
|
14
|
+
num.to_s.gsub(/\D/,'').reverse.split('').map(&:to_i).collect { |d|
|
15
|
+
d *= 2 if odd = !odd
|
16
|
+
d > 9 ? d - 9 : d
|
17
|
+
}.sum % 10 == 0
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/faker_patient.rb
CHANGED
@@ -3,9 +3,17 @@ require File.dirname(__FILE__) + '/../spec_helper.rb'
|
|
3
3
|
describe Faker::Patient do
|
4
4
|
|
5
5
|
it "should return a patient gender" do
|
6
|
-
puts Faker::Patient.gender
|
7
6
|
Faker::Patient.gender.should match(/^[M|F]$/)
|
8
7
|
end
|
9
8
|
|
10
|
-
|
9
|
+
it "should return 10 patient dates of birth" do
|
10
|
+
100.times do
|
11
|
+
Faker::Patient.dob.should be_true
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should return basic phone number" do
|
16
|
+
Faker::Patient.phone_number.should =~ /^[0-9]{3}-[0-9]{3}-[0-9]{4}$/
|
17
|
+
end
|
18
|
+
|
11
19
|
end
|
data/spec/spec_helper.rb
CHANGED
data/version.yml
CHANGED
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.1.
|
4
|
+
version: 0.1.3
|
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: 2010-
|
12
|
+
date: 2010-04-12 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -43,6 +43,7 @@ files:
|
|
43
43
|
- lib/faker_patient.rb
|
44
44
|
- lib/faker_ssn.rb
|
45
45
|
- spec/lib/faker_dea_spec.rb
|
46
|
+
- spec/lib/faker_npi_spec.rb
|
46
47
|
- spec/lib/faker_patient_spec.rb
|
47
48
|
- spec/lib/faker_ssn_spec.rb
|
48
49
|
- spec/spec.opts
|
@@ -80,6 +81,7 @@ specification_version: 3
|
|
80
81
|
summary: Faker Extension for Medical Numbers
|
81
82
|
test_files:
|
82
83
|
- spec/lib/faker_dea_spec.rb
|
84
|
+
- spec/lib/faker_npi_spec.rb
|
83
85
|
- spec/lib/faker_patient_spec.rb
|
84
86
|
- spec/lib/faker_ssn_spec.rb
|
85
87
|
- spec/spec_helper.rb
|