pokitdok-ruby 0.7.4 → 0.8.0
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 +4 -4
- data/Gemfile +0 -1
- data/Gemfile.lock +34 -20
- data/README.md +25 -1
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/lib/OAuthApplicationClient.rb +149 -0
- data/lib/pokitdok.rb +157 -194
- data/pokitdok-ruby.gemspec +8 -27
- data/spec/fixtures/acme_inc_supplemental_identifiers.834 +35 -0
- data/spec/fixtures/chiropractic_example.837 +33 -0
- data/spec/fixtures/identity_match.json +29 -0
- data/spec/pokitdok_spec.rb +578 -261
- data/spec/spec_helper.rb +1 -1
- metadata +6 -36
- data/spec/vcr_setup.rb +0 -11
- data/vcr_cassettes/activities.yml +0 -66
- data/vcr_cassettes/auth.yml +0 -41
- data/vcr_cassettes/authorizations.yml +0 -57
- data/vcr_cassettes/cash_prices.yml +0 -45
- data/vcr_cassettes/claims.yml +0 -72
- data/vcr_cassettes/claims_status.yml +0 -67
- data/vcr_cassettes/eligibility.yml +0 -144
- data/vcr_cassettes/enrollment.yml +0 -83
- data/vcr_cassettes/files.yml +0 -112
- data/vcr_cassettes/insurance_prices.yml +0 -48
- data/vcr_cassettes/payers.yml +0 -505
- data/vcr_cassettes/plans.yml +0 -134
- data/vcr_cassettes/plans_no_args.yml +0 -133
- data/vcr_cassettes/providers.yml +0 -113
- data/vcr_cassettes/referrals.yml +0 -56
- data/vcr_cassettes/scheduling.yml +0 -182
- data/vcr_cassettes/scheduling_scoped.yml +0 -223
- data/vcr_cassettes/trading_partners_get.yml +0 -43
- data/vcr_cassettes/trading_partners_index.yml +0 -390
data/pokitdok-ruby.gemspec
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
|
5
|
-
# stub: pokitdok-ruby 0.
|
|
5
|
+
# stub: pokitdok-ruby 0.8.0 ruby lib
|
|
6
6
|
|
|
7
7
|
Gem::Specification.new do |s|
|
|
8
8
|
s.name = "pokitdok-ruby"
|
|
9
|
-
s.version = "0.
|
|
9
|
+
s.version = "0.8.0"
|
|
10
10
|
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
12
12
|
s.require_paths = ["lib"]
|
|
13
13
|
s.authors = ["PokitDok, Inc."]
|
|
14
|
-
s.date = "2016-
|
|
14
|
+
s.date = "2016-07-13"
|
|
15
15
|
s.description = "Gem for easy access to the PokitDok Platform APIs."
|
|
16
16
|
s.email = "platform@pokitdok.com"
|
|
17
17
|
s.extra_rdoc_files = [
|
|
@@ -28,36 +28,20 @@ Gem::Specification.new do |s|
|
|
|
28
28
|
"README.md",
|
|
29
29
|
"Rakefile",
|
|
30
30
|
"VERSION",
|
|
31
|
+
"lib/OAuthApplicationClient.rb",
|
|
31
32
|
"lib/pokitdok.rb",
|
|
32
33
|
"pokitdok-ruby.gemspec",
|
|
34
|
+
"spec/fixtures/acme_inc_supplemental_identifiers.834",
|
|
33
35
|
"spec/fixtures/authorizations.json",
|
|
36
|
+
"spec/fixtures/chiropractic_example.837",
|
|
34
37
|
"spec/fixtures/claim.json",
|
|
35
38
|
"spec/fixtures/claims_status.json",
|
|
36
39
|
"spec/fixtures/enrollment.json",
|
|
40
|
+
"spec/fixtures/identity_match.json",
|
|
37
41
|
"spec/fixtures/referrals.json",
|
|
38
42
|
"spec/fixtures/sample.270",
|
|
39
43
|
"spec/pokitdok_spec.rb",
|
|
40
|
-
"spec/spec_helper.rb"
|
|
41
|
-
"spec/vcr_setup.rb",
|
|
42
|
-
"vcr_cassettes/activities.yml",
|
|
43
|
-
"vcr_cassettes/auth.yml",
|
|
44
|
-
"vcr_cassettes/authorizations.yml",
|
|
45
|
-
"vcr_cassettes/cash_prices.yml",
|
|
46
|
-
"vcr_cassettes/claims.yml",
|
|
47
|
-
"vcr_cassettes/claims_status.yml",
|
|
48
|
-
"vcr_cassettes/eligibility.yml",
|
|
49
|
-
"vcr_cassettes/enrollment.yml",
|
|
50
|
-
"vcr_cassettes/files.yml",
|
|
51
|
-
"vcr_cassettes/insurance_prices.yml",
|
|
52
|
-
"vcr_cassettes/payers.yml",
|
|
53
|
-
"vcr_cassettes/plans.yml",
|
|
54
|
-
"vcr_cassettes/plans_no_args.yml",
|
|
55
|
-
"vcr_cassettes/providers.yml",
|
|
56
|
-
"vcr_cassettes/referrals.yml",
|
|
57
|
-
"vcr_cassettes/scheduling.yml",
|
|
58
|
-
"vcr_cassettes/scheduling_scoped.yml",
|
|
59
|
-
"vcr_cassettes/trading_partners_get.yml",
|
|
60
|
-
"vcr_cassettes/trading_partners_index.yml"
|
|
44
|
+
"spec/spec_helper.rb"
|
|
61
45
|
]
|
|
62
46
|
s.homepage = "http://github.com/pokitdok/pokitdok-ruby"
|
|
63
47
|
s.licenses = ["MIT"]
|
|
@@ -79,7 +63,6 @@ Gem::Specification.new do |s|
|
|
|
79
63
|
s.add_development_dependency(%q<jeweler>, ["~> 2.0"])
|
|
80
64
|
s.add_development_dependency(%q<ansi>, ["~> 1.4"])
|
|
81
65
|
s.add_development_dependency(%q<minitest-reporters>, ["~> 1.0"])
|
|
82
|
-
s.add_development_dependency(%q<vcr>, ["~> 2.9"])
|
|
83
66
|
s.add_development_dependency(%q<webmock>, ["~> 1.17"])
|
|
84
67
|
s.add_development_dependency(%q<guard>, ["~> 2.6"])
|
|
85
68
|
s.add_development_dependency(%q<guard-minitest>, ["~> 2.2"])
|
|
@@ -99,7 +82,6 @@ Gem::Specification.new do |s|
|
|
|
99
82
|
s.add_dependency(%q<jeweler>, ["~> 2.0"])
|
|
100
83
|
s.add_dependency(%q<ansi>, ["~> 1.4"])
|
|
101
84
|
s.add_dependency(%q<minitest-reporters>, ["~> 1.0"])
|
|
102
|
-
s.add_dependency(%q<vcr>, ["~> 2.9"])
|
|
103
85
|
s.add_dependency(%q<webmock>, ["~> 1.17"])
|
|
104
86
|
s.add_dependency(%q<guard>, ["~> 2.6"])
|
|
105
87
|
s.add_dependency(%q<guard-minitest>, ["~> 2.2"])
|
|
@@ -120,7 +102,6 @@ Gem::Specification.new do |s|
|
|
|
120
102
|
s.add_dependency(%q<jeweler>, ["~> 2.0"])
|
|
121
103
|
s.add_dependency(%q<ansi>, ["~> 1.4"])
|
|
122
104
|
s.add_dependency(%q<minitest-reporters>, ["~> 1.0"])
|
|
123
|
-
s.add_dependency(%q<vcr>, ["~> 2.9"])
|
|
124
105
|
s.add_dependency(%q<webmock>, ["~> 1.17"])
|
|
125
106
|
s.add_dependency(%q<guard>, ["~> 2.6"])
|
|
126
107
|
s.add_dependency(%q<guard-minitest>, ["~> 2.2"])
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
ISA*03*MOCKINFO *01*MOCKINFO *30*MOCKID *30*RECEIVER *150807*1714*^*00501*000000001*1*T*:~
|
|
2
|
+
GS*BE*MOCKID*123LOCAL*20150807*1714*1*X*005010X220A1~
|
|
3
|
+
ST*834*0001*005010X220A1~
|
|
4
|
+
BGN*00*a4db5c6981cb418eab3401fa36dbf1b6*20150807*1714****2~
|
|
5
|
+
N1*P5*ACME INC*FI*123456789~
|
|
6
|
+
N1*IN*GET WELL COMPANY*FI*953760001~
|
|
7
|
+
INS*Y*18*021*20*A***FT~
|
|
8
|
+
REF*0F*777999542~
|
|
9
|
+
REF*1L*A64692~
|
|
10
|
+
REF*17*Client Reporting Category~
|
|
11
|
+
REF*23*Client Number~
|
|
12
|
+
REF*3H*Case Number~
|
|
13
|
+
REF*4A*Personal Identification Number (PIN)~
|
|
14
|
+
REF*6O*Cross Reference Number~
|
|
15
|
+
REF*ABB*Personal ID Number~
|
|
16
|
+
REF*D3*Prescription Drug Programs Pharmacy Number~
|
|
17
|
+
REF*DX*Department/Agency Number~
|
|
18
|
+
REF*F6*Health Insurance Claim (HIC) Number~
|
|
19
|
+
REF*P5*Position Code~
|
|
20
|
+
REF*Q4*Prior Identifier Number~
|
|
21
|
+
REF*QQ*Unit Number~
|
|
22
|
+
REF*ZZ*Mutually Defined~
|
|
23
|
+
DTP*356*D8*20150901~
|
|
24
|
+
DTP*336*D8*20150802~
|
|
25
|
+
NM1*IL*1*DOE*JOHN****34*777999542~
|
|
26
|
+
N3*123 MAIN ST~
|
|
27
|
+
N4*CANOGA PARK*CA*91303~
|
|
28
|
+
DMG*D8*19851111*M~
|
|
29
|
+
HD*021**PPO*1K4C~
|
|
30
|
+
DTP*348*D8*20150901~
|
|
31
|
+
HD*021**DEN*1QCS~
|
|
32
|
+
DTP*348*D8*20150901~
|
|
33
|
+
SE*19*0001~
|
|
34
|
+
GE*1*1~
|
|
35
|
+
IEA*1*000000001~
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
ISA*00* *00* *01*0000000000001 *01*0000000000002 *100822*1134*U*00200*000000007*0*T*:~
|
|
2
|
+
GS*HC*000000000001*000000000002*20100822*1615*7*X*005010X222A1~
|
|
3
|
+
ST*837*3701*005010X222A1~
|
|
4
|
+
BHT*0019*00*007227*20050215*075420*CH~
|
|
5
|
+
NM1*41*2*POKITDOK, INC*****46*1912301953~
|
|
6
|
+
PER*IC*FRONT DESK*TE*8001234567~
|
|
7
|
+
NM1*40*2*MEDICARE PART B*****46*12345~
|
|
8
|
+
HL*1**20*1~
|
|
9
|
+
NM1*85*1*CORBIN*BRIAN****XX*1467857193~
|
|
10
|
+
N3*123 MAIN ST~
|
|
11
|
+
N4*SOME TOWN*SC*123450123~
|
|
12
|
+
REF*EI*987654321~
|
|
13
|
+
PER*IC*THE DOCTOR*TE*8001234567~
|
|
14
|
+
HL*2*1*22*0~
|
|
15
|
+
SBR*P*18*******MB~
|
|
16
|
+
NM1*IL*1*DOE*JOHN*J***MI*123456789A~
|
|
17
|
+
N3*123 MAIN ST~
|
|
18
|
+
N4*A TOWN*SC*12345~
|
|
19
|
+
DMG*D8*19500101*M~
|
|
20
|
+
NM1*PR*2*MEDICARE PART B*****PI*12345~
|
|
21
|
+
CLM*CLAIM1*145.5***11:B:1*Y*A*Y*Y~
|
|
22
|
+
DTP*454*D8*20050115~
|
|
23
|
+
DTP*453*D8*20050110~
|
|
24
|
+
DTP*455*D8*20050113~
|
|
25
|
+
CR2********A**CHRONIC PAIN AND DISCOMFORT~
|
|
26
|
+
HI*BK:7215~
|
|
27
|
+
LX*1~
|
|
28
|
+
SV1*HC:98940*145.5*UN*1***1~
|
|
29
|
+
DTP*472*D8*20050215~
|
|
30
|
+
REF*6R*01~
|
|
31
|
+
SE*29*3701~
|
|
32
|
+
GE*1*7~
|
|
33
|
+
IEA*1*000000007~
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"data_filters": ["filter_a", "filter_b"],
|
|
3
|
+
"match_configuration": [
|
|
4
|
+
{
|
|
5
|
+
"source_field": "first_name",
|
|
6
|
+
"match_algorithm": "levenshtein",
|
|
7
|
+
"search_fields": ["nickname"],
|
|
8
|
+
"weight": 30
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"source_field": "middle_name",
|
|
12
|
+
"match_algorithm": "stemming",
|
|
13
|
+
"weight": 30
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"source_field": "last_name",
|
|
17
|
+
"match_algorithm": "soundex",
|
|
18
|
+
"weight": 30
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"source_field": "birth_date",
|
|
22
|
+
"match_algorithm": "exact",
|
|
23
|
+
"search_fields": ["dob", "date_of_birth"],
|
|
24
|
+
"weight": 10
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
"threshold": 80,
|
|
28
|
+
"callback_url": "https://platform.pokidok.com/callme?handler=thething"
|
|
29
|
+
}
|
data/spec/pokitdok_spec.rb
CHANGED
|
@@ -2,381 +2,698 @@
|
|
|
2
2
|
|
|
3
3
|
require 'spec_helper'
|
|
4
4
|
|
|
5
|
-
CLIENT_ID = '
|
|
6
|
-
CLIENT_SECRET = '
|
|
5
|
+
CLIENT_ID = 'F7q38MzlwOxUwTHb7jvk'
|
|
6
|
+
CLIENT_SECRET = 'O8DRamKmKMLtSTPjK99eUlbfOQEc44VVmp8ARmcY'
|
|
7
7
|
SCHEDULE_AUTH_CODE = 'KmCCkuYkSmPEf7AxaCIUApX1pUFedJx9CrDWPMD8'
|
|
8
|
-
|
|
8
|
+
BASE_URL = 'https://platform.pokitdok.com/v4/api'
|
|
9
|
+
MATCH_NETWORK_LOCATION = /(.*\.)?pokitdok\.com/
|
|
10
|
+
MATCH_OAUTH2_PATH = /[\/]oauth2[\/]token/
|
|
11
|
+
TEST_REQUEST_PATH = '/endpoint'
|
|
9
12
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
end
|
|
13
|
+
class PokitDokTest < MiniTest::Test
|
|
14
|
+
@@pokitdok = nil
|
|
15
|
+
@@current_request = nil
|
|
14
16
|
|
|
15
|
-
describe PokitDok do
|
|
16
|
-
describe 'Authenticated functions' do
|
|
17
|
-
before do
|
|
18
|
-
PokitDok::PokitDok.any_instance.stubs(:url_base).returns(POKITDOK_TEST_URL)
|
|
17
|
+
describe PokitDok do
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
@pokitdok = PokitDok::PokitDok.new(CLIENT_ID, CLIENT_SECRET)
|
|
22
|
-
@pokitdok.scope_code('user_schedule', SCHEDULE_AUTH_CODE)
|
|
23
|
-
end
|
|
24
|
-
end
|
|
19
|
+
describe 'Authenticated functions' do
|
|
25
20
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
let(:base_headers) {
|
|
22
|
+
{
|
|
23
|
+
:'User-Agent' => "#{@@pokitdok.user_agent}"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
let(:json_headers) {
|
|
27
|
+
{
|
|
28
|
+
:'User-Agent' => "#{@@pokitdok.user_agent}",
|
|
29
|
+
:'Content-Type'=> 'application/json'
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
let(:snub_auth) {
|
|
34
|
+
stub_request(:post, /#{MATCH_NETWORK_LOCATION}#{MATCH_OAUTH2_PATH}/).
|
|
35
|
+
to_return(
|
|
36
|
+
:status => 200,
|
|
37
|
+
:body => '{
|
|
38
|
+
"access_token": "s8KYRJGTO0rWMy0zz1CCSCwsSesDyDlbNdZoRqVR",
|
|
39
|
+
"token_type": "bearer",
|
|
40
|
+
"expires": 1393350569,
|
|
41
|
+
"expires_in": 3600
|
|
42
|
+
}',
|
|
43
|
+
:headers => {
|
|
44
|
+
'Server'=> 'nginx',
|
|
45
|
+
'Date' => Time.now(),
|
|
46
|
+
'Content-type' => 'application/json;charset=UTF-8',
|
|
47
|
+
'Connection' => 'keep-alive',
|
|
48
|
+
'Pragma' => 'no-cache',
|
|
49
|
+
'Cache-Control' => 'no-store'
|
|
50
|
+
}).times(2)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
before do
|
|
54
|
+
if @@pokitdok.nil?
|
|
55
|
+
snub_auth
|
|
56
|
+
|
|
57
|
+
@@pokitdok = PokitDok::PokitDok.new(CLIENT_ID, CLIENT_SECRET)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
29
60
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
61
|
+
describe 'Test token reuse' do
|
|
62
|
+
it 'should work with existing token' do
|
|
63
|
+
snub_auth
|
|
64
|
+
pokitdok_for_token = PokitDok::PokitDok.new(CLIENT_ID, CLIENT_SECRET)
|
|
65
|
+
first_token = pokitdok_for_token.token
|
|
66
|
+
|
|
67
|
+
snub_auth
|
|
68
|
+
pokitdok_with_old_token = PokitDok::PokitDok.new(CLIENT_ID, CLIENT_SECRET, nil, nil, nil, nil, nil, token=first_token)
|
|
69
|
+
second_token = pokitdok_with_old_token.token
|
|
70
|
+
|
|
71
|
+
stub_request(:get, MATCH_NETWORK_LOCATION).
|
|
72
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
73
|
+
assert first_token == second_token
|
|
74
|
+
results = pokitdok_with_old_token.activities
|
|
75
|
+
refute_nil(results)
|
|
76
|
+
|
|
77
|
+
snub_auth
|
|
78
|
+
pokitdok_for_new_token = PokitDok::PokitDok.new(CLIENT_ID, CLIENT_SECRET)
|
|
79
|
+
third_token = pokitdok_for_new_token.token
|
|
80
|
+
assert (first_token != third_token) && (second_token != third_token)
|
|
81
|
+
end
|
|
34
82
|
end
|
|
35
|
-
end
|
|
36
83
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
84
|
+
describe 'Test Connection' do
|
|
85
|
+
it 'should instantiate the api_client' do
|
|
86
|
+
refute_nil(@@pokitdok.api_client)
|
|
87
|
+
end
|
|
88
|
+
end
|
|
40
89
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
90
|
+
describe 'General Request method' do
|
|
91
|
+
it 'should test request post' do
|
|
92
|
+
stub_request(:post, MATCH_NETWORK_LOCATION).
|
|
93
|
+
to_return(lambda { |request|
|
|
94
|
+
@@current_request = request
|
|
95
|
+
{
|
|
96
|
+
status: 200,
|
|
97
|
+
body: '{ "string" : "" }'
|
|
98
|
+
}
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
@@pokitdok.request(TEST_REQUEST_PATH, 'POST', nil, {param: 'value'})
|
|
102
|
+
json_headers.each do |key, value|
|
|
103
|
+
assert_equal(value, @@current_request.headers["#{key}"])
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# NOTE: Currently this shows as an error in an IDE. I believe this is because it's
|
|
107
|
+
# a reserved property in Ruby
|
|
108
|
+
assert_equal('post', "#{@@current_request.method}")
|
|
109
|
+
end
|
|
110
|
+
it 'should test request put' do
|
|
111
|
+
stub_request(:put, MATCH_NETWORK_LOCATION).
|
|
112
|
+
to_return(lambda { |request|
|
|
113
|
+
@@current_request = request
|
|
114
|
+
{
|
|
115
|
+
status: 200,
|
|
116
|
+
body: '{ "string" : "" }'
|
|
117
|
+
}
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
@@pokitdok.request(TEST_REQUEST_PATH, 'PUT', nil, {param: 'value'})
|
|
121
|
+
json_headers.each do |key, value|
|
|
122
|
+
assert_equal(value, @@current_request.headers["#{key}"])
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
# NOTE: Currently this shows as an error in an IDE. I believe this is because it's
|
|
126
|
+
# a reserved property in Ruby
|
|
127
|
+
assert_equal('put', "#{@@current_request.method}")
|
|
128
|
+
end
|
|
129
|
+
it 'should test request get' do
|
|
130
|
+
stub_request(:get, MATCH_NETWORK_LOCATION).
|
|
131
|
+
to_return(lambda { |request|
|
|
132
|
+
@@current_request = request
|
|
133
|
+
{
|
|
134
|
+
status: 200,
|
|
135
|
+
body: '{ "string" : "" }'
|
|
136
|
+
}
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
@@pokitdok.request(TEST_REQUEST_PATH, 'GET', nil, {param: 'value'})
|
|
140
|
+
base_headers.each do |key, value|
|
|
141
|
+
assert_equal(value, @@current_request.headers["#{key}"])
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# NOTE: Currently this shows as an error in an IDE. I believe this is because it's
|
|
145
|
+
# a reserved property in Ruby
|
|
146
|
+
assert_equal('get', "#{@@current_request.method}")
|
|
147
|
+
end
|
|
148
|
+
it 'should test request delete' do
|
|
149
|
+
stub_request(:delete, MATCH_NETWORK_LOCATION).
|
|
150
|
+
to_return(lambda { |request|
|
|
151
|
+
@@current_request = request
|
|
152
|
+
{
|
|
153
|
+
status: 200,
|
|
154
|
+
body: '{ "string" : "" }'
|
|
155
|
+
}
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
@@pokitdok.request(TEST_REQUEST_PATH, 'DELETE', nil, {param: 'value'})
|
|
159
|
+
base_headers.each do |key, value|
|
|
160
|
+
assert_equal(value, @@current_request.headers["#{key}"])
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
# NOTE: Currently this shows as an error in an IDE. I believe this is because it's
|
|
164
|
+
# a reserved property in Ruby
|
|
165
|
+
assert_equal('delete', "#{@@current_request.method}")
|
|
166
|
+
end
|
|
167
|
+
end
|
|
44
168
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
169
|
+
describe 'Activities endpoint' do
|
|
170
|
+
it 'should expose the activities endpoint' do
|
|
171
|
+
stub_request(:get, MATCH_NETWORK_LOCATION).
|
|
172
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
48
173
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
VCR.use_cassette 'activities' do
|
|
52
|
-
@activities = @pokitdok.activities
|
|
174
|
+
@activities = @@pokitdok.activities
|
|
175
|
+
refute_nil(@activities)
|
|
53
176
|
end
|
|
54
177
|
|
|
55
|
-
|
|
56
|
-
|
|
178
|
+
it 'should expose the activities endpoint with an id parameter' do
|
|
179
|
+
stub_request(:get, MATCH_NETWORK_LOCATION).
|
|
180
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
181
|
+
|
|
182
|
+
@activities = @@pokitdok.activities(activity_id: 'activity_id')
|
|
183
|
+
refute_nil(@activities)
|
|
184
|
+
end
|
|
57
185
|
end
|
|
58
|
-
end
|
|
59
186
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
187
|
+
describe 'Cash Prices endpoint' do
|
|
188
|
+
it 'should expose the cash prices endpoint' do
|
|
189
|
+
stub_request(:get, MATCH_NETWORK_LOCATION).
|
|
190
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
63
191
|
|
|
64
|
-
|
|
65
|
-
@
|
|
66
|
-
end
|
|
192
|
+
query = { cpt_code: '90658', zip_code: '94403' }
|
|
193
|
+
@prices = @@pokitdok.cash_prices query
|
|
67
194
|
|
|
68
|
-
|
|
69
|
-
|
|
195
|
+
refute_nil(@prices)
|
|
196
|
+
end
|
|
70
197
|
end
|
|
71
|
-
end
|
|
72
198
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
199
|
+
describe 'Claims endpoint' do
|
|
200
|
+
it 'should expose the claims endpoint' do
|
|
201
|
+
stub_request(:post, MATCH_NETWORK_LOCATION).
|
|
202
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
203
|
+
|
|
204
|
+
query = JSON.parse(IO.read('spec/fixtures/claim.json'))
|
|
205
|
+
@claim = @@pokitdok.claims(query)
|
|
76
206
|
|
|
77
|
-
|
|
78
|
-
@prices = @pokitdok.cash_prices query
|
|
207
|
+
refute_nil(@claim)
|
|
79
208
|
end
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
describe 'Claims status endpoint' do
|
|
212
|
+
it 'should expose the claims status endpoint' do
|
|
213
|
+
stub_request(:post, MATCH_NETWORK_LOCATION).
|
|
214
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
80
215
|
|
|
81
|
-
|
|
82
|
-
|
|
216
|
+
query = JSON.parse(IO.read('spec/fixtures/claims_status.json'))
|
|
217
|
+
@claims_status = @@pokitdok.claims_status(query)
|
|
218
|
+
|
|
219
|
+
refute_nil(@claims_status)
|
|
220
|
+
end
|
|
83
221
|
end
|
|
84
|
-
end
|
|
85
222
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
223
|
+
describe 'Medical Procedure Endpoint endpoint' do
|
|
224
|
+
it 'should expose the mpc endpoint when a code is specified' do
|
|
225
|
+
stub_request(:get, MATCH_NETWORK_LOCATION).
|
|
226
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
227
|
+
|
|
228
|
+
query = { code: '99213' }
|
|
229
|
+
@mpc = @@pokitdok.mpc(query)
|
|
89
230
|
|
|
90
|
-
|
|
91
|
-
@prices = @pokitdok.insurance_prices query
|
|
231
|
+
refute_nil(@mpc)
|
|
92
232
|
end
|
|
233
|
+
it 'should expose the mpc endpoint when name is specified' do
|
|
234
|
+
stub_request(:get, MATCH_NETWORK_LOCATION).
|
|
235
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
93
236
|
|
|
94
|
-
|
|
95
|
-
|
|
237
|
+
query = { name: 'office' }
|
|
238
|
+
@mpc = @@pokitdok.mpc(query)
|
|
239
|
+
|
|
240
|
+
refute_nil(@mpc)
|
|
241
|
+
end
|
|
96
242
|
end
|
|
97
|
-
end
|
|
98
243
|
|
|
244
|
+
describe 'ICD Convert endpoint' do
|
|
245
|
+
it 'should expose the icd convert endpoint' do
|
|
246
|
+
stub_request(:get, MATCH_NETWORK_LOCATION).
|
|
247
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
99
248
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
query = JSON.parse(IO.read('spec/fixtures/claim.json'))
|
|
103
|
-
VCR.use_cassette 'claims' do
|
|
104
|
-
@claim = @pokitdok.claims(query)
|
|
249
|
+
@icd = @@pokitdok.icd_convert({code: '250.12'})
|
|
250
|
+
refute_nil(@icd)
|
|
105
251
|
end
|
|
252
|
+
end
|
|
106
253
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
254
|
+
describe 'Claims convert endpoint' do
|
|
255
|
+
it 'should expose the claims convert endpoint' do
|
|
256
|
+
stub_request(:post, MATCH_NETWORK_LOCATION).
|
|
257
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
258
|
+
|
|
259
|
+
@converted_claim = @@pokitdok.claims_convert('spec/fixtures/chiropractic_example.837')
|
|
260
|
+
|
|
261
|
+
refute_nil(@converted_claim)
|
|
262
|
+
end
|
|
111
263
|
end
|
|
112
|
-
end
|
|
113
264
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
265
|
+
describe 'Eligibility endpoint' do
|
|
266
|
+
it 'should expose the eligibility endpoint' do
|
|
267
|
+
stub_request(:post, MATCH_NETWORK_LOCATION).
|
|
268
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
269
|
+
|
|
270
|
+
@eligibility_query = {
|
|
271
|
+
member: {
|
|
272
|
+
birth_date: '1970-01-01',
|
|
273
|
+
first_name: 'Jane',
|
|
274
|
+
last_name: 'Doe',
|
|
275
|
+
id: 'W000000000'
|
|
276
|
+
},
|
|
277
|
+
provider: {
|
|
278
|
+
first_name: 'JEROME',
|
|
279
|
+
last_name: 'AYA-AY',
|
|
280
|
+
npi: '1467560003'
|
|
281
|
+
},
|
|
282
|
+
service_types: ['health_benefit_plan_coverage'],
|
|
283
|
+
trading_partner_id: 'MOCKPAYER'
|
|
284
|
+
}
|
|
285
|
+
@eligibility = @@pokitdok.eligibility(@eligibility_query)
|
|
286
|
+
|
|
287
|
+
refute_nil(@eligibility)
|
|
119
288
|
end
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
describe 'Enrollment endpoint' do
|
|
292
|
+
it 'should expose the enrollment endpoint' do
|
|
293
|
+
stub_request(:post, MATCH_NETWORK_LOCATION).
|
|
294
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
120
295
|
|
|
121
|
-
|
|
122
|
-
|
|
296
|
+
query = JSON.parse(IO.read('spec/fixtures/enrollment.json'))
|
|
297
|
+
@enrollment = @@pokitdok.enrollment(query)
|
|
123
298
|
|
|
124
|
-
|
|
299
|
+
refute_nil(@enrollment)
|
|
300
|
+
end
|
|
125
301
|
end
|
|
126
|
-
end
|
|
127
302
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
last_name: 'Doe',
|
|
135
|
-
id: 'W000000000'
|
|
136
|
-
},
|
|
137
|
-
provider: {
|
|
138
|
-
first_name: 'JEROME',
|
|
139
|
-
last_name: 'AYA-AY',
|
|
140
|
-
npi: '1467560003'
|
|
141
|
-
},
|
|
142
|
-
service_types: ['health_benefit_plan_coverage'],
|
|
143
|
-
trading_partner_id: 'MOCKPAYER'
|
|
144
|
-
}
|
|
303
|
+
describe 'Enrollment Snapshot endpoint' do
|
|
304
|
+
it 'should expose the enrollment snapshot endpoint' do
|
|
305
|
+
stub_request(:post, MATCH_NETWORK_LOCATION).
|
|
306
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
307
|
+
|
|
308
|
+
@enrollment_snapshot_activity = @@pokitdok.enrollment_snapshot('MOCKPAYER', 'spec/fixtures/acme_inc_supplemental_identifiers.834')
|
|
145
309
|
|
|
146
|
-
|
|
147
|
-
@eligibility = @pokitdok.eligibility(@eligibility_query)
|
|
310
|
+
refute_nil(@enrollment_snapshot_activity)
|
|
148
311
|
end
|
|
312
|
+
it 'should expose the enrollment snapshots endpoint' do
|
|
313
|
+
stub_request(:get, MATCH_NETWORK_LOCATION).
|
|
314
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
149
315
|
|
|
150
|
-
|
|
151
|
-
refute_nil @eligibility['data']
|
|
152
|
-
assert_nil @eligibility['data']['errors']
|
|
153
|
-
end
|
|
154
|
-
end
|
|
316
|
+
@enrollment_snapshot = @@pokitdok.enrollment_snapshots({snapshot_id: '577294e00640fd5ce02d493f'})
|
|
155
317
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
318
|
+
refute_nil(@enrollment_snapshot)
|
|
319
|
+
end
|
|
320
|
+
it 'should expose the enrollment snapshot data endpoint' do
|
|
321
|
+
stub_request(:get, MATCH_NETWORK_LOCATION).
|
|
322
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
323
|
+
|
|
324
|
+
@enrollment_snapshot_data = @@pokitdok.enrollment_snapshot_data({snapshot_id: '577294e00640fd5ce02d493f'})
|
|
159
325
|
|
|
160
|
-
|
|
161
|
-
@enrollment = @pokitdok.enrollment(query)
|
|
326
|
+
refute_nil(@enrollment_snapshot_data)
|
|
162
327
|
end
|
|
328
|
+
end
|
|
329
|
+
|
|
330
|
+
describe 'Files endpoint' do
|
|
331
|
+
it 'should expose the files endpoint' do
|
|
332
|
+
stub_request(:post, MATCH_NETWORK_LOCATION).
|
|
333
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
163
334
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
335
|
+
@files = @@pokitdok.files('MOCKPAYER', 'spec/fixtures/sample.270')
|
|
336
|
+
|
|
337
|
+
refute_nil(@files)
|
|
338
|
+
end
|
|
167
339
|
end
|
|
168
|
-
end
|
|
169
340
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
341
|
+
describe 'Insurance Prices endpoint' do
|
|
342
|
+
it 'should expose the insurance prices endpoint' do
|
|
343
|
+
stub_request(:get, MATCH_NETWORK_LOCATION).
|
|
344
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
345
|
+
|
|
346
|
+
query = { cpt_code: '87799', zip_code: '32218' }
|
|
347
|
+
@prices = @@pokitdok.insurance_prices query
|
|
348
|
+
|
|
349
|
+
refute_nil(@prices)
|
|
175
350
|
end
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
describe 'Payers endpoint' do
|
|
354
|
+
it 'should expose the payers endpoint' do
|
|
355
|
+
stub_request(:get, MATCH_NETWORK_LOCATION).
|
|
356
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
357
|
+
|
|
358
|
+
@payers = @@pokitdok.payers(state: 'CA')
|
|
176
359
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
# TODO: should get back an activity id
|
|
360
|
+
refute_nil(@payers)
|
|
361
|
+
end
|
|
180
362
|
end
|
|
181
|
-
end
|
|
182
363
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
364
|
+
describe 'Plans endpoint' do
|
|
365
|
+
it 'should expose the plans endpoint' do
|
|
366
|
+
stub_request(:get, MATCH_NETWORK_LOCATION).
|
|
367
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
368
|
+
|
|
369
|
+
@plans = @@pokitdok.plans
|
|
370
|
+
|
|
371
|
+
refute_nil(@plans)
|
|
187
372
|
end
|
|
188
373
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
374
|
+
it 'should expose the plans endpoint withe state and plan type' do
|
|
375
|
+
stub_request(:get, MATCH_NETWORK_LOCATION).
|
|
376
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
377
|
+
|
|
378
|
+
query = {state: 'TX', plan_type: 'PPO'}
|
|
379
|
+
@plans = @@pokitdok.plans(query)
|
|
380
|
+
|
|
381
|
+
refute_nil(@plans)
|
|
382
|
+
end
|
|
192
383
|
end
|
|
193
|
-
end
|
|
194
384
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
385
|
+
describe 'Providers endpoint' do
|
|
386
|
+
it 'should expose the providers endpoint' do
|
|
387
|
+
stub_request(:get, MATCH_NETWORK_LOCATION).
|
|
388
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
389
|
+
|
|
390
|
+
query = { npi: '1467560003' }
|
|
391
|
+
@providers = @@pokitdok.providers(query)
|
|
198
392
|
|
|
199
|
-
|
|
200
|
-
@plans = @pokitdok.plans(query)
|
|
393
|
+
refute_nil(@providers)
|
|
201
394
|
end
|
|
202
395
|
|
|
203
|
-
|
|
204
|
-
|
|
396
|
+
it 'should expose the providers endpoint with args' do
|
|
397
|
+
stub_request(:get, MATCH_NETWORK_LOCATION).
|
|
398
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
399
|
+
|
|
400
|
+
query = {
|
|
401
|
+
zipcode: '29307',
|
|
402
|
+
specialty: 'rheumatology',
|
|
403
|
+
radius: '20mi'
|
|
404
|
+
}
|
|
405
|
+
@providers = @@pokitdok.providers(query)
|
|
406
|
+
|
|
407
|
+
refute_nil(@providers)
|
|
408
|
+
end
|
|
205
409
|
end
|
|
206
|
-
end
|
|
207
410
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
411
|
+
describe 'Trading Partners endpoints' do
|
|
412
|
+
it 'should expose the trading partners endpoint (index call)' do
|
|
413
|
+
stub_request(:get, MATCH_NETWORK_LOCATION).
|
|
414
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
211
415
|
|
|
212
|
-
|
|
213
|
-
|
|
416
|
+
@trading_partners = @@pokitdok.trading_partners
|
|
417
|
+
|
|
418
|
+
refute_nil(@trading_partners)
|
|
214
419
|
end
|
|
215
420
|
|
|
216
|
-
|
|
217
|
-
|
|
421
|
+
it 'should expose the trading partners endpoint (get call)' do
|
|
422
|
+
stub_request(:get, MATCH_NETWORK_LOCATION).
|
|
423
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
424
|
+
|
|
425
|
+
@trading_partners = @@pokitdok.trading_partners({ trading_partner_id: 'aetna' })
|
|
426
|
+
|
|
427
|
+
refute_nil(@trading_partners)
|
|
428
|
+
end
|
|
218
429
|
end
|
|
219
|
-
end
|
|
220
430
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
431
|
+
describe 'Referrals endpoint' do
|
|
432
|
+
it 'should expose the referrals endpoint' do
|
|
433
|
+
stub_request(:post, MATCH_NETWORK_LOCATION).
|
|
434
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
435
|
+
|
|
436
|
+
query = JSON.parse(IO.read('spec/fixtures/referrals.json'))
|
|
437
|
+
@referrals = @@pokitdok.referrals(query)
|
|
224
438
|
|
|
225
|
-
|
|
226
|
-
@providers = @pokitdok.providers(query)
|
|
439
|
+
refute_nil(@referrals)
|
|
227
440
|
end
|
|
441
|
+
end
|
|
442
|
+
|
|
443
|
+
describe 'Authorizations endpoint' do
|
|
444
|
+
it 'should expose the authorizations endpoint' do
|
|
445
|
+
stub_request(:post, MATCH_NETWORK_LOCATION).
|
|
446
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
228
447
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
448
|
+
query = JSON.parse(IO.read('spec/fixtures/authorizations.json'))
|
|
449
|
+
@authorizations = @@pokitdok.authorizations query
|
|
450
|
+
|
|
451
|
+
refute_nil(@authorizations)
|
|
452
|
+
end
|
|
232
453
|
end
|
|
233
|
-
end
|
|
234
454
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
455
|
+
describe 'Scheduling endpoints' do
|
|
456
|
+
it 'should list the schedulers' do
|
|
457
|
+
stub_request(:get, MATCH_NETWORK_LOCATION).
|
|
458
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
459
|
+
|
|
460
|
+
@schedulers = @@pokitdok.schedulers
|
|
238
461
|
|
|
239
|
-
|
|
240
|
-
@referrals = @pokitdok.referrals(query)
|
|
462
|
+
refute_nil(@schedulers)
|
|
241
463
|
end
|
|
242
464
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
end
|
|
247
|
-
end
|
|
465
|
+
it 'should give details on a specific scheduler' do
|
|
466
|
+
stub_request(:get, MATCH_NETWORK_LOCATION).
|
|
467
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
248
468
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
@schedulers = @pokitdok.schedulers
|
|
469
|
+
@scheduler = @@pokitdok.scheduler({ uuid: '967d207f-b024-41cc-8cac-89575a1f6fef' })
|
|
470
|
+
|
|
471
|
+
refute_nil(@scheduler)
|
|
253
472
|
end
|
|
254
473
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
474
|
+
it 'should list appointment types' do
|
|
475
|
+
stub_request(:get, MATCH_NETWORK_LOCATION).
|
|
476
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
258
477
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
@
|
|
478
|
+
@appointment_types = @@pokitdok.appointment_types
|
|
479
|
+
|
|
480
|
+
refute_nil(@appointment_types)
|
|
262
481
|
end
|
|
263
482
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
end
|
|
483
|
+
it 'should give details on a specific appointment type' do
|
|
484
|
+
stub_request(:get, MATCH_NETWORK_LOCATION).
|
|
485
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
268
486
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
@
|
|
487
|
+
@appointment_type = @@pokitdok.appointment_type({ uuid: 'ef987695-0a19-447f-814d-f8f3abbf4860' })
|
|
488
|
+
|
|
489
|
+
refute_nil(@appointment_type)
|
|
272
490
|
end
|
|
273
491
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
492
|
+
it 'should create an open schedule slot' do
|
|
493
|
+
# Special Case: The scheduling endpoint reauthenticates for the scope (user_schedule),
|
|
494
|
+
# which would be caught by the below 'stub_request'. This would cause the OAuth module
|
|
495
|
+
# to fail because of an empty return body (to see what is required on an OAuth) POST
|
|
496
|
+
# refer to the 'before' code block above. This 'stub_request' will only catch the /schedule/slots/ request.
|
|
497
|
+
stub_request(:post, MATCH_NETWORK_LOCATION).
|
|
498
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
499
|
+
|
|
500
|
+
query = {
|
|
501
|
+
pd_provider_uuid: "b691b7f9-bfa8-486d-a689-214ae47ea6f8",
|
|
502
|
+
location: [32.788110, -79.932364],
|
|
503
|
+
appointment_type: "AT1",
|
|
504
|
+
start_date: "2014-12-25T15:09:34.197709",
|
|
505
|
+
end_date: "2014-12-25T16:09:34.197717"
|
|
506
|
+
}
|
|
507
|
+
@slot = @@pokitdok.schedule_slots(query)
|
|
508
|
+
|
|
509
|
+
refute_nil(@slot)
|
|
510
|
+
end
|
|
511
|
+
|
|
512
|
+
it 'should give details on a specific appointment' do
|
|
513
|
+
stub_request(:get, MATCH_NETWORK_LOCATION).
|
|
514
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
277
515
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
@
|
|
516
|
+
@appointment = @@pokitdok.appointments({ uuid: 'ef987691-0a19-447f-814d-f8f3abbf4859' })
|
|
517
|
+
|
|
518
|
+
refute_nil(@appointment)
|
|
281
519
|
end
|
|
282
520
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
end
|
|
521
|
+
it 'should give details on a searched appointments' do
|
|
522
|
+
stub_request(:get, MATCH_NETWORK_LOCATION).
|
|
523
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
287
524
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
525
|
+
query = {
|
|
526
|
+
'appointment_type' => 'AT1',
|
|
527
|
+
'start_date' => Time.now.strftime("%Y/%m/%d"),
|
|
528
|
+
'end_date' => Time.now.strftime("%Y/%m/%d"),
|
|
529
|
+
}
|
|
530
|
+
@appointments = @@pokitdok.appointments(query)
|
|
531
|
+
|
|
532
|
+
refute_nil(@appointments)
|
|
533
|
+
end
|
|
534
|
+
|
|
535
|
+
it 'should book appointment for an open slot' do
|
|
536
|
+
stub_request(:put, MATCH_NETWORK_LOCATION).
|
|
537
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
538
|
+
|
|
539
|
+
appt_uuid = "ef987691-0a19-447f-814d-f8f3abbf4859"
|
|
540
|
+
booking_query = {
|
|
541
|
+
patient: {
|
|
542
|
+
uuid: "500ef469-2767-4901-b705-425e9b6f7f83",
|
|
543
|
+
email: "john@johndoe.com",
|
|
544
|
+
phone: "800-555-1212",
|
|
545
|
+
birth_date: "1970-01-01",
|
|
546
|
+
first_name: "John",
|
|
547
|
+
last_name: "Doe"
|
|
548
|
+
},
|
|
549
|
+
description: "Welcome to M0d3rN Healthcare"
|
|
550
|
+
}
|
|
551
|
+
@slot = @@pokitdok.book_appointment(appt_uuid, booking_query)
|
|
552
|
+
|
|
553
|
+
refute_nil(@slot)
|
|
296
554
|
end
|
|
297
555
|
|
|
298
|
-
|
|
299
|
-
|
|
556
|
+
it 'should cancel a specified appointment' do
|
|
557
|
+
stub_request(:delete, MATCH_NETWORK_LOCATION).
|
|
558
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
559
|
+
|
|
560
|
+
@cancel_response = @@pokitdok.cancel_appointment "ef987691-0a19-447f-814d-f8f3abbf4859"
|
|
561
|
+
|
|
562
|
+
refute_nil(@cancel_response)
|
|
563
|
+
end
|
|
300
564
|
end
|
|
301
565
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
last_name: "
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
566
|
+
describe 'Identity Endpoint' do
|
|
567
|
+
it 'should expose the identity endpoint for creation' do
|
|
568
|
+
stub_request(:post, MATCH_NETWORK_LOCATION).
|
|
569
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
570
|
+
|
|
571
|
+
query = {
|
|
572
|
+
prefix: "Mr.",
|
|
573
|
+
first_name: "Gerald",
|
|
574
|
+
middle_name: "Harold",
|
|
575
|
+
last_name: "Whitmire",
|
|
576
|
+
suffix: "IV",
|
|
577
|
+
birth_date: "2000-05-25",
|
|
578
|
+
gender: "male",
|
|
579
|
+
email: "oscar@@pokitdok.com",
|
|
580
|
+
phone: "555-555-5555",
|
|
581
|
+
secondary_phone: "333-333-4444",
|
|
582
|
+
address: {
|
|
583
|
+
address_lines: ["1400 Anyhoo Avenue"],
|
|
584
|
+
city: "Springfield",
|
|
585
|
+
state: "IL",
|
|
586
|
+
zipcode: "90210"
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
@identity = @@pokitdok.create_identity(query)
|
|
590
|
+
|
|
591
|
+
refute_nil(@identity)
|
|
592
|
+
end
|
|
316
593
|
|
|
317
|
-
|
|
318
|
-
|
|
594
|
+
it 'should expose the identity endpoint for querying via id' do
|
|
595
|
+
stub_request(:get, MATCH_NETWORK_LOCATION).
|
|
596
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
597
|
+
|
|
598
|
+
@identity = @@pokitdok.identity(identity_uuid: '1a0a60b2-3e07-11e6-94c0-08002778b074')
|
|
599
|
+
|
|
600
|
+
refute_nil(@identity)
|
|
319
601
|
end
|
|
320
602
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
603
|
+
it 'should expose the identity endpoint for querying via params' do
|
|
604
|
+
stub_request(:get, MATCH_NETWORK_LOCATION).
|
|
605
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
324
606
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
update_query = {
|
|
328
|
-
description: "Welcome to M0d3rN Healthcare"
|
|
329
|
-
}
|
|
607
|
+
query = {first_name: 'Gerald', last_name: 'Whitmire'}
|
|
608
|
+
@identities = @@pokitdok.identity(query)
|
|
330
609
|
|
|
331
|
-
|
|
332
|
-
@response = @pokitdok.update_appointment(appt_uuid, update_query)
|
|
610
|
+
refute_nil(@identities)
|
|
333
611
|
end
|
|
334
612
|
|
|
335
|
-
|
|
336
|
-
|
|
613
|
+
it 'should expose the identity endpoint for updating' do
|
|
614
|
+
stub_request(:put, MATCH_NETWORK_LOCATION).
|
|
615
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
616
|
+
|
|
617
|
+
@identity = @@pokitdok.update_identity('1a0a60b2-3e07-11e6-94c0-08002778b074', { first_name: 'John' })
|
|
337
618
|
|
|
338
|
-
|
|
339
|
-
VCR.use_cassette 'scheduling_scoped' do
|
|
340
|
-
@cancel_response =
|
|
341
|
-
@pokitdok.cancel_appointment "ef987691-0a19-447f-814d-f8f3abbf4859"
|
|
619
|
+
refute_nil(@identity)
|
|
342
620
|
end
|
|
343
621
|
|
|
344
|
-
|
|
345
|
-
|
|
622
|
+
it 'should expose the identity history endpoint' do
|
|
623
|
+
stub_request(:get, MATCH_NETWORK_LOCATION).
|
|
624
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
625
|
+
|
|
626
|
+
@identity = @@pokitdok.identity_history('1a0a60b2-3e07-11e6-94c0-08002778b074')
|
|
346
627
|
|
|
347
|
-
|
|
348
|
-
' called without a scope code being set' do
|
|
349
|
-
VCR.use_cassette 'auth' do
|
|
350
|
-
@pd = PokitDok::PokitDok.new(CLIENT_ID, CLIENT_SECRET)
|
|
628
|
+
refute_nil(@identity)
|
|
351
629
|
end
|
|
352
630
|
|
|
353
|
-
|
|
354
|
-
|
|
631
|
+
it 'should expose the identity history endpoint with version number' do
|
|
632
|
+
stub_request(:get, MATCH_NETWORK_LOCATION).
|
|
633
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
634
|
+
|
|
635
|
+
@identity = @@pokitdok.identity_history('1a0a60b2-3e07-11e6-94c0-08002778b074', 1)
|
|
636
|
+
|
|
637
|
+
refute_nil(@identity)
|
|
638
|
+
end
|
|
639
|
+
|
|
640
|
+
it 'should expose the identity match endpoint' do
|
|
641
|
+
stub_request(:post, MATCH_NETWORK_LOCATION).
|
|
642
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
643
|
+
|
|
644
|
+
query = JSON.parse(IO.read('spec/fixtures/identity_match.json'))
|
|
645
|
+
@identity = @@pokitdok.identity_match(query)
|
|
646
|
+
|
|
647
|
+
refute_nil(@identity)
|
|
355
648
|
end
|
|
356
649
|
end
|
|
357
|
-
end
|
|
358
650
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
651
|
+
describe 'Pharmacy Plans Endpoint' do
|
|
652
|
+
it 'should expose the pharmacy plans endpoint' do
|
|
653
|
+
stub_request(:get, MATCH_NETWORK_LOCATION).
|
|
654
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
655
|
+
|
|
656
|
+
query = {trading_partner_id: 'MOCKPAYER', plan_number: 'S5820003'}
|
|
657
|
+
@pharmacy_plans = @@pokitdok.pharmacy_plans(query)
|
|
362
658
|
|
|
363
|
-
|
|
364
|
-
@trading_partners = @pokitdok.trading_partners(query)
|
|
659
|
+
refute_nil(@pharmacy_plans)
|
|
365
660
|
end
|
|
661
|
+
end
|
|
662
|
+
|
|
663
|
+
describe 'Pharmacy Formulary Endpoint' do
|
|
664
|
+
it 'should expose the pharmacy formulary endpoint' do
|
|
665
|
+
stub_request(:get, MATCH_NETWORK_LOCATION).
|
|
666
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
366
667
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
668
|
+
query = {trading_partner_id: 'MOCKPAYER', plan_number: 'S5820003',
|
|
669
|
+
ndc: '59310-579-22'}
|
|
670
|
+
@pharmacy_formulary = @@pokitdok.pharmacy_formulary(query)
|
|
671
|
+
|
|
672
|
+
refute_nil(@pharmacy_formulary)
|
|
673
|
+
end
|
|
370
674
|
end
|
|
371
675
|
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
676
|
+
describe 'Pharmacy Network Endpoint' do
|
|
677
|
+
it 'should expose the pharmacy formulary endpoint by NPI' do
|
|
678
|
+
stub_request(:get, MATCH_NETWORK_LOCATION).
|
|
679
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
680
|
+
|
|
681
|
+
query = {trading_partner_id: 'MOCKPAYER', plan_number: 'S5596033',
|
|
682
|
+
npi: '1912301953'}
|
|
683
|
+
@pharmacy_network = @@pokitdok.pharmacy_network(query)
|
|
684
|
+
|
|
685
|
+
refute_nil(@pharmacy_network)
|
|
375
686
|
end
|
|
687
|
+
it 'should expose the pharmacy formulary endpoint by searching' do
|
|
688
|
+
stub_request(:get, MATCH_NETWORK_LOCATION).
|
|
689
|
+
to_return(status: 200, body: '{ "string" : "" }')
|
|
376
690
|
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
691
|
+
query = {trading_partner_id: 'MOCKPAYER', plan_number: 'S5596033',
|
|
692
|
+
zipcode: '94401', radius: '10mi'}
|
|
693
|
+
@pharmacy_network = @@pokitdok.pharmacy_network(query)
|
|
694
|
+
|
|
695
|
+
refute_nil(@pharmacy_network)
|
|
696
|
+
end
|
|
380
697
|
end
|
|
381
698
|
end
|
|
382
699
|
end
|