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.
@@ -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.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-01-04}
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",
@@ -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
@@ -6,6 +6,16 @@ module Faker
6
6
  gender = ['M','F']
7
7
  gender[rand(2)]
8
8
  end
9
+
10
+ def dob
11
+ Date.parse("#{rand(12) + 1}/#{rand(28) + 1}/19#{format("%02d", rand(99))}" )
12
+ end
13
+
14
+ def phone_number
15
+ Faker.numerify("###-###-####")
16
+ end
17
+
18
+
9
19
  end
10
20
 
11
21
  end
@@ -0,0 +1,10 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper.rb'
2
+
3
+ describe Faker::Npi do
4
+
5
+ it "should return a npi" do
6
+ Faker::Npi.npi.should match(/^\d{10}$/)
7
+ end
8
+
9
+
10
+ end
@@ -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
@@ -2,4 +2,5 @@ require 'spec'
2
2
  require 'faker'
3
3
  require 'faker_dea'
4
4
  require 'faker_ssn'
5
- require 'faker_patient'
5
+ require 'faker_patient'
6
+ require 'faker_npi'
@@ -1,5 +1,5 @@
1
1
  ---
2
+ :major: 0
2
3
  :minor: 1
3
- :patch: 1
4
4
  :build:
5
- :major: 0
5
+ :patch: 3
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.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-01-04 00:00:00 -05:00
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