eligible 2.4.3 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/.rspec +2 -0
- data/.rubocop.yml +12 -0
- data/ChangeLog +51 -0
- data/LICENSE +1 -1
- data/README.md +71 -133
- data/Rakefile +12 -2
- data/eligible.gemspec +14 -15
- data/lib/eligible.rb +96 -68
- data/lib/eligible/api_resource.rb +4 -6
- data/lib/eligible/claim.rb +12 -18
- data/lib/eligible/coverage.rb +16 -17
- data/lib/eligible/demographic.rb +7 -10
- data/lib/eligible/eligible_object.rb +12 -14
- data/lib/eligible/enrollment.rb +12 -13
- data/lib/eligible/errors/eligible_error.rb +2 -2
- data/lib/eligible/medicare.rb +8 -14
- data/lib/eligible/payment.rb +4 -9
- data/lib/eligible/ticket.rb +23 -30
- data/lib/eligible/util.rb +31 -35
- data/lib/eligible/version.rb +1 -1
- data/lib/eligible/x12.rb +2 -4
- metadata +50 -52
- data/CONTRIBUTORS +0 -5
- data/test/test_eligible.rb +0 -178
- data/test/test_helper.rb +0 -97
data/CONTRIBUTORS
DELETED
data/test/test_eligible.rb
DELETED
@@ -1,178 +0,0 @@
|
|
1
|
-
require File.expand_path('../test_helper', __FILE__)
|
2
|
-
require 'test/unit'
|
3
|
-
require 'shoulda'
|
4
|
-
require 'mocha'
|
5
|
-
require 'rest-client'
|
6
|
-
|
7
|
-
class TestEligible < Test::Unit::TestCase
|
8
|
-
include Mocha
|
9
|
-
|
10
|
-
context 'Version' do
|
11
|
-
should 'have a version number' do
|
12
|
-
assert_not_nil Eligible::VERSION
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
context '"General API"' do
|
17
|
-
setup do
|
18
|
-
Eligible.mock_rest_client = @mock = mock
|
19
|
-
end
|
20
|
-
|
21
|
-
teardown do
|
22
|
-
Eligible.mock_rest_client = Eligible.api_key = nil
|
23
|
-
end
|
24
|
-
|
25
|
-
should 'not specifying api credentials should raise an exception' do
|
26
|
-
Eligible.api_key = nil
|
27
|
-
assert_raises Eligible::AuthenticationError do
|
28
|
-
Eligible::Coverage.get({})
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
should 'specifying invalid api credentials should raise an exception' do
|
33
|
-
Eligible.api_key = 'invalid'
|
34
|
-
response = test_response(test_invalid_api_key_error, 401)
|
35
|
-
assert_raises Eligible::AuthenticationError do
|
36
|
-
@mock.expects(:get).once.raises(RestClient::ExceptionWithResponse.new(response, 401))
|
37
|
-
Eligible::Coverage.get({})
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
context 'Demographic' do
|
43
|
-
setup do
|
44
|
-
Eligible.api_key = 'TEST'
|
45
|
-
@mock = mock
|
46
|
-
Eligible.mock_rest_client = @mock
|
47
|
-
end
|
48
|
-
|
49
|
-
teardown do
|
50
|
-
Eligible.mock_rest_client = nil
|
51
|
-
Eligible.api_key = nil
|
52
|
-
end
|
53
|
-
|
54
|
-
should 'return an error if no params are supplied' do
|
55
|
-
params = {}
|
56
|
-
response = test_response(test_demographic_missing_params)
|
57
|
-
@mock.expects(:get).returns(response)
|
58
|
-
demographic = Eligible::Demographic.get(params)
|
59
|
-
assert_not_nil demographic.error
|
60
|
-
end
|
61
|
-
|
62
|
-
should 'return demographic information if valid params are supplied' do
|
63
|
-
params = {
|
64
|
-
:payer_name => "Aetna",
|
65
|
-
:payer_id => "000001",
|
66
|
-
:provider_last_name => "Last",
|
67
|
-
:provider_first_name => "First",
|
68
|
-
:provider_npi => "1028384219",
|
69
|
-
:member_id => "W120923801",
|
70
|
-
:member_last_name => "Austen",
|
71
|
-
:member_first_name => "Jane",
|
72
|
-
:member_dob => "1955-12-14"
|
73
|
-
}
|
74
|
-
response = test_response(test_demographic)
|
75
|
-
@mock.expects(:get).returns(response)
|
76
|
-
demographic = Eligible::Demographic.get(params)
|
77
|
-
assert_nil demographic.error
|
78
|
-
assert_not_nil demographic.to_hash
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
context 'Claim' do
|
83
|
-
setup do
|
84
|
-
Eligible.api_key = 'TEST'
|
85
|
-
@mock = mock
|
86
|
-
Eligible.mock_rest_client = @mock
|
87
|
-
end
|
88
|
-
|
89
|
-
teardown do
|
90
|
-
Eligible.mock_rest_client = nil
|
91
|
-
Eligible.api_key = nil
|
92
|
-
end
|
93
|
-
|
94
|
-
should 'return an error if no params are supplied' do
|
95
|
-
params = {}
|
96
|
-
response = test_response(test_claim_missing_params)
|
97
|
-
@mock.expects(:get).returns(response)
|
98
|
-
claim = Eligible::Claim.get(params)
|
99
|
-
assert claim["success"] == "false"
|
100
|
-
end
|
101
|
-
|
102
|
-
should 'post a claim' do
|
103
|
-
params = { "api_key" => "asdfsdfsd21132ddsfsdfd", "billing_provider" => { "taxonomy_code" => "332B00000X", "practice_name" => "Jane Austen Practice", "npi" => "1922222222", "address" => { "street_line_1" => "419 Fulton", "street_line_2" => "", "city" => "San Francisco", "state" => "CA", "zip" => "94102" }, "tin" => "43291023", "insurance_provider_id" => "129873210" }, "pay_to_provider" => { "address" => { "street_line_1" => "", "street_line_2" => "", "city" => "", "state" => "", "zip" => "" } }, "subscriber" => { "last_name" => "Franklin", "first_name" => "Benjamin", "member_id" => "W2832032427", "group_id" => "455716", "group_name" => "none", "dob" => "1734-05-04", "gender" => "M", "address" => { "street_line_1" => "435 Sugar Lane", "street_line_2" => "", "city" => "Sweet", "state" => "OH", "zip" => "436233127" } }, "payer" => { "name" => "AETNA", "id" => "60054", "address" => { "street_line_1" => "Po Box 981106", "street_line_2" => "", "city" => "El Paso", "state" => "TX", "zip" => "799981222" } }, "dependent" => { "relationship" => "", "last_name" => "", "first_name" => "", "dob" => "", "gender" => "", "address" => { "street_line_1" => "", "street_line_2" => "", "city" => "", "state" => "", "zip" => "" } }, "claim" => { "total_charge_amount" => "275", "claim_frequency" => "1", "patient_signature_on_file" => "Y", "provider_plan_participation" => "A", "direct_payment_authorized" => "Y", "release_of_information" => "I", "service_lines" => [{ "line_number" => "1", "service_start" => "2013-03-07", "service_end" => "2013-03-07", "authorization_code" => "", "place_of_service" => "11", "charge_amount" => "275", "product_service" => "99213", "qualifier" => "HC", "description" => "", "modifier_1" => "", "diagnosis_1" => "32723" }] } }
|
104
|
-
response = test_response(test_post_claim)
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
context 'Coverage' do
|
109
|
-
setup do
|
110
|
-
Eligible.api_key = 'TEST'
|
111
|
-
@mock = mock
|
112
|
-
Eligible.mock_rest_client = @mock
|
113
|
-
end
|
114
|
-
|
115
|
-
teardown do
|
116
|
-
Eligible.mock_rest_client = nil
|
117
|
-
Eligible.api_key = nil
|
118
|
-
end
|
119
|
-
|
120
|
-
should 'return an error if no params are supplied' do
|
121
|
-
params = {}
|
122
|
-
response = test_response(test_coverage_missing_params)
|
123
|
-
@mock.expects(:get).returns(response)
|
124
|
-
coverage = Eligible::Coverage.get(params)
|
125
|
-
assert_not_nil coverage.error
|
126
|
-
end
|
127
|
-
|
128
|
-
should 'return coverage information if valid params are supplied' do
|
129
|
-
params = {
|
130
|
-
:payer_name => "Aetna",
|
131
|
-
:payer_id => "000001",
|
132
|
-
:provider_last_name => "Last",
|
133
|
-
:provider_first_name => "First",
|
134
|
-
:provider_npi => "1028384219",
|
135
|
-
:member_id => "W120923801",
|
136
|
-
:member_last_name => "Austen",
|
137
|
-
:member_first_name => "Jane",
|
138
|
-
:member_dob => "1955-12-14"
|
139
|
-
}
|
140
|
-
response = test_response(test_coverage)
|
141
|
-
@mock.expects(:get).returns(response)
|
142
|
-
coverage = Eligible::Coverage.get(params)
|
143
|
-
|
144
|
-
assert_not_nil coverage.to_hash[:eligible_id]
|
145
|
-
end
|
146
|
-
end
|
147
|
-
|
148
|
-
context 'Enrollment' do
|
149
|
-
setup do
|
150
|
-
Eligible.api_key = 'TEST'
|
151
|
-
@mock = mock
|
152
|
-
Eligible.mock_rest_client = @mock
|
153
|
-
end
|
154
|
-
|
155
|
-
teardown do
|
156
|
-
Eligible.mock_rest_client = nil
|
157
|
-
Eligible.api_key = nil
|
158
|
-
end
|
159
|
-
|
160
|
-
should 'post an enrollment request' do
|
161
|
-
params = { "service_provider_list" => [{ "facility_name" => "Quality", "provider_name" => "Jane Austen", "tax_id" => "12345678", "address" => "125 Snow Shoe Road", "city" => "Sacramento", "state" => "CA", "zip" => "94107", "ptan" => "54321", "npi" => "987654321" }, { "facility_name" => "Aetna", "provider_name" => "Jack Austen", "tax_id" => "12345678", "address" => "985 Snow Shoe Road", "city" => "Menlo Park", "state" => "CA", "zip" => "94107", "ptan" => "54321", "npi" => "987654321" }], "payer_ids" => ["00431", "00282"] }
|
162
|
-
response = test_response(test_post_enrollment)
|
163
|
-
|
164
|
-
@mock.expects(:post).returns(response)
|
165
|
-
enrollment = Eligible::Enrollment.post(params)
|
166
|
-
|
167
|
-
assert_not_nil enrollment.to_hash[:enrollment_request]
|
168
|
-
end
|
169
|
-
|
170
|
-
should 'get the status of an enrollment request' do
|
171
|
-
params = { "NPI" => "1028384219" }
|
172
|
-
response = test_response(test_get_enrollment)
|
173
|
-
@mock.expects(:get).returns(response)
|
174
|
-
enrollment = Eligible::Enrollment.get(params)
|
175
|
-
assert_not_nil enrollment.to_hash[:enrollments]
|
176
|
-
end
|
177
|
-
end
|
178
|
-
end
|
data/test/test_helper.rb
DELETED
@@ -1,97 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
2
|
-
require 'eligible'
|
3
|
-
|
4
|
-
module Eligible
|
5
|
-
@mock_rest_client = nil
|
6
|
-
|
7
|
-
def self.mock_rest_client=(mock_client)
|
8
|
-
@mock_rest_client = mock_client
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.execute_request(opts)
|
12
|
-
get_params = (opts[:headers] || {})[:params]
|
13
|
-
post_params = opts[:payload]
|
14
|
-
case opts[:method]
|
15
|
-
when :get then
|
16
|
-
@mock_rest_client.get opts[:url], get_params, post_params
|
17
|
-
when :post then
|
18
|
-
@mock_rest_client.post opts[:url], get_params, post_params
|
19
|
-
when :delete then
|
20
|
-
@mock_rest_client.delete opts[:url], get_params, post_params
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_response(body, code=200)
|
26
|
-
# When an exception is raised, restclient clobbers method_missing. Hence we
|
27
|
-
# can't just use the stubs interface.
|
28
|
-
body = MultiJson.dump(body) if !(body.kind_of? String)
|
29
|
-
m = mock
|
30
|
-
m.instance_variable_set('@eligible_values', { :body => body, :code => code })
|
31
|
-
|
32
|
-
def m.body
|
33
|
-
@eligible_values[:body]
|
34
|
-
end
|
35
|
-
|
36
|
-
def m.code
|
37
|
-
@eligible_values[:code]
|
38
|
-
end
|
39
|
-
|
40
|
-
m
|
41
|
-
end
|
42
|
-
|
43
|
-
def test_invalid_api_key_error
|
44
|
-
{ "error" => [{ "message" => "Could not authenticate you. Please re-try with a valid API key.", "code" => 1 }] }
|
45
|
-
end
|
46
|
-
|
47
|
-
def test_plan_missing_params
|
48
|
-
{ "timestamp" => "2013-02-01T13:25:58", "eligible_id" => "A4F4E1D6-7DC3-4B20-87CE-B59F48811290", "mapping_version" => "plan/all$Revision:6$$Date:13-01-110:18$", "error" => { "response_code" => "Y", "response_description" => "Yes", "agency_qualifier_code" => "", "agency_qualifier_description" => "", "reject_reason_code" => "41", "reject_reason_description" => "Authorization/AccessRestrictions", "follow-up_action_code" => "C", "follow-up_action_description" => "PleaseCorrectandResubmit" } }
|
49
|
-
end
|
50
|
-
|
51
|
-
def test_plan
|
52
|
-
{ "timestamp" => "2013-01-14T20:39:57", "eligible_id" => "B97BC91A-3E84-40A9-AA5C-D416CAE5CDB1", "mapping_version" => "plan/all$Revision:6$$Date:13-01-110:18$", "primary_insurance" => { "name" => "Aetna", "id" => "00002", "group_name" => "TOWERGROUPCOMPANIES", "plan_begins" => "2010-01-01", "plan_ends" => "", "comments" => ["AetnaChoicePOSII"] }, "type" => "30", "coverage_status" => "1", "precertification_needed" => "", "exclusions" => "", "deductible_in_network" => { "individual" => { "base_period" => "500", "remaining" => "500", "comments" => ["MedDent", "MedDent"] }, "family" => { "base_period" => "1000", "remaining" => "1000", "comments" => ["MedDent", "MedDent"] } }, "deductible_out_network" => { "individual" => { "base_period" => "1250", "remaining" => "1250", "comments" => ["MedDent", "MedDent"] }, "family" => { "base_period" => "3750", "remaining" => "3750", "comments" => ["MedDent", "MedDent"] } }, "stop_loss_in_network" => { "individual" => { "base_period" => "", "remaining" => "2000", "comments" => [] }, "family" => { "base_period" => "", "remaining" => "4000", "comments" => [] } }, "stop_loss_out_network" => { "individual" => { "base_period" => "", "remaining" => "3000", "comments" => [] }, "family" => { "base_period" => "", "remaining" => "6000", "comments" => [] } }, "balance" => "", "comments" => [], "additional_insurance" => { "comments" => [] } }
|
53
|
-
end
|
54
|
-
|
55
|
-
def test_service_missing_params
|
56
|
-
{ "timestamp" => "2013-02-04T17:23:12", "eligible_id" => "7EEA40A7-58C5-4EBC-A450-10C37CA2D252", "mapping_version" => "service/all$Revision:4$$Date:12-12-280:13$", "error" => { "response_code" => "Y", "response_description" => "Yes", "agency_qualifier_code" => "", "agency_qualifier_description" => "", "reject_reason_code" => "41", "reject_reason_description" => "Authorization/AccessRestrictions", "follow-up_action_code" => "C", "follow-up_action_description" => "PleaseCorrectandResubmit" } }
|
57
|
-
end
|
58
|
-
|
59
|
-
def test_service
|
60
|
-
{ "timestamp" => "2013-02-01T15:28:16", "eligible_id" => "FD8994B1-F977-459A-81AC-D182EA8FE66D", "mapping_version" => "service/all$Revision:4$$Date:12-12-280:13$", "type" => "33", "coverage_status" => "1", "service_begins" => "", "service_ends" => "", "not_covered" => [], "comments" => ["AetnaChoicePOSII"], "precertification_needed" => "", "visits_in_network" => { "individual" => { "total" => "", "remaining" => "", "comments" => [] }, "family" => { "total" => "", "remaining" => "", "comments" => [] } }, "visits_out_network" => { "individual" => { "total" => "", "remaining" => "", "comments" => [] }, "family" => { "total" => "", "remaining" => "", "comments" => [] } }, "copayment_in_network" => { "individual" => { "amount" => "", "comments" => [] }, "family" => { "amount" => "35", "comments" => ["OFFCHIROVISI", "COPAYNOTINCLUDEDINOOP", "MANPULATNCHRO"] } }, "copayment_out_network" => { "individual" => { "amount" => "", "comments" => [] }, "family" => { "amount" => "0", "comments" => ["MANPULATNCHRO"] } }, "coinsurance_in_network" => { "individual" => { "percent" => "", "comments" => [] }, "family" => { "percent" => "0", "comments" => ["OFFCHIROVISI", "MANPULATNCHRO"] } }, "coinsurance_out_network" => { "individual" => { "percent" => "", "comments" => [] }, "family" => { "percent" => "30", "comments" => ["CHIROVSTEVAL", "COINSAPPLIESTOOUTOFPOCKET", "MANPULATNCHRO"] } }, "deductible_in_network" => { "individual" => { "base_period" => "", "remaining" => "", "comments" => [] }, "family" => { "base_period" => "", "remaining" => "", "comments" => [] } }, "deductible_out_network" => { "individual" => { "base_period" => "", "remaining" => "", "comments" => [] }, "family" => { "base_period" => "", "remaining" => "", "comments" => [] } }, "additional_insurance" => { "comments" => [] } }
|
61
|
-
end
|
62
|
-
|
63
|
-
def test_demographic_missing_params
|
64
|
-
{ "timestamp" => "2013-02-05T13:21:38", "eligible_id" => "AE9F5EB3-B4BF-4B2E-92C5-6307CE91DB81", "mapping_version" => "demographic/dob$Revision:1$$Date:12-12-2619:01$", "error" => { "response_code" => "Y", "response_description" => "Yes", "agency_qualifier_code" => "", "agency_qualifier_description" => "", "reject_reason_code" => "41", "reject_reason_description" => "Authorization/AccessRestrictions", "follow-up_action_code" => "C", "follow-up_action_description" => "PleaseCorrectandResubmit" } }
|
65
|
-
end
|
66
|
-
|
67
|
-
def test_demographic
|
68
|
-
{ "timestamp" => "2013-02-05T13:14:36", "eligible_id" => "DCE2FFB3-179A-4825-ADA6-B8108FB5FB90", "mapping_version" => "demographic/all$Revision:4$$Date:12-12-2622:25$", "last_name" => "AUSTEN", "first_name" => "JANE", "member_id" => "R112114321", "group_id" => "060801203300001", "group_name" => "TOWERGROUPCOMPANIES", "dob" => "1955-12-14", "gender" => "M", "address" => { "street_line_1" => "123SOUTH7THSTREET", "street_line_2" => "", "city" => "CHICAGO", "state" => "CA", "zip" => "89701" } }
|
69
|
-
end
|
70
|
-
|
71
|
-
def test_claim_missing_params
|
72
|
-
{ "success" => "false", "created_at" => "2013-06-03T23:53:39Z", "error" => { "type" => "scrub", "message" => "you forgot to include gender" } }
|
73
|
-
end
|
74
|
-
|
75
|
-
def test_post_claim
|
76
|
-
{ "timestamp" => "2012-12-30T22:41:10", "eligible_id" => "DCE2FFB3-179A-4825-ADA6-B8108FB5FB90", "mapping_version" => "claim/status$Revision:1$$Date:12-12-3022:10$", "referenced_transaction_trace_number" => "970779644", "claim_status_category_code" => "F0", "claim_status_category_description" => "Finalized-Theclaim/encounterhascompletedtheadjudicationcycleandnomoreactionwillbetaken.", "claim_status_code" => "1", "claim_status_description" => "Formoredetailedinformation,seeremittanceadvice.", "status_information_effective_date" => "2007-03-13", "total_claim_charge_amount" => "172", "claim_payment_amount" => "126.9", "adjudication_finalized_date" => "2007-03-18", "remittance_date" => "2007-03-19", "remittance_trace_number" => "458787", "payer_claim_control_number" => "4121476181852", "claim_service_begin_date" => "2007-02-23", "claim_service_end_date" => "2007-02-28" }
|
77
|
-
end
|
78
|
-
|
79
|
-
def test_coverage_missing_params
|
80
|
-
{ "created_at" => "2013-06-11T12:21:47Z", "eligible_id" => "57c320d8-2e14-68ed-73d0-41c3b23c0f43", "error" => { "response_code" => "Y", "response_description" => "Yes", "agency_qualifier_code" => "", "agency_qualifier_description" => "", "reject_reason_code" => "41", "reject_reason_description" => "Authorization/Access Restrictions", "follow-up_action_code" => "C", "follow-up_action_description" => "Please Correct and Resubmit", "details" => "" } }
|
81
|
-
end
|
82
|
-
|
83
|
-
def test_coverage
|
84
|
-
{ "created_at" => "2013-05-09T22:42:40Z", "eligible_id" => "3233a9a1-a286-2896-ba3d-9f171303428b", "demographics" => { "subscriber" => { "last_name" => "FRANKLIN", "first_name" => "BENJAMIN", "member_id" => "TYA445554301", "group_id" => "3207524", "group_name" => "FOUNDING FATHERS", "dob" => "1701-10-17", "gender" => "M", "address" => { "street_line_1" => "2 FRANKLIN STREET", "street_line_2" => "", "city" => "SAN FRANCISCO", "state" => "CA", "zip" => "94102" } }, "dependent" => { "last_name" => "FRANKLIN", "first_name" => "IDA", "member_id" => "ZZZ445554301", "group_id" => "3207524", "group_name" => "FOUNDING FATHERS", "dob" => "1701-12-12", "gender" => "F", "address" => { "street_line_1" => "2 FRANKLIN STREET", "street_line_2" => "", "city" => "SAN FRANCISCO", "state" => "CA", "zip" => "94102" } } }, "primary_insurance" => { "name" => "CIGNA", "id" => "00001", "contacts" => [{ "contact_type" => "url", "contact_value" => "cignaforhcp.cigna.com" }], "service_providers" => { "physicians" => [{ "insurance_type" => "HN", "insurance_type_label" => "Health Maintenance Organization (HMO)", "primary_care" => "true", "restricted" => "TRUE", "contact_details" => [{ "last_name" => "JEFFERSON", "first_name" => "THOMAS", "indentification_type" => "Centers for Medicare and Medicaid Services National Provider Identifier", "identification_code" => "2222222222", "contacts" => [], "address" => { "street_line_1" => "PO BOX 2222222", "street_line_2" => "", "city" => "SAN FRANCISCO", "state" => "CA", "zip" => "94105" } }], "dates" => [{ "date_type" => "eligibility", "date_value" => "2010-01-01" }], "comments" => ["HRA BALANCE"] }] } }, "plan" => { "type" => "30", "coverage_status" => "1", "coverage_status_label" => "ACTIVE COVERAGE", "coverage_basis" => [], "plan_number" => "43", "plan_name" => "TRADITIONAL BLUE PPO 813 $15/ $15 COPAY", "group_name" => "FOUNDING FATHERS", "dates" => [{ "date_type" => "plan_begin", "date_value" => "2010-01-01" }, { "date_type" => "service", "date_value" => "2013-05-24" }, { "date_type" => "eligibility_begin", "date_value" => "2007-02-01" }], "exclusions" => { "noncovered" => [{ "type" => "BZ", "type_label" => "Physician Visit - Well", "time_period" => "32", "time_period_label" => "lifetime", "level" => "INDIVIDUAL", "network" => "OUT", "pos" => "", "pos_label" => "", "authorization_required" => "", "dates" => [], "contact_details" => [], "comments" => [] }], "pre_exisiting_condition" => { "waiting_period" => [] } }, "financials" => { "deductible" => { "remainings" => { "in_network" => [{ "amount" => "0", "level" => "FAMILY", "insurance_type" => "", "insurance_type_label" => "", "pos" => "", "pos_label" => "", "authorization_required" => "", "contact_details" => [], "dates" => [], "comments" => [] }, { "amount" => "0", "level" => "INDIVIDUAL", "insurance_type" => "", "insurance_type_label" => "", "pos" => "", "pos_label" => "", "authorization_required" => "", "contact_details" => [], "dates" => [], "comments" => [] }], "out_network" => [] }, "totals" => { "in_network" => [{ "amount" => "0", "time_period" => "24", "time_period_label" => "year_to_date", "level" => "INDIVIDUAL", "insurance_type" => "", "insurance_type_label" => "", "pos" => "", "pos_label" => "", "authorization_required" => "", "contact_details" => [], "dates" => [], "comments" => [] }, { "amount" => "0", "time_period" => "23", "time_period_label" => "calendar_year", "level" => "INDIVIDUAL", "insurance_type" => "", "insurance_type_label" => "", "pos" => "", "pos_label" => "", "authorization_required" => "", "contact_details" => [], "dates" => [], "comments" => [] }, { "amount" => "0", "time_period" => "24", "time_period_label" => "year_to_date", "level" => "FAMILY", "insurance_type" => "", "insurance_type_label" => "", "pos" => "", "pos_label" => "", "authorization_required" => "", "contact_details" => [], "dates" => [], "comments" => [] }, { "amount" => "0", "time_period" => "23", "time_period_label" => "calendar_year", "level" => "FAMILY", "insurance_type" => "", "insurance_type_label" => "", "pos" => "", "pos_label" => "", "authorization_required" => "", "contact_details" => [], "dates" => [], "comments" => [] }], "out_network" => [] } }, "stop_loss" => { "remainings" => { "in_network" => [{ "amount" => "6490", "level" => "INDIVIDUAL", "insurance_type" => "HN", "insurance_type_label" => "Health Maintenance Organization (HMO) - Medicare Risk", "pos" => "", "pos_label" => "", "authorization_required" => "", "contact_details" => [], "dates" => [], "comments" => [] }, { "amount" => "0", "level" => "FAMILY", "insurance_type" => "HN", "insurance_type_label" => "Health Maintenance Organization (HMO) - Medicare Risk", "pos" => "", "pos_label" => "", "authorization_required" => "", "contact_details" => [], "dates" => [], "comments" => [] }], "out_network" => [] }, "totals" => { "in_network" => [{ "amount" => "210", "time_period" => "24", "time_period_label" => "year_to_date", "level" => "INDIVIDUAL", "insurance_type" => "HN", "insurance_type_label" => "Health Maintenance Organization (HMO) - Medicare Risk", "pos" => "", "pos_label" => "", "authorization_required" => "", "contact_details" => [], "dates" => [], "comments" => [] }, { "amount" => "210", "time_period" => "24", "time_period_label" => "year_to_date", "level" => "FAMILY", "insurance_type" => "HN", "insurance_type_label" => "Health Maintenance Organization (HMO) - Medicare Risk", "pos" => "", "pos_label" => "", "authorization_required" => "", "contact_details" => [], "dates" => [], "comments" => [] }, { "amount" => "0", "time_period" => "23", "time_period_label" => "calendar_year", "level" => "FAMILY", "insurance_type" => "HN", "insurance_type_label" => "Health Maintenance Organization (HMO) - Medicare Risk", "pos" => "", "pos_label" => "", "authorization_required" => "", "contact_details" => [], "dates" => [], "comments" => [] }, { "amount" => "6700", "time_period" => "23", "time_period_label" => "calendar_year", "level" => "INDIVIDUAL", "insurance_type" => "HN", "insurance_type_label" => "Health Maintenance Organization (HMO) - Medicare Risk", "pos" => "", "pos_label" => "", "authorization_required" => "", "contact_details" => [], "dates" => [], "comments" => [] }], "out_network" => [] } }, "spending_account" => { "remaining" => [] }, "coinsurance" => { "percents" => { "in_network" => [], "out_network" => [] } }, "copayment" => { "amounts" => { "in_network" => [{ "amount" => "20", "time_period" => "", "time_period_label" => "", "level" => "INDIVIDUAL", "insurance_type" => "", "insurance_type_label" => "", "pos" => "", "pos_label" => "", "authorization_required" => "", "dates" => [], "contact_details" => [], "comments" => [] }], "out_network" => [{ "amount" => "40", "time_period" => "", "time_period_label" => "", "level" => "INDIVIDUAL", "insurance_type" => "", "insurance_type_label" => "", "pos" => "", "pos_label" => "", "authorization_required" => "", "dates" => [], "contact_details" => [], "comments" => [] }] } }, "cost_containment" => { "remainings" => { "in_network" => [], "out_network" => [] }, "totals" => { "in_network" => [], "out_network" => [] } }, "spend_down" => { "remainings" => { "in_network" => [], "out_network" => [] }, "totals" => { "in_network" => [], "out_network" => [] } }, "limitations" => { "amounts" => [] }, "disclaimer" => [], "other_sources" => { "amounts" => [] } }, "benefit_details" => { "benefit_type_label" => { "amounts" => [] }, "managed_care" => { "amounts" => [] }, "unlimited" => { "amounts" => [] } }, "additional_insurance_policies" => [{ "insurance_type" => "47", "insurance_type_label" => "Medicare Secondary, Other Liability Insurance is Primary", "coverage_description" => "", "reference" => [{ "reference_code" => "IG", "reference_label" => "Insurance Policy Number", "reference_number" => "1232004008" }], "contact_details" => [{ "last_name" => "CLAIMS MANAGEMENT INC", "first_name" => "", "indentification_type" => "", "identification_code" => "", "contacts" => [], "address" => { "street_line_1" => "PO BOX 2210", "street_line_2" => "ATTN JANE AUSTEN", "city" => "SAN FRANCISCO", "state" => "CA", "zip" => "941052312" } }], "dates" => [{ "date_type" => "coordination_of_benefits", "date_value" => "2005-02-12" }], "comments" => [] }] }, "services" => [{ "type" => "96", "type_label" => "Physician Professional", "coverage_status" => "11", "coverage_status_label" => "generic inquiry provided no information for this service type. Retry by including service_type_code=96 for an explicit inquiry for this service type." }, { "type" => "98", "type_label" => "Professional Physician Visit - Office", "coverage_status" => "1", "coverage_status_label" => "active coverage", "authorization_required" => "", "noncovered" => [], "facility" => { "amounts" => [{ "amount" => "", "time_period" => "26", "time_period_label" => "EPISODE", "level" => "INDIVIDUAL", "network" => "Y", "insurance_type" => "MA", "insurance_type_label" => "MEDICARE PART A", "pos" => "", "pos_label" => "", "authorization_required" => "", "contact_details" => [], "dates" => [{ "date_type" => "benefit_begin", "date_value" => "2013-05-20" }], "comments" => ["Revocation Code - 0"] }] }, "benefit_details" => { "benefit_type_label" => { "amounts" => [] }, "managed_care" => { "amounts" => [] }, "unlimited" => { "amounts" => [] } }, "financials" => { "deductible" => {}, "stop_loss" => {}, "spending_account" => {}, "coinsurance" => {}, "copayment" => {}, "cost_containment" => {}, "spend_down" => {}, "limitations" => {}, "other_sources" => {} }, "visits" => { "amounts" => { "in_network" => [{ "amount" => "20", "time_period" => "", "time_period_label" => "", "level" => "INDIVIDUAL", "insurance_type" => "", "insurance_type_label" => "", "pos" => "", "pos_label" => "", "authorization_required" => "", "dates" => [], "contact_details" => [], "comments" => [] }], "out_network" => [{ "amount" => "40", "time_period" => "", "time_period_label" => "", "level" => "INDIVIDUAL", "insurance_type" => "", "insurance_type_label" => "", "pos" => "", "pos_label" => "", "authorization_required" => "", "dates" => [], "contact_details" => [], "comments" => [] }] } }, "additional_insurance_policies" => [{ "insurance_type" => "47", "insurance_type_label" => "Medicare Secondary, Other Liability Insurance is Primary", "coverage_description" => "", "reference" => [{ "reference_code" => "IG", "reference_label" => "Insurance Policy Number", "reference_number" => "1232004008" }], "contact_details" => [{ "last_name" => "CLAIMS MANAGEMENT INC", "first_name" => "", "indentification_type" => "", "identification_code" => "", "contacts" => [], "address" => { "street_line_1" => "PO BOX 2210", "street_line_2" => "ATTN JANE AUSTEN", "city" => "SAN FRANCISCO", "state" => "CA", "zip" => "941052312" } }], "dates" => [{ "date_type" => "coordination_of_benefits", "date_value" => "2005-02-12" }], "comments" => [] }] }] }
|
85
|
-
end
|
86
|
-
|
87
|
-
def test_enrollment_missing_params
|
88
|
-
{ "error" => "Expeting enrollment_request_id or npis" }
|
89
|
-
end
|
90
|
-
|
91
|
-
def test_get_enrollment
|
92
|
-
[{ "enrollment_npi" => { "address" => "985 Snow Shoe Road", "city" => "Sacramento", "created_at" => "2013-04-24T21:47:31+00:00", "facility_name" => "Quality", "npi" => "987654321", "provider_name" => "Jack Austen", "ptan" => "54321", "state" => "CA", "status" => "rejected", "tax_id" => "12345678", "updated_at" => "2013-04-28T17:10:00+00:00", "zip" => "94107", "enrollment_insurance_company" => { "name" => "Medicare", "payer_id" => "00431" } } }, { "enrollment_npi" => { "address" => "985 Snow Shoe Road", "city" => "Sacramento", "created_at" => "2013-04-24T21:47:31+00:00", "facility_name" => "Quality", "npi" => "987654321", "provider_name" => "Jack Austen", "ptan" => "54321", "state" => "CA", "status" => "accepted", "tax_id" => "12345678", "updated_at" => "2013-04-28T22:51:43+00:00", "zip" => "94107", "enrollment_insurance_company" => { "name" => "Kaiser North", "payer_id" => "00282" } } }]
|
93
|
-
end
|
94
|
-
|
95
|
-
def test_post_enrollment
|
96
|
-
{ "enrollment_request" => { "created_at" => "2013-04-14T07:29:09-07:00", "id" => 5, "status" => "pending", "updated_at" => "2013-04-14T07:29:09-07:00", "enrollment_npis" => [{ "address" => "125 Snow Shoe Road", "city" => "Sacramento", "created_at" => "2013-04-14T07:29:09-07:00", "facility_name" => "Quality", "npi" => "987654321", "provider_name" => "Jane Austen", "ptan" => "54321", "state" => "CA", "status" => "submitted", "tax_id" => "12345678", "updated_at" => "2013-04-14T07:29:09-07:00", "zip" => "94107", "enrollment_insurance_company" => { "name" => "Medicare", "payer_id" => "00431" } }, { "address" => "125 Snow Shoe Road", "city" => "Sacramento", "created_at" => "2013-04-14T07:29:09-07:00", "facility_name" => "Quality", "npi" => "987654321", "provider_name" => "Jane Austen", "ptan" => "54321", "state" => "CA", "status" => "submitted", "tax_id" => "12345678", "updated_at" => "2013-04-14T07:29:09-07:00", "zip" => "94107", "enrollment_insurance_company" => { "name" => "Medicare", "payer_id" => "00431" } }, { "address" => "125 Snow Shoe Road", "city" => "Sacramento", "created_at" => "2013-04-14T07:29:09-07:00", "facility_name" => "Quality", "npi" => "987654321", "provider_name" => "Jane Austen", "ptan" => "54321", "state" => "CA", "status" => "submitted", "tax_id" => "12345678", "updated_at" => "2013-04-14T07:29:09-07:00", "zip" => "94107", "enrollment_insurance_company" => { "name" => "Kaiser Nort", "payer_id" => "00282" } }, { "address" => "125 Snow Shoe Road", "city" => "Sacramento", "created_at" => "2013-04-14T07:29:09-07:00", "facility_name" => "Quality", "npi" => "987654321", "provider_name" => "Jane Austen", "ptan" => "54321", "state" => "CA", "status" => "submitted", "tax_id" => "12345678", "updated_at" => "2013-04-14T07:29:09-07:00", "zip" => "94107", "enrollment_insurance_company" => { "name" => "Kaiser Nort", "payer_id" => "00282" } }] } }
|
97
|
-
end
|