eligible 1.0 → 3.0.0.beta17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.circleci/config.yml +76 -0
- data/.codeclimate.yml +23 -0
- data/.gitignore +3 -0
- data/.rspec +3 -0
- data/.rubocop.yml +1158 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +170 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +66 -0
- data/LICENSE +1 -1
- data/README.md +700 -93
- data/Rakefile +12 -2
- data/eligible.gemspec +14 -16
- data/lib/eligible/api_resource.rb +49 -5
- data/lib/eligible/calculator_deploy_url.rb +7 -0
- data/lib/eligible/claim.rb +22 -6
- data/lib/eligible/coverage.rb +19 -0
- data/lib/eligible/coverage_resource.rb +23 -0
- data/lib/eligible/customer.rb +19 -0
- data/lib/eligible/demographic.rb +6 -35
- data/lib/eligible/eligible_object.rb +12 -15
- data/lib/eligible/encryptor.rb +121 -0
- data/lib/eligible/enrollment.rb +23 -0
- data/lib/eligible/errors/eligible_error.rb +6 -3
- data/lib/eligible/errors/invalid_request_error.rb +4 -0
- data/lib/eligible/icd.rb +16 -0
- data/lib/eligible/json.rb +5 -15
- data/lib/eligible/lockbox.rb +39 -0
- data/lib/eligible/medicare.rb +11 -0
- data/lib/eligible/oauth_token.rb +9 -0
- data/lib/eligible/ocr.rb +15 -0
- data/lib/eligible/original_signature_pdf.rb +45 -0
- data/lib/eligible/payer.rb +17 -0
- data/lib/eligible/payer_mapping.rb +37 -0
- data/lib/eligible/payment.rb +11 -0
- data/lib/eligible/preauth_resource.rb +11 -0
- data/lib/eligible/precert.rb +15 -0
- data/lib/eligible/provider_model.rb +7 -0
- data/lib/eligible/public_key.rb +27 -0
- data/lib/eligible/received_pdf.rb +26 -0
- data/lib/eligible/referral.rb +11 -0
- data/lib/eligible/risk_assessment.rb +15 -0
- data/lib/eligible/session_token.rb +11 -0
- data/lib/eligible/ticket.rb +40 -0
- data/lib/eligible/util.rb +29 -38
- data/lib/eligible/v1_0/action.rb +9 -0
- data/lib/eligible/v1_0/attribute.rb +9 -0
- data/lib/eligible/v1_0/charge.rb +13 -0
- data/lib/eligible/v1_0/claim.rb +25 -0
- data/lib/eligible/v1_0/claim_service_line.rb +9 -0
- data/lib/eligible/v1_0/contract.rb +9 -0
- data/lib/eligible/v1_0/device.rb +9 -0
- data/lib/eligible/v1_0/discount.rb +9 -0
- data/lib/eligible/v1_0/enrollment.rb +17 -0
- data/lib/eligible/v1_0/estimate.rb +29 -0
- data/lib/eligible/v1_0/estimate_service_line.rb +17 -0
- data/lib/eligible/v1_0/fee.rb +21 -0
- data/lib/eligible/v1_0/fee_refund.rb +29 -0
- data/lib/eligible/v1_0/file.rb +17 -0
- data/lib/eligible/v1_0/file_link.rb +13 -0
- data/lib/eligible/v1_0/insurance_company.rb +21 -0
- data/lib/eligible/v1_0/insurance_company_alias.rb +9 -0
- data/lib/eligible/v1_0/insurance_policy.rb +9 -0
- data/lib/eligible/v1_0/patient_question.rb +9 -0
- data/lib/eligible/v1_0/patient_questionnaire.rb +9 -0
- data/lib/eligible/v1_0/patient_record.rb +9 -0
- data/lib/eligible/v1_0/patient_statement.rb +54 -0
- data/lib/eligible/v1_0/patient_statement_service_line.rb +13 -0
- data/lib/eligible/v1_0/payment_report.rb +21 -0
- data/lib/eligible/v1_0/product.rb +9 -0
- data/lib/eligible/v1_0/provider.rb +9 -0
- data/lib/eligible/v1_0/remark.rb +21 -0
- data/lib/eligible/v1_0/reports/accuracy_stats.rb +23 -0
- data/lib/eligible/v1_0/reports/estimate_friction.rb +23 -0
- data/lib/eligible/v1_0/reports/in_scope_distribution.rb +23 -0
- data/lib/eligible/v1_0/rest_api_base.rb +44 -0
- data/lib/eligible/v1_0/rule.rb +13 -0
- data/lib/eligible/v1_0/session.rb +21 -0
- data/lib/eligible/v1_0/transaction.rb +21 -0
- data/lib/eligible/v1_0/treatment.rb +9 -0
- data/lib/eligible/v1_0/value_list.rb +9 -0
- data/lib/eligible/v1_0/value_list_item.rb +9 -0
- data/lib/eligible/v1_0/verification.rb +17 -0
- data/lib/eligible/version.rb +1 -1
- data/lib/eligible/visit_type.rb +11 -0
- data/lib/eligible/x12.rb +8 -0
- data/lib/eligible.rb +320 -110
- metadata +148 -67
- data/CONTRIBUTORS +0 -1
- data/lib/eligible/plan.rb +0 -42
- data/lib/eligible/service.rb +0 -39
- data/test/test_eligible.rb +0 -279
- data/test/test_helper.rb +0 -67
metadata
CHANGED
@@ -1,141 +1,222 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eligible
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
prerelease:
|
4
|
+
version: 3.0.0.beta17
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
|
-
-
|
7
|
+
- Katelyn Gleaon
|
8
|
+
- Rodrigo Dominguez
|
9
|
+
- Aaron Bedra
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date:
|
13
|
+
date: 2020-07-13 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
16
|
-
requirement:
|
17
|
-
none: false
|
16
|
+
name: rest-client
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - "~>"
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
22
|
-
type: :
|
21
|
+
version: 2.0.0
|
22
|
+
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - "~>"
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: 2.0.0
|
25
29
|
- !ruby/object:Gem::Dependency
|
26
|
-
name:
|
27
|
-
requirement:
|
28
|
-
none: false
|
30
|
+
name: multi_json
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
29
32
|
requirements:
|
30
|
-
- -
|
33
|
+
- - "~>"
|
31
34
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
33
|
-
type: :
|
35
|
+
version: '1.7'
|
36
|
+
type: :runtime
|
34
37
|
prerelease: false
|
35
|
-
version_requirements:
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '1.7'
|
36
43
|
- !ruby/object:Gem::Dependency
|
37
|
-
name:
|
38
|
-
requirement:
|
39
|
-
none: false
|
44
|
+
name: rake
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
40
46
|
requirements:
|
41
|
-
- -
|
47
|
+
- - "~>"
|
42
48
|
- !ruby/object:Gem::Version
|
43
|
-
version: '0'
|
49
|
+
version: '12.0'
|
44
50
|
type: :development
|
45
51
|
prerelease: false
|
46
|
-
version_requirements:
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - "~>"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '12.0'
|
47
57
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
49
|
-
requirement:
|
50
|
-
none: false
|
58
|
+
name: rspec
|
59
|
+
requirement: !ruby/object:Gem::Requirement
|
51
60
|
requirements:
|
52
|
-
- -
|
61
|
+
- - "~>"
|
53
62
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
63
|
+
version: '3.4'
|
55
64
|
type: :development
|
56
65
|
prerelease: false
|
57
|
-
version_requirements:
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - "~>"
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '3.4'
|
58
71
|
- !ruby/object:Gem::Dependency
|
59
|
-
name:
|
60
|
-
requirement:
|
61
|
-
none: false
|
72
|
+
name: rspec_junit_formatter
|
73
|
+
requirement: !ruby/object:Gem::Requirement
|
62
74
|
requirements:
|
63
|
-
- - ~>
|
75
|
+
- - "~>"
|
64
76
|
- !ruby/object:Gem::Version
|
65
|
-
version:
|
66
|
-
type: :
|
77
|
+
version: 0.3.0
|
78
|
+
type: :development
|
67
79
|
prerelease: false
|
68
|
-
version_requirements:
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: multi_json
|
71
|
-
requirement: &70130122473580 !ruby/object:Gem::Requirement
|
72
|
-
none: false
|
80
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
81
|
requirements:
|
74
|
-
- -
|
82
|
+
- - "~>"
|
75
83
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
77
|
-
|
84
|
+
version: 0.3.0
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: simplecov
|
87
|
+
requirement: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - "~>"
|
78
90
|
- !ruby/object:Gem::Version
|
79
|
-
version: '
|
80
|
-
type: :
|
91
|
+
version: '0.11'
|
92
|
+
type: :development
|
81
93
|
prerelease: false
|
82
|
-
version_requirements:
|
94
|
+
version_requirements: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - "~>"
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0.11'
|
83
99
|
description: Eligible is a developer-friendly way to process health care eligibility
|
84
|
-
checks. Learn more at https://
|
100
|
+
checks. Learn more at https://eligible.com
|
85
101
|
email:
|
86
|
-
-
|
102
|
+
- k@eligible.com
|
103
|
+
- rod@eligible.com
|
104
|
+
- abedra@eligible.com
|
87
105
|
executables: []
|
88
106
|
extensions: []
|
89
107
|
extra_rdoc_files: []
|
90
108
|
files:
|
91
|
-
- .
|
92
|
-
-
|
109
|
+
- ".circleci/config.yml"
|
110
|
+
- ".codeclimate.yml"
|
111
|
+
- ".gitignore"
|
112
|
+
- ".rspec"
|
113
|
+
- ".rubocop.yml"
|
114
|
+
- ".ruby-version"
|
115
|
+
- CHANGELOG.md
|
93
116
|
- Gemfile
|
117
|
+
- Gemfile.lock
|
94
118
|
- LICENSE
|
95
119
|
- README.md
|
96
120
|
- Rakefile
|
97
121
|
- eligible.gemspec
|
98
122
|
- lib/eligible.rb
|
99
123
|
- lib/eligible/api_resource.rb
|
124
|
+
- lib/eligible/calculator_deploy_url.rb
|
100
125
|
- lib/eligible/claim.rb
|
126
|
+
- lib/eligible/coverage.rb
|
127
|
+
- lib/eligible/coverage_resource.rb
|
128
|
+
- lib/eligible/customer.rb
|
101
129
|
- lib/eligible/demographic.rb
|
102
130
|
- lib/eligible/eligible_object.rb
|
131
|
+
- lib/eligible/encryptor.rb
|
132
|
+
- lib/eligible/enrollment.rb
|
103
133
|
- lib/eligible/errors/api_connection_error.rb
|
104
134
|
- lib/eligible/errors/api_error.rb
|
105
135
|
- lib/eligible/errors/authentication_error.rb
|
106
136
|
- lib/eligible/errors/eligible_error.rb
|
137
|
+
- lib/eligible/errors/invalid_request_error.rb
|
138
|
+
- lib/eligible/icd.rb
|
107
139
|
- lib/eligible/json.rb
|
108
|
-
- lib/eligible/
|
109
|
-
- lib/eligible/
|
140
|
+
- lib/eligible/lockbox.rb
|
141
|
+
- lib/eligible/medicare.rb
|
142
|
+
- lib/eligible/oauth_token.rb
|
143
|
+
- lib/eligible/ocr.rb
|
144
|
+
- lib/eligible/original_signature_pdf.rb
|
145
|
+
- lib/eligible/payer.rb
|
146
|
+
- lib/eligible/payer_mapping.rb
|
147
|
+
- lib/eligible/payment.rb
|
148
|
+
- lib/eligible/preauth_resource.rb
|
149
|
+
- lib/eligible/precert.rb
|
150
|
+
- lib/eligible/provider_model.rb
|
151
|
+
- lib/eligible/public_key.rb
|
152
|
+
- lib/eligible/received_pdf.rb
|
153
|
+
- lib/eligible/referral.rb
|
154
|
+
- lib/eligible/risk_assessment.rb
|
155
|
+
- lib/eligible/session_token.rb
|
156
|
+
- lib/eligible/ticket.rb
|
110
157
|
- lib/eligible/util.rb
|
158
|
+
- lib/eligible/v1_0/action.rb
|
159
|
+
- lib/eligible/v1_0/attribute.rb
|
160
|
+
- lib/eligible/v1_0/charge.rb
|
161
|
+
- lib/eligible/v1_0/claim.rb
|
162
|
+
- lib/eligible/v1_0/claim_service_line.rb
|
163
|
+
- lib/eligible/v1_0/contract.rb
|
164
|
+
- lib/eligible/v1_0/device.rb
|
165
|
+
- lib/eligible/v1_0/discount.rb
|
166
|
+
- lib/eligible/v1_0/enrollment.rb
|
167
|
+
- lib/eligible/v1_0/estimate.rb
|
168
|
+
- lib/eligible/v1_0/estimate_service_line.rb
|
169
|
+
- lib/eligible/v1_0/fee.rb
|
170
|
+
- lib/eligible/v1_0/fee_refund.rb
|
171
|
+
- lib/eligible/v1_0/file.rb
|
172
|
+
- lib/eligible/v1_0/file_link.rb
|
173
|
+
- lib/eligible/v1_0/insurance_company.rb
|
174
|
+
- lib/eligible/v1_0/insurance_company_alias.rb
|
175
|
+
- lib/eligible/v1_0/insurance_policy.rb
|
176
|
+
- lib/eligible/v1_0/patient_question.rb
|
177
|
+
- lib/eligible/v1_0/patient_questionnaire.rb
|
178
|
+
- lib/eligible/v1_0/patient_record.rb
|
179
|
+
- lib/eligible/v1_0/patient_statement.rb
|
180
|
+
- lib/eligible/v1_0/patient_statement_service_line.rb
|
181
|
+
- lib/eligible/v1_0/payment_report.rb
|
182
|
+
- lib/eligible/v1_0/product.rb
|
183
|
+
- lib/eligible/v1_0/provider.rb
|
184
|
+
- lib/eligible/v1_0/remark.rb
|
185
|
+
- lib/eligible/v1_0/reports/accuracy_stats.rb
|
186
|
+
- lib/eligible/v1_0/reports/estimate_friction.rb
|
187
|
+
- lib/eligible/v1_0/reports/in_scope_distribution.rb
|
188
|
+
- lib/eligible/v1_0/rest_api_base.rb
|
189
|
+
- lib/eligible/v1_0/rule.rb
|
190
|
+
- lib/eligible/v1_0/session.rb
|
191
|
+
- lib/eligible/v1_0/transaction.rb
|
192
|
+
- lib/eligible/v1_0/treatment.rb
|
193
|
+
- lib/eligible/v1_0/value_list.rb
|
194
|
+
- lib/eligible/v1_0/value_list_item.rb
|
195
|
+
- lib/eligible/v1_0/verification.rb
|
111
196
|
- lib/eligible/version.rb
|
112
|
-
-
|
113
|
-
-
|
114
|
-
homepage: https://
|
197
|
+
- lib/eligible/visit_type.rb
|
198
|
+
- lib/eligible/x12.rb
|
199
|
+
homepage: https://github.com/eligible/eligible-ruby
|
115
200
|
licenses:
|
116
201
|
- MIT
|
202
|
+
metadata: {}
|
117
203
|
post_install_message:
|
118
204
|
rdoc_options: []
|
119
205
|
require_paths:
|
120
206
|
- lib
|
121
207
|
required_ruby_version: !ruby/object:Gem::Requirement
|
122
|
-
none: false
|
123
208
|
requirements:
|
124
|
-
- -
|
209
|
+
- - ">="
|
125
210
|
- !ruby/object:Gem::Version
|
126
211
|
version: '0'
|
127
212
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
|
-
none: false
|
129
213
|
requirements:
|
130
|
-
- -
|
214
|
+
- - ">"
|
131
215
|
- !ruby/object:Gem::Version
|
132
|
-
version:
|
216
|
+
version: 1.3.1
|
133
217
|
requirements: []
|
134
|
-
|
135
|
-
rubygems_version: 1.8.13
|
218
|
+
rubygems_version: 3.0.6
|
136
219
|
signing_key:
|
137
|
-
specification_version:
|
220
|
+
specification_version: 4
|
138
221
|
summary: Ruby wrapper for the Eligible API
|
139
|
-
test_files:
|
140
|
-
- test/test_eligible.rb
|
141
|
-
- test/test_helper.rb
|
222
|
+
test_files: []
|
data/CONTRIBUTORS
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Andy Brett <andy@andybrett.com>
|
data/lib/eligible/plan.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
module Eligible
|
2
|
-
COMMON_ATTRIBUTES = [:timestamp, :eligible_id, :mapping_version, :primary_insurance, :additional_insurance]
|
3
|
-
STATUS_ATTRIBUTES = [:type, :coverage_status]
|
4
|
-
BALANCE_ATTRIBUTES = [:balance, :comments]
|
5
|
-
STOP_LOSS_ATTRIBUTES = [:stop_loss_in_network, :stop_loss_out_network]
|
6
|
-
|
7
|
-
class Plan < APIResource
|
8
|
-
def self.get(params, api_key=nil)
|
9
|
-
response, api_key = Eligible.request(:get, url, api_key, params)
|
10
|
-
Util.convert_to_eligible_object(response, api_key)
|
11
|
-
end
|
12
|
-
|
13
|
-
def all
|
14
|
-
error ? nil : to_hash
|
15
|
-
end
|
16
|
-
|
17
|
-
def status
|
18
|
-
keys = COMMON_ATTRIBUTES + STATUS_ATTRIBUTES
|
19
|
-
error ? nil : to_hash.select { |k, v| keys.include?(k) }
|
20
|
-
end
|
21
|
-
|
22
|
-
def deductible
|
23
|
-
keys = COMMON_ATTRIBUTES + STATUS_ATTRIBUTES + [:deductible_in_network, :deductible_out_network]
|
24
|
-
error ? nil : to_hash.select { |k, v| keys.include?(k) }
|
25
|
-
end
|
26
|
-
|
27
|
-
def dates
|
28
|
-
keys = COMMON_ATTRIBUTES
|
29
|
-
error ? nil : to_hash.select { |k, v| keys.include?(k) }
|
30
|
-
end
|
31
|
-
|
32
|
-
def balance
|
33
|
-
keys = COMMON_ATTRIBUTES + BALANCE_ATTRIBUTES
|
34
|
-
error ? nil : to_hash.select { |k, v| keys.include?(k) }
|
35
|
-
end
|
36
|
-
|
37
|
-
def stop_loss
|
38
|
-
keys = COMMON_ATTRIBUTES + STOP_LOSS_ATTRIBUTES
|
39
|
-
error ? nil : to_hash.select { |k, v| keys.include?(k) }
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
data/lib/eligible/service.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
module Eligible
|
2
|
-
class Service < APIResource
|
3
|
-
COMMON_ATTRIBUTES = [:timestamp, :eligible_id, :mapping_version, :additional_insurance]
|
4
|
-
STATUS_ATTRIBUTES = [:type, :coverage_status]
|
5
|
-
VISITS_ATTRIBUTES = [:not_covered, :comments, :precertification_needed, :visits_in_network, :visits_out_network]
|
6
|
-
COPAYMENT_ATTRIBUTES = [:copayment_in_network, :copayment_out_network]
|
7
|
-
COINSURANCE_ATTRIBUTES = [:coinsurance_in_network, :coinsurance_out_network]
|
8
|
-
DEDUCTIBLE_ATTRIBUTES = [:deductible_in_network, :deductible_out_network]
|
9
|
-
|
10
|
-
def self.get(params, api_key=nil)
|
11
|
-
response, api_key = Eligible.request(:get, url, api_key, params)
|
12
|
-
Util.convert_to_eligible_object(response, api_key)
|
13
|
-
end
|
14
|
-
|
15
|
-
def all
|
16
|
-
error ? nil : to_hash
|
17
|
-
end
|
18
|
-
|
19
|
-
def visits
|
20
|
-
keys = COMMON_ATTRIBUTES + STATUS_ATTRIBUTES + VISITS_ATTRIBUTES
|
21
|
-
error ? nil : to_hash.select { |k, v| keys.include?(k) }
|
22
|
-
end
|
23
|
-
|
24
|
-
def copayment
|
25
|
-
keys = COMMON_ATTRIBUTES + STATUS_ATTRIBUTES + COPAYMENT_ATTRIBUTES
|
26
|
-
error ? nil : to_hash.select { |k, v| keys.include?(k) }
|
27
|
-
end
|
28
|
-
|
29
|
-
def coinsurance
|
30
|
-
keys = COMMON_ATTRIBUTES + STATUS_ATTRIBUTES + COINSURANCE_ATTRIBUTES
|
31
|
-
error ? nil : to_hash.select { |k, v| keys.include?(k) }
|
32
|
-
end
|
33
|
-
|
34
|
-
def deductible
|
35
|
-
keys = COMMON_ATTRIBUTES + STATUS_ATTRIBUTES + DEDUCTIBLE_ATTRIBUTES
|
36
|
-
error ? nil : to_hash.select { |k, v| keys.include?(k) }
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
data/test/test_eligible.rb
DELETED
@@ -1,279 +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.api_key = "TEST"
|
19
|
-
@mock = mock
|
20
|
-
Eligible.mock_rest_client = @mock
|
21
|
-
end
|
22
|
-
|
23
|
-
teardown do
|
24
|
-
Eligible.mock_rest_client = nil
|
25
|
-
Eligible.api_key = nil
|
26
|
-
end
|
27
|
-
|
28
|
-
should "not specifying api credentials should raise an exception" do
|
29
|
-
Eligible.api_key = nil
|
30
|
-
assert_raises Eligible::AuthenticationError do
|
31
|
-
Eligible::Plan.get({})
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
should "specifying invalid api credentials should raise an exception" do
|
36
|
-
Eligible.api_key = "invalid"
|
37
|
-
response = test_response(test_invalid_api_key_error, 401)
|
38
|
-
assert_raises Eligible::AuthenticationError do
|
39
|
-
@mock.expects(:get).once.raises(RestClient::ExceptionWithResponse.new(response, 401))
|
40
|
-
Eligible::Plan.get({})
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
context "Plan" do
|
46
|
-
setup do
|
47
|
-
Eligible.api_key = "TEST"
|
48
|
-
@mock = mock
|
49
|
-
Eligible.mock_rest_client = @mock
|
50
|
-
end
|
51
|
-
|
52
|
-
teardown do
|
53
|
-
Eligible.mock_rest_client = nil
|
54
|
-
Eligible.api_key = nil
|
55
|
-
end
|
56
|
-
|
57
|
-
should "return an error if no params are supplied" do
|
58
|
-
params = {}
|
59
|
-
response = test_response(test_plan_missing_params)
|
60
|
-
@mock.expects(:get).returns(response)
|
61
|
-
plan = Eligible::Plan.get(params)
|
62
|
-
assert_not_nil plan.error
|
63
|
-
end
|
64
|
-
|
65
|
-
should "return plan information if valid params are supplied" do
|
66
|
-
params = {
|
67
|
-
:payer_name => "Aetna",
|
68
|
-
:payer_id => "000001",
|
69
|
-
:service_provider_last_name => "Last",
|
70
|
-
:service_provider_first_name => "First",
|
71
|
-
:service_provider_NPI => "1928384219",
|
72
|
-
:subscriber_id => "W120923801",
|
73
|
-
:subscriber_last_name => "Austen",
|
74
|
-
:subscriber_first_name => "Jane",
|
75
|
-
:subscriber_dob => "1955-12-14"
|
76
|
-
}
|
77
|
-
response = test_response(test_plan)
|
78
|
-
@mock.expects(:get).returns(response)
|
79
|
-
plan = Eligible::Plan.get(params)
|
80
|
-
assert_nil plan.error
|
81
|
-
assert_not_nil plan.all
|
82
|
-
end
|
83
|
-
|
84
|
-
should "return the right subsets of the data when requested" do
|
85
|
-
params = {
|
86
|
-
:payer_name => "Aetna",
|
87
|
-
:payer_id => "000001",
|
88
|
-
:service_provider_last_name => "Last",
|
89
|
-
:service_provider_first_name => "First",
|
90
|
-
:service_provider_NPI => "1928384219",
|
91
|
-
:subscriber_id => "W120923801",
|
92
|
-
:subscriber_last_name => "Austen",
|
93
|
-
:subscriber_first_name => "Jane",
|
94
|
-
:subscriber_dob => "1955-12-14"
|
95
|
-
}
|
96
|
-
response = test_response(test_plan)
|
97
|
-
@mock.expects(:get).returns(response)
|
98
|
-
plan = Eligible::Plan.get(params)
|
99
|
-
|
100
|
-
assert_not_nil plan.all[:primary_insurance]
|
101
|
-
assert_not_nil plan.status[:coverage_status]
|
102
|
-
assert_nil plan.status[:deductible_in_network]
|
103
|
-
assert_not_nil plan.deductible[:deductible_in_network]
|
104
|
-
assert_nil plan.deductible[:balance]
|
105
|
-
assert_not_nil plan.dates[:primary_insurance][:plan_begins]
|
106
|
-
assert_nil plan.dates[:deductible_in_network]
|
107
|
-
assert_not_nil plan.balance[:balance]
|
108
|
-
assert_nil plan.balance[:deductible_in_network]
|
109
|
-
assert_not_nil plan.stop_loss[:stop_loss_in_network]
|
110
|
-
assert_nil plan.stop_loss[:deductible_in_network]
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
context "Service" do
|
115
|
-
setup do
|
116
|
-
Eligible.api_key = "TEST"
|
117
|
-
@mock = mock
|
118
|
-
Eligible.mock_rest_client = @mock
|
119
|
-
end
|
120
|
-
|
121
|
-
teardown do
|
122
|
-
Eligible.mock_rest_client = nil
|
123
|
-
Eligible.api_key = nil
|
124
|
-
end
|
125
|
-
|
126
|
-
should "return an error if no params are supplied" do
|
127
|
-
params = {}
|
128
|
-
response = test_response(test_service_missing_params)
|
129
|
-
@mock.expects(:get).returns(response)
|
130
|
-
service = Eligible::Service.get(params)
|
131
|
-
assert_not_nil service.error
|
132
|
-
end
|
133
|
-
|
134
|
-
should "return eligibility information if valid params are supplied" do
|
135
|
-
params = {
|
136
|
-
:payer_name => "Aetna",
|
137
|
-
:payer_id => "000001",
|
138
|
-
:service_provider_last_name => "Last",
|
139
|
-
:service_provider_first_name => "First",
|
140
|
-
:service_provider_NPI => "1928384219",
|
141
|
-
:subscriber_id => "W120923801",
|
142
|
-
:subscriber_last_name => "Austen",
|
143
|
-
:subscriber_first_name => "Jane",
|
144
|
-
:subscriber_dob => "1955-12-14"
|
145
|
-
}
|
146
|
-
response = test_response(test_service)
|
147
|
-
@mock.expects(:get).returns(response)
|
148
|
-
service = Eligible::Service.get(params)
|
149
|
-
assert_nil service.error
|
150
|
-
assert_not_nil service.all
|
151
|
-
end
|
152
|
-
|
153
|
-
should "return the right subsets of the data when requested" do
|
154
|
-
params = {
|
155
|
-
:payer_name => "Aetna",
|
156
|
-
:payer_id => "000001",
|
157
|
-
:service_provider_last_name => "Last",
|
158
|
-
:service_provider_first_name => "First",
|
159
|
-
:service_provider_NPI => "1928384219",
|
160
|
-
:subscriber_id => "W120923801",
|
161
|
-
:subscriber_last_name => "Austen",
|
162
|
-
:subscriber_first_name => "Jane",
|
163
|
-
:subscriber_dob => "1955-12-14"
|
164
|
-
}
|
165
|
-
response = test_response(test_service)
|
166
|
-
@mock.expects(:get).returns(response)
|
167
|
-
service = Eligible::Service.get(params)
|
168
|
-
|
169
|
-
assert_not_nil service.all[:service_begins]
|
170
|
-
assert_not_nil service.visits[:visits_in_network]
|
171
|
-
assert_nil service.visits[:copayment_in_network]
|
172
|
-
assert_not_nil service.copayment[:copayment_in_network]
|
173
|
-
assert_nil service.copayment[:visits_in_network]
|
174
|
-
assert_not_nil service.coinsurance[:coinsurance_in_network]
|
175
|
-
assert_nil service.coinsurance[:visits_in_network]
|
176
|
-
assert_not_nil service.deductible[:deductible_in_network]
|
177
|
-
assert_nil service.deductible[:visits_in_network]
|
178
|
-
end
|
179
|
-
end
|
180
|
-
|
181
|
-
context "Demographic" do
|
182
|
-
setup do
|
183
|
-
Eligible.api_key = "TEST"
|
184
|
-
@mock = mock
|
185
|
-
Eligible.mock_rest_client = @mock
|
186
|
-
end
|
187
|
-
|
188
|
-
teardown do
|
189
|
-
Eligible.mock_rest_client = nil
|
190
|
-
Eligible.api_key = nil
|
191
|
-
end
|
192
|
-
|
193
|
-
should "return an error if no params are supplied" do
|
194
|
-
params = {}
|
195
|
-
response = test_response(test_demographic_missing_params)
|
196
|
-
@mock.expects(:get).returns(response)
|
197
|
-
demographic = Eligible::Demographic.get(params)
|
198
|
-
assert_not_nil demographic.error
|
199
|
-
end
|
200
|
-
|
201
|
-
should "return demographic information if valid params are supplied" do
|
202
|
-
params = {
|
203
|
-
:payer_name => "Aetna",
|
204
|
-
:payer_id => "000001",
|
205
|
-
:service_provider_last_name => "Last",
|
206
|
-
:service_provider_first_name => "First",
|
207
|
-
:service_provider_NPI => "1928384219",
|
208
|
-
:subscriber_id => "W120923801",
|
209
|
-
:subscriber_last_name => "Austen",
|
210
|
-
:subscriber_first_name => "Jane",
|
211
|
-
:subscriber_dob => "1955-12-14"
|
212
|
-
}
|
213
|
-
response = test_response(test_demographic)
|
214
|
-
@mock.expects(:get).returns(response)
|
215
|
-
demographic = Eligible::Demographic.get(params)
|
216
|
-
assert_nil demographic.error
|
217
|
-
assert_not_nil demographic.all
|
218
|
-
end
|
219
|
-
|
220
|
-
should "return the right subsets of the data when requested" do
|
221
|
-
params = {
|
222
|
-
:payer_name => "Aetna",
|
223
|
-
:payer_id => "000001",
|
224
|
-
:service_provider_last_name => "Last",
|
225
|
-
:service_provider_first_name => "First",
|
226
|
-
:service_provider_NPI => "1928384219",
|
227
|
-
:subscriber_id => "W120923801",
|
228
|
-
:subscriber_last_name => "Austen",
|
229
|
-
:subscriber_first_name => "Jane",
|
230
|
-
:subscriber_dob => "1955-12-14"
|
231
|
-
}
|
232
|
-
response = test_response(test_demographic)
|
233
|
-
@mock.expects(:get).returns(response)
|
234
|
-
demographic = Eligible::Demographic.get(params)
|
235
|
-
|
236
|
-
assert_not_nil demographic.all[:timestamp]
|
237
|
-
assert_not_nil demographic.zip[:zip]
|
238
|
-
assert_nil demographic.zip[:group_id]
|
239
|
-
assert_not_nil demographic.employer[:group_id]
|
240
|
-
assert_nil demographic.employer[:zip]
|
241
|
-
assert_not_nil demographic.address[:address]
|
242
|
-
assert_nil demographic.address[:group_id]
|
243
|
-
assert_not_nil demographic.dob[:dob]
|
244
|
-
assert_nil demographic.dob[:address]
|
245
|
-
end
|
246
|
-
end
|
247
|
-
|
248
|
-
context "Claim" do
|
249
|
-
setup do
|
250
|
-
Eligible.api_key = "TEST"
|
251
|
-
@mock = mock
|
252
|
-
Eligible.mock_rest_client = @mock
|
253
|
-
end
|
254
|
-
|
255
|
-
teardown do
|
256
|
-
Eligible.mock_rest_client = nil
|
257
|
-
Eligible.api_key = nil
|
258
|
-
end
|
259
|
-
|
260
|
-
should "return an error if no params are supplied" do
|
261
|
-
params = {}
|
262
|
-
response = test_response(test_claim_missing_params)
|
263
|
-
@mock.expects(:get).returns(response)
|
264
|
-
claim = Eligible::Claim.get(params)
|
265
|
-
assert_not_nil claim.error
|
266
|
-
end
|
267
|
-
|
268
|
-
should "return claim information if valid params are supplied" do
|
269
|
-
params = {
|
270
|
-
:tbd => true
|
271
|
-
}
|
272
|
-
response = test_response(test_claim)
|
273
|
-
@mock.expects(:get).returns(response)
|
274
|
-
claim = Eligible::Claim.get(params)
|
275
|
-
assert_nil claim.error
|
276
|
-
assert_not_nil claim.status
|
277
|
-
end
|
278
|
-
end
|
279
|
-
end
|