bloom_api 0.0.2
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 +7 -0
- data/.gitignore +36 -0
- data/.yardopts +1 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +31 -0
- data/LICENSE.txt +22 -0
- data/README.md +40 -0
- data/Rakefile +2 -0
- data/bloom_api.gemspec +24 -0
- data/lib/bloom_api/address.rb +56 -0
- data/lib/bloom_api/identifier.rb +41 -0
- data/lib/bloom_api/individual.rb +82 -0
- data/lib/bloom_api/organization.rb +61 -0
- data/lib/bloom_api/organization_official.rb +54 -0
- data/lib/bloom_api/provider.rb +118 -0
- data/lib/bloom_api/specialty.rb +43 -0
- data/lib/bloom_api/version.rb +4 -0
- data/lib/bloom_api.rb +46 -0
- data/spec/bloom_api/address_spec.rb +64 -0
- data/spec/bloom_api/api_spec.rb +24 -0
- data/spec/bloom_api/identifier_spec.rb +37 -0
- data/spec/bloom_api/individual_spec.rb +144 -0
- data/spec/bloom_api/organization_official_spec.rb +64 -0
- data/spec/bloom_api/organization_spec.rb +156 -0
- data/spec/bloom_api/provider_lookup_spec.rb +7 -0
- data/spec/bloom_api/provider_spec.rb +222 -0
- data/spec/bloom_api/specialty_spec.rb +51 -0
- data/spec/bloom_api_spec.rb +50 -0
- data/spec/spec_helper.rb +7 -0
- metadata +127 -0
@@ -0,0 +1,64 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
describe BloomApi::Address do
|
4
|
+
let(:address_params) {{
|
5
|
+
"address_details_line" => "APT 1A",
|
6
|
+
"address_line" => "45 W 11TH ST",
|
7
|
+
"city" => "NEW YORK",
|
8
|
+
"country_code" => "US",
|
9
|
+
"fax" => "555-234-5678",
|
10
|
+
"phone" => "555-123-4567",
|
11
|
+
"state" => "NY",
|
12
|
+
"zip" => "100118664"
|
13
|
+
}}
|
14
|
+
|
15
|
+
let(:address) { BloomApi::Address.new(address_params) }
|
16
|
+
|
17
|
+
describe '#line1' do
|
18
|
+
subject { address.line1 }
|
19
|
+
|
20
|
+
it { expect(subject).to eq "45 W 11TH ST" }
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '#line2' do
|
24
|
+
subject { address.line2 }
|
25
|
+
|
26
|
+
it { expect(subject).to eq "APT 1A" }
|
27
|
+
end
|
28
|
+
|
29
|
+
describe '#city' do
|
30
|
+
subject { address.city }
|
31
|
+
|
32
|
+
it { expect(subject).to eq "NEW YORK" }
|
33
|
+
end
|
34
|
+
|
35
|
+
describe '#country' do
|
36
|
+
subject { address.country }
|
37
|
+
|
38
|
+
it { expect(subject).to eq "US" }
|
39
|
+
end
|
40
|
+
|
41
|
+
describe '#fax' do
|
42
|
+
subject { address.fax }
|
43
|
+
|
44
|
+
it { expect(subject).to eq "555-234-5678" }
|
45
|
+
end
|
46
|
+
|
47
|
+
describe '#phone' do
|
48
|
+
subject { address.phone }
|
49
|
+
|
50
|
+
it { expect(subject).to eq "555-123-4567" }
|
51
|
+
end
|
52
|
+
|
53
|
+
describe '#state' do
|
54
|
+
subject { address.state }
|
55
|
+
|
56
|
+
it { expect(subject).to eq "NY" }
|
57
|
+
end
|
58
|
+
|
59
|
+
describe '#zip' do
|
60
|
+
subject { address.zip }
|
61
|
+
|
62
|
+
it { expect(subject).to eq "100118664" }
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
describe BloomApi::Api do
|
4
|
+
|
5
|
+
describe '#find_by_npi' do
|
6
|
+
|
7
|
+
before do
|
8
|
+
allow(Net::HTTP).to receive(:get_response).with("www.bloomapi.com/api/npis/#{npi}").and_return(json_response)
|
9
|
+
end
|
10
|
+
|
11
|
+
subject { BloomApi::Api.find_by_npi(npi) }
|
12
|
+
|
13
|
+
context 'when given a valid npi' do
|
14
|
+
let(:npi) { '1003002809' }
|
15
|
+
let(:json_response) { '{"result":{"business_address":{"address_details_line":"APT 1A","address_line":"45 W 11TH ST","city":"NEW YORK","country_code":"US","state":"NY","zip":"100118664"},"credential":"MD","enumeration_date":"2007-09-15T00:00:00.000Z","first_name":"VINCENT","gender":"male","last_name":"GRAZIANO","last_update_date":"2007-09-15T00:00:00.000Z","name_prefix":"DR.","npi":"1003002809","practice_address":{"address_details_line":"APT 1A","address_line":"45 W 11TH ST","city":"NEW YORK","country_code":"US","phone":"6464072044","state":"NY","zip":"100118664"},"provider_details":[{"healthcare_taxonomy_code":"2085R0202X","license_number":"00243641","taxonomy_switch":"yes"}],"sole_proprietor":"yes","type":"individual"}}' }
|
16
|
+
|
17
|
+
it 'fetches the data from the api' do
|
18
|
+
expect(Net::HTTP).to receive(:get_response)
|
19
|
+
subject
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
describe BloomApi::Identifier do
|
4
|
+
|
5
|
+
let(:identifier_params) {{
|
6
|
+
"identifier" => "4394003",
|
7
|
+
"state" => "CT",
|
8
|
+
"type" => "medicaid",
|
9
|
+
"issuer" => "CMS"
|
10
|
+
}}
|
11
|
+
|
12
|
+
let(:identifier) { BloomApi::Identifier.new(identifier_params) }
|
13
|
+
|
14
|
+
describe '#identifier' do
|
15
|
+
subject { identifier.identifier }
|
16
|
+
|
17
|
+
it { expect(subject).to eq "4394003" }
|
18
|
+
end
|
19
|
+
|
20
|
+
describe '#issuer' do
|
21
|
+
subject { identifier.issuer }
|
22
|
+
|
23
|
+
it { expect(subject).to eq "CMS" }
|
24
|
+
end
|
25
|
+
|
26
|
+
describe '#state' do
|
27
|
+
subject { identifier.state }
|
28
|
+
|
29
|
+
it { expect(subject).to eq "CT" }
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '#type' do
|
33
|
+
subject { identifier.type }
|
34
|
+
|
35
|
+
it { expect(subject).to eq "medicaid" }
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,144 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
require 'JSON'
|
3
|
+
|
4
|
+
describe BloomApi::Individual do
|
5
|
+
|
6
|
+
let(:provider_params) { JSON.parse(
|
7
|
+
'{
|
8
|
+
"business_address":{
|
9
|
+
"address_details_line":"APT 1A",
|
10
|
+
"address_line":"45 W 11TH ST",
|
11
|
+
"city":"NEW YORK",
|
12
|
+
"country_code":"US",
|
13
|
+
"state":"NY",
|
14
|
+
"zip":"100118664"
|
15
|
+
},
|
16
|
+
"credential":"MD",
|
17
|
+
"deactivation_date":"2006-05-23T00:00:00.000Z",
|
18
|
+
"deactivation_reason":"death",
|
19
|
+
"enumeration_date":"2007-09-15T00:00:00.000Z",
|
20
|
+
"first_name":"VINCENT",
|
21
|
+
"gender":"male",
|
22
|
+
"last_name":"GRAZIANO",
|
23
|
+
"last_update_date":"2007-09-15T00:00:00.000Z",
|
24
|
+
"middle_name":"J",
|
25
|
+
"name_prefix":"DR.",
|
26
|
+
"name_suffix":"III",
|
27
|
+
"npi":"1003002809",
|
28
|
+
"other_first_name":"Donald",
|
29
|
+
"other_last_name":"Duck",
|
30
|
+
"other_middle_name":"D",
|
31
|
+
"other_name_prefix":"Mr.",
|
32
|
+
"other_name_suffix":"Jr.",
|
33
|
+
"other_name_type": "individual",
|
34
|
+
"other_credential": "CSW",
|
35
|
+
"practice_address":{
|
36
|
+
"address_details_line":"APT 1A",
|
37
|
+
"address_line":"45 W 11TH ST",
|
38
|
+
"city":"NEW YORK",
|
39
|
+
"country_code":"US",
|
40
|
+
"phone":"6464072044",
|
41
|
+
"state":"NY",
|
42
|
+
"zip":"100118664"
|
43
|
+
},
|
44
|
+
"provider_details":[
|
45
|
+
{
|
46
|
+
"healthcare_taxonomy_code":"2085R0202X",
|
47
|
+
"license_number":"00243641",
|
48
|
+
"taxonomy_switch":"yes"
|
49
|
+
}
|
50
|
+
],
|
51
|
+
"provider_other_last_name_type_code":"former name",
|
52
|
+
"reactivation_date":"2006-09-23T00:00:00.000Z",
|
53
|
+
"replacement_npi":"1234567890",
|
54
|
+
"sole_proprietor":"yes",
|
55
|
+
"type":"individual",
|
56
|
+
"title":"Chief Medical Officer"
|
57
|
+
}'
|
58
|
+
)}
|
59
|
+
|
60
|
+
let(:provider) { BloomApi::Individual.new(provider_params) }
|
61
|
+
|
62
|
+
describe '#credential' do
|
63
|
+
subject { provider.credential }
|
64
|
+
|
65
|
+
it { expect(subject).to eq 'MD' }
|
66
|
+
end
|
67
|
+
|
68
|
+
describe '#first_name' do
|
69
|
+
subject { provider.first_name }
|
70
|
+
|
71
|
+
it { expect(subject).to eq 'VINCENT' }
|
72
|
+
end
|
73
|
+
|
74
|
+
describe '#gender' do
|
75
|
+
subject { provider.gender }
|
76
|
+
|
77
|
+
it { expect(subject).to eq 'male' }
|
78
|
+
end
|
79
|
+
|
80
|
+
describe '#last_name' do
|
81
|
+
subject { provider.last_name }
|
82
|
+
|
83
|
+
it { expect(subject).to eq 'GRAZIANO' }
|
84
|
+
end
|
85
|
+
|
86
|
+
describe '#middle_name' do
|
87
|
+
subject { provider.middle_name }
|
88
|
+
|
89
|
+
it { expect(subject).to eq 'J' }
|
90
|
+
end
|
91
|
+
|
92
|
+
describe '#name_prefix' do
|
93
|
+
subject { provider.name_prefix }
|
94
|
+
it { expect(subject).to eq 'DR.' }
|
95
|
+
end
|
96
|
+
|
97
|
+
describe '#name_suffix' do
|
98
|
+
subject { provider.name_suffix }
|
99
|
+
it { expect(subject).to eq 'III' }
|
100
|
+
end
|
101
|
+
|
102
|
+
describe '#other_credential' do
|
103
|
+
subject { provider.other_credential }
|
104
|
+
|
105
|
+
it { expect(subject).to eq 'CSW' }
|
106
|
+
end
|
107
|
+
|
108
|
+
describe '#other_first_name' do
|
109
|
+
subject { provider.other_first_name }
|
110
|
+
|
111
|
+
it { expect(subject).to eq 'Donald' }
|
112
|
+
end
|
113
|
+
|
114
|
+
describe '#other_last_name' do
|
115
|
+
subject { provider.other_last_name }
|
116
|
+
|
117
|
+
it { expect(subject).to eq 'Duck' }
|
118
|
+
end
|
119
|
+
|
120
|
+
describe '#other_middle_name' do
|
121
|
+
subject { provider.other_middle_name }
|
122
|
+
|
123
|
+
it { expect(subject).to eq 'D' }
|
124
|
+
end
|
125
|
+
|
126
|
+
describe '#other_name_prefix' do
|
127
|
+
subject { provider.other_name_prefix }
|
128
|
+
|
129
|
+
it { expect(subject).to eq 'Mr.' }
|
130
|
+
end
|
131
|
+
|
132
|
+
describe '#other_name_suffix' do
|
133
|
+
subject { provider.other_name_suffix }
|
134
|
+
|
135
|
+
it { expect(subject).to eq 'Jr.' }
|
136
|
+
end
|
137
|
+
|
138
|
+
describe '#other_last_name_type_code' do
|
139
|
+
subject { provider.other_last_name_type_code }
|
140
|
+
|
141
|
+
it { expect(subject).to eq 'former name'}
|
142
|
+
end
|
143
|
+
|
144
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
describe BloomApi::OrganizationOfficial do
|
4
|
+
|
5
|
+
let(:official_params) {{
|
6
|
+
"credential" => "MPH",
|
7
|
+
"first_name" => "AUDREY",
|
8
|
+
"middle_name" => "ROSE",
|
9
|
+
"last_name" => "MEYERS",
|
10
|
+
"name_prefix" => "MS.",
|
11
|
+
"name_suffix" => "Ruler of the Planet Omicron Persei VIII",
|
12
|
+
"phone" => "2014478021",
|
13
|
+
"title" => "PRESIDENT & CEO"
|
14
|
+
}}
|
15
|
+
|
16
|
+
let(:official) { BloomApi::OrganizationOfficial.new(official_params) }
|
17
|
+
|
18
|
+
describe '#credential' do
|
19
|
+
subject { official.credential }
|
20
|
+
|
21
|
+
it { expect(subject).to eq 'MPH' }
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#first_name' do
|
25
|
+
subject { official.first_name }
|
26
|
+
|
27
|
+
it { expect(subject).to eq 'AUDREY' }
|
28
|
+
end
|
29
|
+
|
30
|
+
describe '#last_name' do
|
31
|
+
subject { official.last_name }
|
32
|
+
|
33
|
+
it { expect(subject).to eq 'MEYERS' }
|
34
|
+
end
|
35
|
+
|
36
|
+
describe '#middle_name' do
|
37
|
+
subject { official.middle_name }
|
38
|
+
|
39
|
+
it { expect(subject).to eq 'ROSE' }
|
40
|
+
end
|
41
|
+
|
42
|
+
describe '#name_prefix' do
|
43
|
+
subject { official.name_prefix }
|
44
|
+
|
45
|
+
it { expect(subject).to eq 'MS.' }
|
46
|
+
end
|
47
|
+
|
48
|
+
describe '#name_suffix' do
|
49
|
+
subject { official.name_suffix }
|
50
|
+
|
51
|
+
it { expect(subject).to eq 'Ruler of the Planet Omicron Persei VIII' }
|
52
|
+
end
|
53
|
+
|
54
|
+
describe '#phone' do
|
55
|
+
subject { official.phone }
|
56
|
+
|
57
|
+
it { expect(subject).to eq '2014478021' }
|
58
|
+
end
|
59
|
+
|
60
|
+
describe '#title' do
|
61
|
+
subject { official.title }
|
62
|
+
it { expect(subject).to eq 'PRESIDENT & CEO' }
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,156 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
require 'JSON'
|
3
|
+
|
4
|
+
describe BloomApi::Organization do
|
5
|
+
|
6
|
+
let(:organization_prams) {JSON.parse('{
|
7
|
+
"business_address":{
|
8
|
+
"address_line":"223 N VAN DIEN AVE",
|
9
|
+
"city":"RIDGEWOOD",
|
10
|
+
"country_code":"US",
|
11
|
+
"phone":"2014478000",
|
12
|
+
"state":"NJ",
|
13
|
+
"zip":"074502726"
|
14
|
+
},
|
15
|
+
"business_name":"THE VALLEY HOSPITAL INC.",
|
16
|
+
"employer_identification_number":"123456",
|
17
|
+
"enumeration_date":"2005-06-20T00:00:00.000Z",
|
18
|
+
"last_update_date":"2008-11-25T00:00:00.000Z",
|
19
|
+
"npi":"1013912633",
|
20
|
+
"organization_official":{
|
21
|
+
"first_name":"AUDREY",
|
22
|
+
"last_name":"MEYERS",
|
23
|
+
"name_prefix":"MS.",
|
24
|
+
"phone":"2014478021",
|
25
|
+
"title":"PRESIDENT \u0026 CEO"
|
26
|
+
},
|
27
|
+
"organization_subpart":"no",
|
28
|
+
"other_identifiers":[
|
29
|
+
{
|
30
|
+
"identifier":"4135806",
|
31
|
+
"state":"NJ",
|
32
|
+
"type":"medicaid"
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"identifier":"310012",
|
36
|
+
"state":"NJ",
|
37
|
+
"type":"medicare oscar/certification"
|
38
|
+
}
|
39
|
+
],
|
40
|
+
"other_name":"THE VALLEY HOSPITAL INCORPORATED",
|
41
|
+
"parent_org":{
|
42
|
+
"business_name": "Acme Hosptial Inc.",
|
43
|
+
"tax_identification_number": "T123IN324"
|
44
|
+
},
|
45
|
+
"practice_address":{
|
46
|
+
"address_line":"223 N VAN DIEN AVE",
|
47
|
+
"city":"RIDGEWOOD",
|
48
|
+
"country_code":"US",
|
49
|
+
"phone":"2014478000",
|
50
|
+
"state":"NJ",
|
51
|
+
"zip":"074502726"
|
52
|
+
},
|
53
|
+
"provider_details":[
|
54
|
+
{
|
55
|
+
"healthcare_taxonomy_code":"282N00000X",
|
56
|
+
"license_number":"10211",
|
57
|
+
"taxonomy_switch":"yes"
|
58
|
+
}
|
59
|
+
],
|
60
|
+
"tax_identification_number":"T123IN323",
|
61
|
+
"type":"organization"
|
62
|
+
}')}
|
63
|
+
|
64
|
+
let(:organization) { BloomApi::Organization.new(organization_prams) }
|
65
|
+
|
66
|
+
describe '#name' do
|
67
|
+
subject { organization.name }
|
68
|
+
|
69
|
+
it { expect(subject).to eq 'THE VALLEY HOSPITAL INC.' }
|
70
|
+
end
|
71
|
+
|
72
|
+
describe '#employer_identification_number' do
|
73
|
+
subject { organization.employer_identification_number }
|
74
|
+
|
75
|
+
it { expect(subject).to eq '123456' }
|
76
|
+
|
77
|
+
context 'when unavailable' do
|
78
|
+
before { organization_prams['employer_identification_number'] = '<UNAVAIL>' }
|
79
|
+
|
80
|
+
it { expect(subject).to be_nil }
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
describe '#official' do
|
85
|
+
subject { organization.official }
|
86
|
+
|
87
|
+
it 'returns an organization official object' do
|
88
|
+
expect(subject).to be_a BloomApi::OrganizationOfficial
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'returns an object with the right values' do
|
92
|
+
expect(subject.first_name).to eq "AUDREY"
|
93
|
+
expect(subject.last_name).to eq "MEYERS"
|
94
|
+
expect(subject.name_prefix).to eq "MS."
|
95
|
+
expect(subject.phone).to eq "2014478021"
|
96
|
+
expect(subject.title).to eq "PRESIDENT & CEO"
|
97
|
+
end
|
98
|
+
|
99
|
+
context 'when official is not present' do
|
100
|
+
before { organization_prams.delete('organization_official') }
|
101
|
+
|
102
|
+
it { expect(subject).to be_nil }
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
describe '#is_subpart?' do
|
107
|
+
subject { organization.is_subpart? }
|
108
|
+
|
109
|
+
context 'yes' do
|
110
|
+
before { organization_prams['organization_subpart'] = 'yes' }
|
111
|
+
|
112
|
+
it { expect(subject).to eq true }
|
113
|
+
end
|
114
|
+
|
115
|
+
context 'no' do
|
116
|
+
it { expect(subject).to eq false }
|
117
|
+
end
|
118
|
+
|
119
|
+
context 'no answer' do
|
120
|
+
before { organization_prams['organization_subpart'] = 'no answer' }
|
121
|
+
|
122
|
+
it { expect(subject).to be_nil }
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
describe '#other_name' do
|
127
|
+
subject { organization.other_name }
|
128
|
+
|
129
|
+
it { expect(subject).to eq 'THE VALLEY HOSPITAL INCORPORATED' }
|
130
|
+
end
|
131
|
+
|
132
|
+
describe '#parent_organization' do
|
133
|
+
subject { organization.parent_organization }
|
134
|
+
|
135
|
+
it 'returns an organization' do
|
136
|
+
expect(subject).to be_a BloomApi::Organization
|
137
|
+
end
|
138
|
+
|
139
|
+
it 'has the right values' do
|
140
|
+
expect(subject.name).to eq 'Acme Hosptial Inc.'
|
141
|
+
end
|
142
|
+
|
143
|
+
context 'when parent organization is not present' do
|
144
|
+
before { organization_prams.delete('parent_org') }
|
145
|
+
|
146
|
+
it { expect(subject).to be_nil }
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
describe '#tax_identification_number' do
|
151
|
+
subject { organization.tax_identification_number }
|
152
|
+
|
153
|
+
it { expect(subject).to eq 'T123IN323' }
|
154
|
+
end
|
155
|
+
|
156
|
+
end
|