change_healthcare-eligibility 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.rubocop.yml +130 -0
- data/.ruby-version +1 -0
- data/.travis.yml +7 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +59 -0
- data/LICENSE.txt +21 -0
- data/README.md +64 -0
- data/Rakefile +6 -0
- data/bin/console +11 -0
- data/bin/rspec +29 -0
- data/bin/setup +8 -0
- data/change_healthcare-eligibility.gemspec +44 -0
- data/lib/change_healthcare/eligibility.rb +13 -0
- data/lib/change_healthcare/eligibility/inspector.rb +82 -0
- data/lib/change_healthcare/eligibility/swagger_client.rb +81 -0
- data/lib/change_healthcare/eligibility/swagger_client/api_client.rb +388 -0
- data/lib/change_healthcare/eligibility/swagger_client/api_error.rb +40 -0
- data/lib/change_healthcare/eligibility/swagger_client/configuration.rb +202 -0
- data/lib/change_healthcare/eligibility/swagger_client/eligibility_api.rb +198 -0
- data/lib/change_healthcare/eligibility/swagger_client/models/additional_identification.rb +266 -0
- data/lib/change_healthcare/eligibility/swagger_client/models/additional_information.rb +185 -0
- data/lib/change_healthcare/eligibility/swagger_client/models/address.rb +218 -0
- data/lib/change_healthcare/eligibility/swagger_client/models/benefits_additional_information.rb +376 -0
- data/lib/change_healthcare/eligibility/swagger_client/models/benefits_date_information.rb +340 -0
- data/lib/change_healthcare/eligibility/swagger_client/models/benefits_information.rb +338 -0
- data/lib/change_healthcare/eligibility/swagger_client/models/benefits_related_entity.rb +240 -0
- data/lib/change_healthcare/eligibility/swagger_client/models/benefits_service_delivery.rb +220 -0
- data/lib/change_healthcare/eligibility/swagger_client/models/composite_medical_procedure_identifier.rb +218 -0
- data/lib/change_healthcare/eligibility/swagger_client/models/eligibility_additional_information.rb +200 -0
- data/lib/change_healthcare/eligibility/swagger_client/models/encounter.rb +359 -0
- data/lib/change_healthcare/eligibility/swagger_client/models/error.rb +205 -0
- data/lib/change_healthcare/eligibility/swagger_client/models/health_care_diagnosis_code.rb +190 -0
- data/lib/change_healthcare/eligibility/swagger_client/models/health_care_information.rb +229 -0
- data/lib/change_healthcare/eligibility/swagger_client/models/health_check.rb +190 -0
- data/lib/change_healthcare/eligibility/swagger_client/models/information_receiver_name.rb +303 -0
- data/lib/change_healthcare/eligibility/swagger_client/models/loop_2000_cd2100_cd_segment_nm1_ref_dmg_ins_mpi_prv_notes_response_member.rb +429 -0
- data/lib/change_healthcare/eligibility/swagger_client/models/loop_2100_a_segments_nm1_and_per_notes_information_source_name.rb +293 -0
- data/lib/change_healthcare/eligibility/swagger_client/models/loop_2100_a_segments_per_element_per03_8_notes_communication.rb +194 -0
- data/lib/change_healthcare/eligibility/swagger_client/models/loop_2100_a_segments_per_notes_information_source_contact_information.rb +198 -0
- data/lib/change_healthcare/eligibility/swagger_client/models/loop_2100_bcd_segment_nm1_prv_notes_provider.rb +322 -0
- data/lib/change_healthcare/eligibility/swagger_client/models/loop_2100_cd_segment_trn_notes_subscriber_trace_numbers.rb +218 -0
- data/lib/change_healthcare/eligibility/swagger_client/models/loop_2110_cd_segments_ref_notes_subscriber_dependent_additional_identification.rb +488 -0
- data/lib/change_healthcare/eligibility/swagger_client/models/medical_eligibility.rb +272 -0
- data/lib/change_healthcare/eligibility/swagger_client/models/medical_procedure.rb +254 -0
- data/lib/change_healthcare/eligibility/swagger_client/models/plan_date_information.rb +340 -0
- data/lib/change_healthcare/eligibility/swagger_client/models/plan_status.rb +204 -0
- data/lib/change_healthcare/eligibility/swagger_client/models/provider.rb +304 -0
- data/lib/change_healthcare/eligibility/swagger_client/models/provider_information.rb +190 -0
- data/lib/change_healthcare/eligibility/swagger_client/models/raw_x12_request.rb +190 -0
- data/lib/change_healthcare/eligibility/swagger_client/models/request_dependent.rb +452 -0
- data/lib/change_healthcare/eligibility/swagger_client/models/request_subscriber.rb +456 -0
- data/lib/change_healthcare/eligibility/swagger_client/models/response.rb +322 -0
- data/lib/change_healthcare/eligibility/swagger_client/version.rb +17 -0
- data/lib/change_healthcare/eligibility/version.rb +5 -0
- data/lib/change_healthcare/eligibility/wrapper.rb +124 -0
- metadata +214 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: fac67a6f8b4547d2caa3e8fb3051cec06438e2f2fc49c89fac7f7fe6a1545485
|
4
|
+
data.tar.gz: eb8a8993bc6b5720fb715f694a7313154dde4e64fdf53db7900669e15ab8771a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3b9dc680ae542fe4bade68012979482889d0daf7b7760d3f3d6f7b19a4304a35e6389d911a43dae35307de407f86999825f29a378bddf8cda7225e60d6c777c6
|
7
|
+
data.tar.gz: 712e2964ea04669f80fc7d35a6929f86432a23dc4508c8f745ec995865dea3bdfc9d02d420ba21852ec10fa428af44a5741638d74d6187dc1710397c5a6dd253
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
require: rubocop-rspec
|
2
|
+
|
3
|
+
AllCops:
|
4
|
+
TargetRubyVersion: 2.6.0
|
5
|
+
Exclude:
|
6
|
+
- 'bin/bundle'
|
7
|
+
- 'example/bin/bundle'
|
8
|
+
- 'vendor/bundle/**/*'
|
9
|
+
- 'lib/change_healthcare/eligibility/swagger_client/**/*.rb'
|
10
|
+
|
11
|
+
Layout/LineLength:
|
12
|
+
Max: 160
|
13
|
+
|
14
|
+
RSpec/NamedSubject:
|
15
|
+
Enabled: false
|
16
|
+
|
17
|
+
RSpec/DescribeClass:
|
18
|
+
Enabled: false
|
19
|
+
|
20
|
+
Metrics/BlockLength:
|
21
|
+
Exclude:
|
22
|
+
- 'spec/**/*.rb'
|
23
|
+
- 'sober_swag.gemspec'
|
24
|
+
- 'example/spec/**/*.rb'
|
25
|
+
|
26
|
+
RSpec/ImplicitBlockExpectation:
|
27
|
+
Enabled: false
|
28
|
+
|
29
|
+
RSpec/ImplicitExpect:
|
30
|
+
EnforcedStyle: should
|
31
|
+
|
32
|
+
RSpec/LeadingSubject:
|
33
|
+
Enabled: false
|
34
|
+
|
35
|
+
Style/MultilineBlockChain:
|
36
|
+
Enabled: false
|
37
|
+
|
38
|
+
Metrics/AbcSize:
|
39
|
+
Enabled: false
|
40
|
+
|
41
|
+
Style/Documentation:
|
42
|
+
Exclude:
|
43
|
+
- 'example/db/migrate/**/*'
|
44
|
+
|
45
|
+
Metrics/PerceivedComplexity:
|
46
|
+
Enabled: false
|
47
|
+
|
48
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
49
|
+
Enabled: true
|
50
|
+
|
51
|
+
Layout/SpaceAroundMethodCallOperator:
|
52
|
+
Enabled: true
|
53
|
+
|
54
|
+
Lint/DeprecatedOpenSSLConstant:
|
55
|
+
Enabled: true
|
56
|
+
|
57
|
+
Lint/DuplicateElsifCondition:
|
58
|
+
Enabled: true
|
59
|
+
|
60
|
+
Lint/MixedRegexpCaptureTypes:
|
61
|
+
Enabled: true
|
62
|
+
|
63
|
+
Lint/RaiseException:
|
64
|
+
Enabled: true
|
65
|
+
|
66
|
+
Lint/StructNewOverride:
|
67
|
+
Enabled: true
|
68
|
+
|
69
|
+
Style/AccessorGrouping:
|
70
|
+
Enabled: true
|
71
|
+
|
72
|
+
Style/ArrayCoercion:
|
73
|
+
Enabled: true
|
74
|
+
|
75
|
+
Style/BisectedAttrAccessor:
|
76
|
+
Enabled: true
|
77
|
+
|
78
|
+
Style/CaseLikeIf:
|
79
|
+
Enabled: true
|
80
|
+
|
81
|
+
Style/ExponentialNotation:
|
82
|
+
Enabled: true
|
83
|
+
|
84
|
+
Style/HashAsLastArrayItem:
|
85
|
+
Enabled: true
|
86
|
+
|
87
|
+
Style/HashEachMethods:
|
88
|
+
Enabled: true
|
89
|
+
|
90
|
+
Style/HashLikeCase:
|
91
|
+
Enabled: true
|
92
|
+
|
93
|
+
Style/HashTransformKeys:
|
94
|
+
Enabled: true
|
95
|
+
|
96
|
+
Style/HashTransformValues:
|
97
|
+
Enabled: true
|
98
|
+
|
99
|
+
Style/RedundantAssignment:
|
100
|
+
Enabled: true
|
101
|
+
|
102
|
+
Style/RedundantFetchBlock:
|
103
|
+
Enabled: true
|
104
|
+
|
105
|
+
Style/RedundantFileExtensionInRequire:
|
106
|
+
Enabled: true
|
107
|
+
|
108
|
+
Style/RedundantRegexpCharacterClass:
|
109
|
+
Enabled: true
|
110
|
+
|
111
|
+
Style/RedundantRegexpEscape:
|
112
|
+
Enabled: true
|
113
|
+
|
114
|
+
Style/SlicingWithRange:
|
115
|
+
Enabled: true
|
116
|
+
|
117
|
+
RSpec/NestedGroups:
|
118
|
+
Max: 5
|
119
|
+
|
120
|
+
RSpec/ImplicitSubject:
|
121
|
+
Enabled: false
|
122
|
+
|
123
|
+
RSpec/ExampleLength:
|
124
|
+
Max: 10
|
125
|
+
|
126
|
+
Style/FrozenStringLiteralComment:
|
127
|
+
Enabled: false
|
128
|
+
|
129
|
+
Style/BlockDelimiters:
|
130
|
+
EnforcedStyle: braces_for_chaining
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.6.5
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
change_healthcare-eligibility (0.1.0)
|
5
|
+
addressable (~> 2.4.0)
|
6
|
+
typhoeus (~> 1.4.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
addressable (2.4.0)
|
12
|
+
byebug (11.1.3)
|
13
|
+
coderay (1.1.3)
|
14
|
+
diff-lcs (1.4.4)
|
15
|
+
docile (1.3.2)
|
16
|
+
ethon (0.12.0)
|
17
|
+
ffi (>= 1.3.0)
|
18
|
+
ffi (1.13.1)
|
19
|
+
method_source (1.0.0)
|
20
|
+
pry (0.13.1)
|
21
|
+
coderay (~> 1.1)
|
22
|
+
method_source (~> 1.0)
|
23
|
+
rake (10.5.0)
|
24
|
+
rspec (3.9.0)
|
25
|
+
rspec-core (~> 3.9.0)
|
26
|
+
rspec-expectations (~> 3.9.0)
|
27
|
+
rspec-mocks (~> 3.9.0)
|
28
|
+
rspec-core (3.9.2)
|
29
|
+
rspec-support (~> 3.9.3)
|
30
|
+
rspec-expectations (3.9.2)
|
31
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
+
rspec-support (~> 3.9.0)
|
33
|
+
rspec-mocks (3.9.1)
|
34
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
35
|
+
rspec-support (~> 3.9.0)
|
36
|
+
rspec-support (3.9.3)
|
37
|
+
simplecov (0.20.0)
|
38
|
+
docile (~> 1.1)
|
39
|
+
simplecov-html (~> 0.11)
|
40
|
+
simplecov_json_formatter (~> 0.1)
|
41
|
+
simplecov-html (0.12.3)
|
42
|
+
simplecov_json_formatter (0.1.2)
|
43
|
+
typhoeus (1.4.0)
|
44
|
+
ethon (>= 0.9.0)
|
45
|
+
|
46
|
+
PLATFORMS
|
47
|
+
ruby
|
48
|
+
|
49
|
+
DEPENDENCIES
|
50
|
+
bundler (~> 2.0)
|
51
|
+
byebug
|
52
|
+
change_healthcare-eligibility!
|
53
|
+
pry
|
54
|
+
rake (~> 10.0)
|
55
|
+
rspec (~> 3.0)
|
56
|
+
simplecov
|
57
|
+
|
58
|
+
BUNDLED WITH
|
59
|
+
2.1.4
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Sondermind, INC
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# ChangeHealthcare::Eligibility
|
2
|
+
|
3
|
+
This Ruby Gem provides the automatically generated swagger code for the [Change Healthcare Eligibility API](https://developers.changehealthcare.com/api/Eligibility/v3).
|
4
|
+
It also provides a wrapper that makes making requests a bit easier by caching and re-fetching authorization information.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'change_healthcare-eligibility'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install change_healthcare-eligibility
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
The automatically generated API is located under the namespace `ChangeHealthcare::Eligibility::SwaggerClient`.
|
25
|
+
Most people should access it via the `ChangeHealthcare::Eligibility::Wrapper` class, which provides swagger caching.
|
26
|
+
|
27
|
+
That is used as so:
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
wrapper = ChangeHealthcare::Eligibility::Wrapper.new(client_id: ENV['CH_CLIENT_ID'], client_secret: ENV['CH_CLIENT_SECRET'])
|
31
|
+
request = ChangeHealthcare::Eligibility::SwaggerClient::MedicalEligibility.new
|
32
|
+
request.control_number = some_control_number
|
33
|
+
request.subscriber = some_subscriber
|
34
|
+
end
|
35
|
+
|
36
|
+
response = wrapper.eligibility(request) # => ChangeHealthcare::Eligibility::SwaggerClient::Response
|
37
|
+
|
38
|
+
response.benefits_information.any? { |bi| bi.name == 'Deductible' }
|
39
|
+
```
|
40
|
+
|
41
|
+
You can also make a request using `tap`, which you might subjectively find nicer:
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
request = ChangeHealthcare::Eligibility::SwaggerClient::MedicalEligibility.new.tap do |e|
|
45
|
+
e.control_number = some_control_number
|
46
|
+
e.subscriber = some_subscriber
|
47
|
+
end
|
48
|
+
```
|
49
|
+
|
50
|
+
Both of these have the same effect: you're just mutating attributes on a `request` object.
|
51
|
+
|
52
|
+
## Development
|
53
|
+
|
54
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
55
|
+
|
56
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
57
|
+
|
58
|
+
## Contributing
|
59
|
+
|
60
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/SonderMindOrg/change_healthcare-eligibility.
|
61
|
+
|
62
|
+
## License
|
63
|
+
|
64
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'change_healthcare/eligibility'
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
require 'pry'
|
11
|
+
Pry.start
|
data/bin/rspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'rspec' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require 'pathname'
|
12
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path('bundle', __dir__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require 'rubygems'
|
27
|
+
require 'bundler/setup'
|
28
|
+
|
29
|
+
load Gem.bin_path('rspec-core', 'rspec')
|
data/bin/setup
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'change_healthcare/eligibility/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'change_healthcare-eligibility'
|
7
|
+
spec.version = ChangeHealthcare::Eligibility::VERSION
|
8
|
+
spec.authors = ['Anthony Super']
|
9
|
+
spec.email = ['asuper@sondermind.com']
|
10
|
+
|
11
|
+
spec.required_ruby_version = '>= 2.6.0'
|
12
|
+
|
13
|
+
spec.summary = "Unofficial gem for interacting with Change Healthcare's Eligibility API"
|
14
|
+
spec.description = 'Verify benefits in real-time!'
|
15
|
+
spec.homepage = 'https://github.com/SonderMindOrg/change_healthcare-eligibility'
|
16
|
+
spec.license = 'MIT'
|
17
|
+
|
18
|
+
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
19
|
+
|
20
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
21
|
+
spec.metadata['source_code_uri'] = 'https://github.com/SonderMindOrg/change_healthcare-eligibility'
|
22
|
+
# spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
23
|
+
|
24
|
+
# Specify which files should be added to the gem when it is released.
|
25
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
26
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
27
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
28
|
+
end
|
29
|
+
spec.bindir = 'exe'
|
30
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ['lib']
|
32
|
+
|
33
|
+
# needed for autogen swagged client
|
34
|
+
spec.add_dependency 'addressable', '~> 2.4.0'
|
35
|
+
spec.add_dependency 'typhoeus', '~> 1.4.0'
|
36
|
+
|
37
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
38
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
39
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
40
|
+
spec.add_development_dependency 'simplecov'
|
41
|
+
|
42
|
+
spec.add_development_dependency 'byebug'
|
43
|
+
spec.add_development_dependency 'pry'
|
44
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'change_healthcare/eligibility/version'
|
2
|
+
|
3
|
+
module ChangeHealthcare
|
4
|
+
##
|
5
|
+
# Namespace for eligibility-related data + functions
|
6
|
+
module Eligibility
|
7
|
+
class Error < StandardError; end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
require 'change_healthcare/eligibility/swagger_client'
|
12
|
+
require 'change_healthcare/eligibility/wrapper'
|
13
|
+
require 'change_healthcare/eligibility/inspector'
|
@@ -0,0 +1,82 @@
|
|
1
|
+
module ChangeHealthcare
|
2
|
+
module Eligibility
|
3
|
+
##
|
4
|
+
# Provides basic inspection capabilities for a benefits information response.
|
5
|
+
class Inspector
|
6
|
+
##
|
7
|
+
# Set up an inspector for a response.
|
8
|
+
#
|
9
|
+
# @param response [ChangeHealthcare::Eligibility::SwaggerClient::Response]
|
10
|
+
def initialize(response)
|
11
|
+
@response = response
|
12
|
+
end
|
13
|
+
|
14
|
+
##
|
15
|
+
# Does this document certify we have coverage for a service type matching the given matcher?
|
16
|
+
# `#===` on this matcher should take a string and return a boolean value.
|
17
|
+
#
|
18
|
+
# We use `#===` as there's a lot of service type codes, and you might want to use a `Proc`,
|
19
|
+
# a `Set`, or a `Regexp` to do your matching.
|
20
|
+
#
|
21
|
+
# @param matcher [#===] matcher to match against, using `#===`
|
22
|
+
# @return [true,false]
|
23
|
+
def active_coverage?(matcher)
|
24
|
+
active_coverage_information.any? do |coverage|
|
25
|
+
(coverage.service_types || []).any? { |type| matcher === type } # rubocop:disable Style/CaseEquality
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
##
|
30
|
+
# All benefits information records that describe a deductible.
|
31
|
+
#
|
32
|
+
# @return [Array<ChangeHealthcare::Eligibility::SwaggerClient::BenefitsInformation>]
|
33
|
+
def deductible_records
|
34
|
+
benefits_information.select do |bv|
|
35
|
+
bv.name == 'Deductible'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
##
|
40
|
+
# All BV records for co-insurance.
|
41
|
+
#
|
42
|
+
# @return [Array<ChangeHealthcare::Eligibility::SwaggerClient::BenefitsInformation>]
|
43
|
+
def coinsurance_records
|
44
|
+
benefits_information.select do |bv|
|
45
|
+
bv.name = 'Co-Insurance'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
##
|
50
|
+
# All BV records for co-payment.
|
51
|
+
#
|
52
|
+
# @return [Array<ChangeHealthcare::Eligibility::SwaggerClient::BenefitsInformation>]
|
53
|
+
def copayment_records
|
54
|
+
benefits_information.select do |bv|
|
55
|
+
bv.name = 'Co-Payment'
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
##
|
60
|
+
# Benefits Information for active coverage
|
61
|
+
#
|
62
|
+
# @return [Array<ChangeHealthcare::Eligibility::SwaggerClient::BenefitsInformation>]
|
63
|
+
def active_coverage_information
|
64
|
+
benefits_information.select do |bv|
|
65
|
+
bv.name == 'Active Coverage'
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
##
|
70
|
+
# A list of all benefits information.
|
71
|
+
#
|
72
|
+
# @return [Array<ChangeHealthcare::Eligibility::SwaggerClient::BenefitsInformation>]
|
73
|
+
def benefits_information
|
74
|
+
response.benefits_information || []
|
75
|
+
end
|
76
|
+
|
77
|
+
##
|
78
|
+
# @return [ChangeHealthcare::Eligibility::SwaggerClient::Response]
|
79
|
+
attr_reader :response
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|