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,222 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
require 'JSON'
|
3
|
+
|
4
|
+
describe BloomApi::Provider do
|
5
|
+
|
6
|
+
let(:provider_params) { JSON.parse(
|
7
|
+
'{
|
8
|
+
"business_address":{
|
9
|
+
"address_details_line":"SUITE 200",
|
10
|
+
"address_line":"421 34TH ST",
|
11
|
+
"city":"PASADENA",
|
12
|
+
"country_code":"US",
|
13
|
+
"state":"CA",
|
14
|
+
"zip":"54321"
|
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
|
+
"name_prefix":"DR.",
|
25
|
+
"npi":"1003002809",
|
26
|
+
"other_name_type": "individual",
|
27
|
+
"other_identifiers":[
|
28
|
+
{
|
29
|
+
"identifier": "4394003",
|
30
|
+
"state": "CT",
|
31
|
+
"type": "medicaid",
|
32
|
+
"issuer": "CMS"
|
33
|
+
}
|
34
|
+
],
|
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
|
+
"reactivation_date":"2006-09-23T00:00:00.000Z",
|
52
|
+
"replacement_npi":"1234567890",
|
53
|
+
"sole_proprietor":"yes",
|
54
|
+
"taxonomy_groups":[
|
55
|
+
{"taxonomy":"193200000X"},
|
56
|
+
{"taxonomy":"193400000X"}
|
57
|
+
],
|
58
|
+
"type":"individual"
|
59
|
+
}'
|
60
|
+
)}
|
61
|
+
|
62
|
+
let(:provider) { BloomApi::Provider.new(provider_params) }
|
63
|
+
|
64
|
+
describe '#business_address' do
|
65
|
+
subject { provider.business_address }
|
66
|
+
|
67
|
+
it 'returns an address object' do
|
68
|
+
expect(subject).to be_a_kind_of BloomApi::Address
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'uses the correct address' do
|
72
|
+
expect(subject.line1).to eq '421 34TH ST'
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
describe '#deactivation_date' do
|
77
|
+
subject { provider.deactivation_date }
|
78
|
+
|
79
|
+
it { expect(subject).to eq Date.new(2006,5,23) }
|
80
|
+
|
81
|
+
context 'when nil' do
|
82
|
+
before { provider_params.delete 'deactivation_date' }
|
83
|
+
|
84
|
+
it { expect(subject).to be_nil }
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
describe '#deactivation_reason' do
|
89
|
+
subject { provider.deactivation_reason }
|
90
|
+
|
91
|
+
it { expect(subject).to eq 'death' }
|
92
|
+
end
|
93
|
+
|
94
|
+
describe '#npi' do
|
95
|
+
subject { provider.npi }
|
96
|
+
|
97
|
+
it { expect(subject).to eq '1003002809' }
|
98
|
+
end
|
99
|
+
|
100
|
+
describe '#other_identifiers' do
|
101
|
+
subject { provider.other_identifiers }
|
102
|
+
|
103
|
+
it 'gets all the other identifiers' do
|
104
|
+
expect(subject.count).to eq 1
|
105
|
+
end
|
106
|
+
|
107
|
+
it 'returns an array of identifier objects' do
|
108
|
+
expect(subject.first).to be_a_kind_of BloomApi::Identifier
|
109
|
+
end
|
110
|
+
|
111
|
+
it 'fills in the right information' do
|
112
|
+
expect(subject.first.identifier).to eq '4394003'
|
113
|
+
end
|
114
|
+
|
115
|
+
context 'when no other identifiers are present' do
|
116
|
+
before { provider_params.delete('other_identifiers' )}
|
117
|
+
it { expect(subject).to be_nil }
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
describe '#other_name_type' do
|
122
|
+
subject { provider.other_name_type }
|
123
|
+
|
124
|
+
it { expect(subject).to eq 'individual'}
|
125
|
+
end
|
126
|
+
|
127
|
+
describe '#practice_address' do
|
128
|
+
subject { provider.practice_address }
|
129
|
+
|
130
|
+
it 'returns an address object' do
|
131
|
+
expect(subject).to be_a_kind_of BloomApi::Address
|
132
|
+
end
|
133
|
+
|
134
|
+
it 'returns the correct address' do
|
135
|
+
expect(subject.line1).to eq "45 W 11TH ST"
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
describe '#specialties' do
|
140
|
+
subject { provider.specialties }
|
141
|
+
|
142
|
+
it 'returns an array of specialties' do
|
143
|
+
expect(subject.first).to be_a BloomApi::Specialty
|
144
|
+
end
|
145
|
+
|
146
|
+
it 'uses the correct data' do
|
147
|
+
expect(subject.first.specialty_code).to eq '2085R0202X'
|
148
|
+
end
|
149
|
+
|
150
|
+
context 'when no specialties are provided' do
|
151
|
+
before { provider_params.delete('provider_details') }
|
152
|
+
|
153
|
+
it { expect(subject).to be_nil }
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
describe '#reactivation_date' do
|
158
|
+
subject { provider.reactivation_date }
|
159
|
+
|
160
|
+
it { expect(subject).to eq Date.new(2006,9,23) }
|
161
|
+
|
162
|
+
context 'when there is no reactivation date' do
|
163
|
+
before { provider_params.delete 'reactivation_date' }
|
164
|
+
|
165
|
+
it { expect(subject).to be_nil }
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
describe '#recorded_at' do
|
170
|
+
subject { provider.recorded_at }
|
171
|
+
|
172
|
+
it { expect(subject).to eq Time.parse(provider_params['enumeration_date']).to_date }
|
173
|
+
end
|
174
|
+
|
175
|
+
describe '#replacement_npi' do
|
176
|
+
subject { provider.replacement_npi }
|
177
|
+
|
178
|
+
it { expect(subject).to eq '1234567890' }
|
179
|
+
end
|
180
|
+
|
181
|
+
describe '#sole_proprietor?' do
|
182
|
+
subject { provider.sole_proprietor? }
|
183
|
+
|
184
|
+
context 'yes' do
|
185
|
+
it { expect(subject).to eq true }
|
186
|
+
end
|
187
|
+
|
188
|
+
context 'no' do
|
189
|
+
before { provider_params['sole_proprietor'] = 'no' }
|
190
|
+
it { expect(subject).to eq false }
|
191
|
+
end
|
192
|
+
|
193
|
+
context 'not answered' do
|
194
|
+
before { provider_params['sole_proprietor'] = 'not answered' }
|
195
|
+
|
196
|
+
it { expect(subject).to be_nil }
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
describe '#taxonomy_groups' do
|
201
|
+
subject { provider.taxonomy_groups }
|
202
|
+
|
203
|
+
it { expect(subject.count).to eq 2 }
|
204
|
+
|
205
|
+
it 'returns the right values' do
|
206
|
+
expect(subject[0]).to eq '193200000X'
|
207
|
+
expect(subject[1]).to eq '193400000X'
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
describe '#type' do
|
212
|
+
subject { provider.type }
|
213
|
+
|
214
|
+
it { expect(subject).to eq 'individual' }
|
215
|
+
end
|
216
|
+
|
217
|
+
describe '#updated_at' do
|
218
|
+
subject { provider.updated_at }
|
219
|
+
|
220
|
+
it { expect(subject).to eq Time.parse(provider_params['last_update_date']).to_date}
|
221
|
+
end
|
222
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
describe BloomApi::Specialty do
|
4
|
+
|
5
|
+
let (:specialty_params) {{
|
6
|
+
"healthcare_taxonomy_code" => "2085R0202X",
|
7
|
+
"license_number" => "00243641",
|
8
|
+
"license_number_state" => "state",
|
9
|
+
"taxonomy_switch" => "yes"
|
10
|
+
}}
|
11
|
+
|
12
|
+
let(:specialty) { BloomApi::Specialty.new(specialty_params) }
|
13
|
+
|
14
|
+
|
15
|
+
describe '#license_number' do
|
16
|
+
subject { specialty.license_number }
|
17
|
+
|
18
|
+
it { expect(subject).to eq '00243641' }
|
19
|
+
end
|
20
|
+
|
21
|
+
describe '#license_number_state' do
|
22
|
+
subject { specialty.license_number_state }
|
23
|
+
|
24
|
+
it { expect(subject).to eq 'state' }
|
25
|
+
end
|
26
|
+
|
27
|
+
describe '#specialty_code' do
|
28
|
+
subject { specialty.specialty_code }
|
29
|
+
|
30
|
+
it { expect(subject).to eq '2085R0202X' }
|
31
|
+
end
|
32
|
+
|
33
|
+
describe '#primary_specialty?' do
|
34
|
+
subject { specialty.primary_specialty? }
|
35
|
+
|
36
|
+
context 'yes' do
|
37
|
+
it { expect(subject).to eq true }
|
38
|
+
end
|
39
|
+
|
40
|
+
context 'no' do
|
41
|
+
before { specialty_params['taxonomy_switch'] = 'no' }
|
42
|
+
it { expect(subject).to eq false }
|
43
|
+
end
|
44
|
+
|
45
|
+
context 'not answered' do
|
46
|
+
before { specialty_params['taxonomy_switch'] = 'not answered' }
|
47
|
+
|
48
|
+
it { expect(subject).to be_nil }
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require_relative './spec_helper'
|
2
|
+
require 'JSON'
|
3
|
+
|
4
|
+
describe BloomApi do
|
5
|
+
|
6
|
+
describe '#find_by_npi' do
|
7
|
+
|
8
|
+
subject { BloomApi.find_by_npi(npi) }
|
9
|
+
|
10
|
+
|
11
|
+
context 'when given a valid npi' do
|
12
|
+
context 'for an individual' do
|
13
|
+
let(:npi) { '1003002809' }
|
14
|
+
|
15
|
+
it { expect(subject).to be_a BloomApi::Individual }
|
16
|
+
|
17
|
+
it 'returns the right provider' do
|
18
|
+
provider = subject
|
19
|
+
expect(provider.npi).to eq '1003002809'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context 'for an organization' do
|
24
|
+
let(:npi) { '1013191311' }
|
25
|
+
|
26
|
+
it { expect(subject).to be_a BloomApi::Organization }
|
27
|
+
|
28
|
+
it 'returns the right provider' do
|
29
|
+
expect(subject.npi).to eq '1013191311'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'when type is not present' do
|
34
|
+
let(:npi) { '1003998626' }
|
35
|
+
|
36
|
+
it { expect(subject).to be_a BloomApi::Provider }
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
context 'when given an invalid npi' do
|
42
|
+
let(:npi) { 'bogus_npi' }
|
43
|
+
|
44
|
+
it 'returns nil' do
|
45
|
+
expect(subject).to be_nil
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bloom_api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Daniel Carpenter
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-12-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: A ruby gem for accessing data from any instance of the Bloom API. For
|
56
|
+
more informatoin, visit http://www.bloomapi.com/
|
57
|
+
email:
|
58
|
+
- daniel.carpenter01@gmail.com
|
59
|
+
executables: []
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- ".yardopts"
|
65
|
+
- Gemfile
|
66
|
+
- Gemfile.lock
|
67
|
+
- LICENSE.txt
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- bloom_api.gemspec
|
71
|
+
- lib/bloom_api.rb
|
72
|
+
- lib/bloom_api/address.rb
|
73
|
+
- lib/bloom_api/identifier.rb
|
74
|
+
- lib/bloom_api/individual.rb
|
75
|
+
- lib/bloom_api/organization.rb
|
76
|
+
- lib/bloom_api/organization_official.rb
|
77
|
+
- lib/bloom_api/provider.rb
|
78
|
+
- lib/bloom_api/specialty.rb
|
79
|
+
- lib/bloom_api/version.rb
|
80
|
+
- spec/bloom_api/address_spec.rb
|
81
|
+
- spec/bloom_api/api_spec.rb
|
82
|
+
- spec/bloom_api/identifier_spec.rb
|
83
|
+
- spec/bloom_api/individual_spec.rb
|
84
|
+
- spec/bloom_api/organization_official_spec.rb
|
85
|
+
- spec/bloom_api/organization_spec.rb
|
86
|
+
- spec/bloom_api/provider_lookup_spec.rb
|
87
|
+
- spec/bloom_api/provider_spec.rb
|
88
|
+
- spec/bloom_api/specialty_spec.rb
|
89
|
+
- spec/bloom_api_spec.rb
|
90
|
+
- spec/spec_helper.rb
|
91
|
+
homepage: https://github.com/carp47/bloom_api
|
92
|
+
licenses:
|
93
|
+
- MIT
|
94
|
+
metadata: {}
|
95
|
+
post_install_message:
|
96
|
+
rdoc_options: []
|
97
|
+
require_paths:
|
98
|
+
- lib
|
99
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
requirements: []
|
110
|
+
rubyforge_project:
|
111
|
+
rubygems_version: 2.2.2
|
112
|
+
signing_key:
|
113
|
+
specification_version: 4
|
114
|
+
summary: A gem for retrieving data from the Bloom API.
|
115
|
+
test_files:
|
116
|
+
- spec/bloom_api/address_spec.rb
|
117
|
+
- spec/bloom_api/api_spec.rb
|
118
|
+
- spec/bloom_api/identifier_spec.rb
|
119
|
+
- spec/bloom_api/individual_spec.rb
|
120
|
+
- spec/bloom_api/organization_official_spec.rb
|
121
|
+
- spec/bloom_api/organization_spec.rb
|
122
|
+
- spec/bloom_api/provider_lookup_spec.rb
|
123
|
+
- spec/bloom_api/provider_spec.rb
|
124
|
+
- spec/bloom_api/specialty_spec.rb
|
125
|
+
- spec/bloom_api_spec.rb
|
126
|
+
- spec/spec_helper.rb
|
127
|
+
has_rdoc:
|