change_health 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +16 -0
- data/CODE_OF_CONDUCT.md +73 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +70 -0
- data/Rakefile +10 -0
- data/change_health.gemspec +39 -0
- data/lib/change_health.rb +71 -0
- data/lib/change_health/authentication.rb +67 -0
- data/lib/change_health/change_health_exception.rb +22 -0
- data/lib/change_health/connection.rb +26 -0
- data/lib/change_health/models/eligibility.rb +40 -0
- data/lib/change_health/models/encounter.rb +36 -0
- data/lib/change_health/models/provider.rb +21 -0
- data/lib/change_health/models/subscriber.rb +43 -0
- data/lib/change_health/version.rb +3 -0
- metadata +179 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2b348510765ffe956a8eae8f788dbb16990b0416f5f47e55b717d2984a2afcb0
|
4
|
+
data.tar.gz: ee398b26d964b244ef1e9143a04706a1f051bf0ec6e078e53c95ac8e53a64138
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f6f63cfb49ea618724ef45f90eaaaba412dd6bfaf1a77d54d7b427a2644ab455198e426c0c94ff8f430d9b5e562f235aa8ebfa6e7cae3e4ac7a64deea5859b00
|
7
|
+
data.tar.gz: d2595643664e9ae4a8382764146be954dfb371a5f2e34724cdfdb8704f746965535490af47813607b48cd639d8c41c79a313ab63ea7e1ab7d2f7f526901d3089
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# Changelog
|
2
|
+
All notable changes to this project will be documented in this file.
|
3
|
+
|
4
|
+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
5
|
+
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
6
|
+
|
7
|
+
## [0.1.0] - 2020-03-04
|
8
|
+
### Added
|
9
|
+
- Provider
|
10
|
+
- Subscriber
|
11
|
+
- Encounter
|
12
|
+
- Eligibility
|
13
|
+
- Authentication
|
14
|
+
- Configuration
|
15
|
+
|
16
|
+
[0.1.0]: https://github.com/WeInfuse/change_health/compare/v0.1.0
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
education, socio-economic status, nationality, personal appearance, race,
|
10
|
+
religion, or sexual identity and orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at [INSERT EMAIL ADDRESS]. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
72
|
+
|
73
|
+
[homepage]: https://www.contributor-covenant.org
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2020 WeInfuse, LLC
|
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 all
|
13
|
+
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 THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
[![CircleCI](https://circleci.com/gh/WeInfuse/change_health.svg?style=svg)](https://circleci.com/gh/WeInfuse/change_health)
|
2
|
+
|
3
|
+
# Change Health
|
4
|
+
Ruby API wrapper for [Change Health](https://developers.changehealthcare.com/api)
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'change_health'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install change_health
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
### Setup
|
25
|
+
|
26
|
+
Make sure you're [configured](#configuration)!
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
ChangeHealth::Models::Eligibility.ping # Test your connection
|
30
|
+
|
31
|
+
encounter = ChangeHealth::Models::Encounter.new(date_of_service: Date.current, service_type_codes: ['98'])
|
32
|
+
provider = ChangeHealth::Models::Provider.new(npi: '0123456789', last_name: 'Bobson', first_name: 'Bob')
|
33
|
+
subscriber = ChangeHealth::Models::Subscriber.new(member_id: '0000000000', first_name: 'johnOne', last_name: 'doeOne', date_of_birth: '18800102')
|
34
|
+
|
35
|
+
ChangeHealth::Models::Eligibility.new(tradingPartnerServiceId: '000050', provider: provider, subscriber: subscriber, encounter: encounter).query.parsed_response
|
36
|
+
```
|
37
|
+
|
38
|
+
### Response
|
39
|
+
|
40
|
+
Response is HTTParty Response object
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
response
|
44
|
+
#<HTTParty::Response:0x7fa354c1fbe8>
|
45
|
+
|
46
|
+
response.ok?
|
47
|
+
true
|
48
|
+
```
|
49
|
+
```
|
50
|
+
|
51
|
+
### Configuration
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
ChangeHealth.configure do |c|
|
55
|
+
c.client_id = ENV['CHANGE_HEALTH_CLIENT_ID']
|
56
|
+
c.client_secret = ENV['CHANGE_HEALTH_SECRET']
|
57
|
+
c.grant_type = 'bob' # Defaults to client_credentials
|
58
|
+
c.api_endpoint = 'http://hello.com' # Defaults to Change Health Sandbox endpoint
|
59
|
+
end
|
60
|
+
```
|
61
|
+
|
62
|
+
## Development
|
63
|
+
|
64
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
65
|
+
|
66
|
+
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).
|
67
|
+
|
68
|
+
## Contributing
|
69
|
+
|
70
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/WeInfuse/change\_health.
|
data/Rakefile
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'change_health/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'change_health'
|
7
|
+
spec.version = ChangeHealth::VERSION
|
8
|
+
spec.authors = ['Mike Crockett']
|
9
|
+
spec.email = ['mike.crockett@weinfuse.com']
|
10
|
+
|
11
|
+
spec.summary = 'Ruby wrapper for the ChangeHealth API'
|
12
|
+
spec.homepage = 'https://github.com/WeInfuse/change_health'
|
13
|
+
|
14
|
+
# Prevent pushing this gem to RubyGems.org.
|
15
|
+
if spec.respond_to?(:metadata)
|
16
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
17
|
+
else
|
18
|
+
raise 'RubyGems 2.0 or newer is required to protect against ' \
|
19
|
+
'public gem pushes.'
|
20
|
+
end
|
21
|
+
|
22
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
23
|
+
f.match?(%r{^(test|spec|features|bin|helpers|)/}) || f.match?(%r{^(\.[[:alnum:]]+)})
|
24
|
+
end
|
25
|
+
|
26
|
+
spec.bindir = 'exe'
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ['lib']
|
29
|
+
spec.licenses = ['MIT']
|
30
|
+
|
31
|
+
spec.add_dependency 'httparty', '~> 0.17'
|
32
|
+
spec.add_dependency 'hashie', '~> 3.5'
|
33
|
+
spec.add_development_dependency 'bundler', '>=1', '<3'
|
34
|
+
spec.add_development_dependency 'byebug', '~> 11'
|
35
|
+
spec.add_development_dependency 'minitest', '~> 5.0'
|
36
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
37
|
+
spec.add_development_dependency 'webmock', '~> 3.1'
|
38
|
+
spec.add_development_dependency 'yard', '~> 0.9'
|
39
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require 'hashie'
|
3
|
+
require 'change_health/version'
|
4
|
+
require 'change_health/change_health_exception'
|
5
|
+
require 'change_health/connection'
|
6
|
+
require 'change_health/authentication'
|
7
|
+
require 'change_health/models/eligibility'
|
8
|
+
require 'change_health/models/encounter'
|
9
|
+
require 'change_health/models/provider'
|
10
|
+
require 'change_health/models/subscriber'
|
11
|
+
|
12
|
+
module ChangeHealth
|
13
|
+
class Configuration
|
14
|
+
attr_accessor :client_id, :client_secret, :grant_type
|
15
|
+
|
16
|
+
def initialize
|
17
|
+
@client_id = nil
|
18
|
+
@client_secret = nil
|
19
|
+
@grant_type = :client_credentials
|
20
|
+
end
|
21
|
+
|
22
|
+
def api_endpoint=(endpoint)
|
23
|
+
Connection.base_uri(endpoint.freeze)
|
24
|
+
end
|
25
|
+
|
26
|
+
def api_endpoint
|
27
|
+
return Connection.base_uri
|
28
|
+
end
|
29
|
+
|
30
|
+
def to_h
|
31
|
+
return {
|
32
|
+
client_id: @client_id,
|
33
|
+
client_secret: @client_secret,
|
34
|
+
grant_type: @grant_type,
|
35
|
+
api_endpoint: api_endpoint
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
def from_h(h)
|
40
|
+
self.client_id = h[:client_id]
|
41
|
+
self.client_secret = h[:client_secret]
|
42
|
+
self.grant_type = h[:grant_type]
|
43
|
+
self.api_endpoint = h[:api_endpoint]
|
44
|
+
|
45
|
+
return self
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
class << self
|
50
|
+
def configuration
|
51
|
+
@configuration ||= Configuration.new
|
52
|
+
end
|
53
|
+
|
54
|
+
def configure
|
55
|
+
yield(configuration)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# ChangeHealth API client
|
60
|
+
class ChangeHealthClient
|
61
|
+
class << self
|
62
|
+
def connection
|
63
|
+
@connection ||= Connection.new
|
64
|
+
end
|
65
|
+
|
66
|
+
def release
|
67
|
+
@connection = nil
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
module ChangeHealth
|
2
|
+
class Authentication < Connection
|
3
|
+
attr_accessor :response
|
4
|
+
|
5
|
+
AUTH_ENDPOINT = '/apip/auth/v2/token'.freeze
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@response = nil
|
9
|
+
@request_time = nil
|
10
|
+
end
|
11
|
+
|
12
|
+
def authenticate
|
13
|
+
if (self.expires?)
|
14
|
+
request = {
|
15
|
+
body: { client_id: ChangeHealth.configuration.client_id, client_secret: ChangeHealth.configuration.client_secret, grant_type: ChangeHealth.configuration.grant_type },
|
16
|
+
endpoint: AUTH_ENDPOINT
|
17
|
+
}
|
18
|
+
|
19
|
+
response = self.request(**request, auth: false)
|
20
|
+
|
21
|
+
if (false == response.ok?)
|
22
|
+
@response = nil
|
23
|
+
raise ChangeHealthException.from_response(response, msg: 'Authentication')
|
24
|
+
else
|
25
|
+
@request_time = Time.now
|
26
|
+
@response = response
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
return self
|
31
|
+
end
|
32
|
+
|
33
|
+
def access_token
|
34
|
+
return @response['access_token'] if @response
|
35
|
+
end
|
36
|
+
|
37
|
+
def expires_in
|
38
|
+
return @response['expires_in'].to_i if @response
|
39
|
+
end
|
40
|
+
|
41
|
+
def token_type
|
42
|
+
return @response['token_type'] if @response
|
43
|
+
end
|
44
|
+
|
45
|
+
def expiry
|
46
|
+
@request_time + self.expires_in if @request_time && self.expires_in
|
47
|
+
end
|
48
|
+
|
49
|
+
def expires?(seconds_from_now = 60)
|
50
|
+
if (self.expiry)
|
51
|
+
return self.expiry.utc <= (Time.now + seconds_from_now).utc
|
52
|
+
else
|
53
|
+
return true
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def access_header
|
58
|
+
return {
|
59
|
+
'Authorization' => "Bearer #{self.access_token}",
|
60
|
+
}
|
61
|
+
end
|
62
|
+
|
63
|
+
def expire!
|
64
|
+
@response = nil
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module ChangeHealth
|
2
|
+
class ChangeHealthException < Exception
|
3
|
+
def self.from_response(response, msg: nil)
|
4
|
+
exception_msg = "Failed #{msg}:"
|
5
|
+
exception_msg << " HTTP code: #{response.code} MSG: "
|
6
|
+
|
7
|
+
begin
|
8
|
+
error_response = response.parsed_response
|
9
|
+
|
10
|
+
if (error_response.is_a?(Hash) && error_response.include?("error_description"))
|
11
|
+
exception_msg << error_response["error_description"]
|
12
|
+
else
|
13
|
+
exception_msg << error_response
|
14
|
+
end
|
15
|
+
rescue JSON::ParserError
|
16
|
+
exception_msg << response.body
|
17
|
+
end
|
18
|
+
|
19
|
+
return ChangeHealthException.new(exception_msg)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module ChangeHealth
|
2
|
+
class Connection
|
3
|
+
include HTTParty
|
4
|
+
|
5
|
+
base_uri 'https://sandbox.apis.changehealthcare.com/'.freeze
|
6
|
+
|
7
|
+
headers 'Content-Type' => 'application/json;charset=UTF-8'
|
8
|
+
|
9
|
+
format :json
|
10
|
+
|
11
|
+
def request(endpoint: , body: nil, headers: {}, auth: true, verb: :post)
|
12
|
+
body = body.to_json if body.is_a?(Hash)
|
13
|
+
headers = auth_header.merge(headers) if auth
|
14
|
+
|
15
|
+
self.class.send("#{verb}", endpoint, body: body, headers: headers)
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def auth_header
|
21
|
+
@auth ||= Authentication.new
|
22
|
+
|
23
|
+
return @auth.authenticate.access_header
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module ChangeHealth
|
2
|
+
module Models
|
3
|
+
class Eligibility < Hashie::Trash
|
4
|
+
ENDPOINT = '/medicalnetwork/eligibility/v3'.freeze
|
5
|
+
HEALTH_CHECK_ENDPOINT = ENDPOINT + '/healthcheck'.freeze
|
6
|
+
|
7
|
+
property :controlNumber, from: :control_number, required: true, default: ->() { '%09d' % rand(1_000_000_000) }
|
8
|
+
property :dependents, required: false
|
9
|
+
property :encounter, required: false
|
10
|
+
property :informationReceiverName, from: :information_receiver_name, required: false
|
11
|
+
property :partnerId, from: :partner_id, default: true
|
12
|
+
property :portalPassword, from: :portal_password, required: false
|
13
|
+
property :portalUsername, from: :portal_username, required: false
|
14
|
+
property :provider, required: false
|
15
|
+
property :subscriber, required: false
|
16
|
+
property :tradingPartnerId, from: :trading_partner_id, required: false
|
17
|
+
property :tradingPartnerServiceId, from: :trading_partner_service_id, required: false
|
18
|
+
|
19
|
+
alias_method :partnerId?, :partnerId
|
20
|
+
alias_method :partner_id?, :partnerId
|
21
|
+
|
22
|
+
def add_dependent(dependent)
|
23
|
+
self[:dependent] ||= []
|
24
|
+
self[:dependent] << dependent
|
25
|
+
end
|
26
|
+
|
27
|
+
def query
|
28
|
+
ChangeHealth::Connection.new.request(endpoint: ENDPOINT, body: self.to_h)
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.health_check
|
32
|
+
ChangeHealth::Connection.new.request(endpoint: HEALTH_CHECK_ENDPOINT, verb: :get)
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.ping
|
36
|
+
self.health_check
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module ChangeHealth
|
2
|
+
module Models
|
3
|
+
DATE_FORMAT = '%Y%m%d'
|
4
|
+
|
5
|
+
class Encounter < Hashie::Trash
|
6
|
+
property :beginningDateOfService, from: :beginning_date_of_service, required: false
|
7
|
+
property :dateOfService, from: :date_of_service, required: false
|
8
|
+
property :dateRange, from: :date_range, required: false, default: false
|
9
|
+
property :endDateOfService, from: :end_date_of_service, required: false
|
10
|
+
property :serviceTypeCodes, from: :service_type_codes, required: false
|
11
|
+
|
12
|
+
alias_method :dateRange?, :dateRange
|
13
|
+
alias_method :date_range?, :dateRange
|
14
|
+
alias_method :service_type_codes, :serviceTypeCodes
|
15
|
+
|
16
|
+
def add_service_type_code(code)
|
17
|
+
self[:serviceTypeCodes] ||= []
|
18
|
+
self[:serviceTypeCodes] << code
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_h
|
22
|
+
result = super.to_h
|
23
|
+
|
24
|
+
[:beginningDateOfService, :dateOfService, :endDateOfService].each do |key|
|
25
|
+
result[key] = result[key].strftime(ChangeHealth::Models::DATE_FORMAT) if result[key].respond_to?(:strftime)
|
26
|
+
end
|
27
|
+
|
28
|
+
result
|
29
|
+
end
|
30
|
+
|
31
|
+
def as_json(args = {})
|
32
|
+
self.to_h
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module ChangeHealth
|
2
|
+
module Models
|
3
|
+
class Provider < Hashie::Trash
|
4
|
+
property :firstName, from: :first_name, required: false
|
5
|
+
property :lastName, from: :last_name, required: false
|
6
|
+
property :name, default: true, required: false
|
7
|
+
property :npi, required: false
|
8
|
+
property :organizationName, from: :organization_name, required: false
|
9
|
+
property :payorId, from: :payer_id, required: false
|
10
|
+
property :person, default: true, required: false
|
11
|
+
property :providerCode, from: :provider_code, required: false
|
12
|
+
property :providerName, from: :provider_name, required: false
|
13
|
+
property :providerType, from: :provider_type, required: false
|
14
|
+
property :referenceIdentification, from: :reference_identification, required: false
|
15
|
+
property :serviceProviderNumber, from: :service_provider_number, required: false
|
16
|
+
property :taxId, from: :tax_id, required: false
|
17
|
+
|
18
|
+
alias_method :name?, :name
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module ChangeHealth
|
2
|
+
module Models
|
3
|
+
class Subscriber < Hashie::Trash
|
4
|
+
property :additionalIdentification, required: false
|
5
|
+
property :address, required: false
|
6
|
+
property :birthSequenceNumber, from: :birth_sequence_number, required: false
|
7
|
+
property :caseNumber, from: :case_number, required: false
|
8
|
+
property :dateOfBirth, from: :date_of_birth, required: false
|
9
|
+
property :firstName, from: :first_name, required: false
|
10
|
+
property :gender, required: false
|
11
|
+
property :groupNumber, from: :group_number, required: false
|
12
|
+
property :healthCareCodeInformation, from: :health_care_code_information, required: false
|
13
|
+
property :idCard, from: :id_card, required: false
|
14
|
+
property :idCardIssueDate, from: :id_card_issued_date, required: false
|
15
|
+
property :lastName, from: :last_name, required: false
|
16
|
+
property :medicaidRecipientIdentificationNumber, from: :medicaid_recipient_identification_number, required: false
|
17
|
+
property :memberId, from: :member_id, required: false
|
18
|
+
property :providerCode, from: :provider_code, required: false
|
19
|
+
property :providerIdentifier, from: :provider_identification, required: false
|
20
|
+
property :referenceIdentificationQualifier, from: :reference_identification_qualifier, required: false
|
21
|
+
property :ssn, required: false
|
22
|
+
|
23
|
+
def add_health_care_code_information(value)
|
24
|
+
self[:healthCareCodeInformation] ||= []
|
25
|
+
self[:healthCareCodeInformation] << value
|
26
|
+
end
|
27
|
+
|
28
|
+
def to_h
|
29
|
+
result = super.to_h
|
30
|
+
|
31
|
+
[:dateOfBirth].each do |key|
|
32
|
+
result[key] = result[key].strftime(ChangeHealth::Models::DATE_FORMAT) if result[key].respond_to?(:strftime)
|
33
|
+
end
|
34
|
+
|
35
|
+
result
|
36
|
+
end
|
37
|
+
|
38
|
+
def as_json(args = {})
|
39
|
+
self.to_h
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
metadata
ADDED
@@ -0,0 +1,179 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: change_health
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mike Crockett
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-03-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: httparty
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.17'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.17'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: hashie
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.5'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.5'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1'
|
48
|
+
- - "<"
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '3'
|
51
|
+
type: :development
|
52
|
+
prerelease: false
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '1'
|
58
|
+
- - "<"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '3'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: byebug
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '11'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '11'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: minitest
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '5.0'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '5.0'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: rake
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '13.0'
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '13.0'
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: webmock
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '3.1'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - "~>"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '3.1'
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: yard
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - "~>"
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0.9'
|
124
|
+
type: :development
|
125
|
+
prerelease: false
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - "~>"
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0.9'
|
131
|
+
description:
|
132
|
+
email:
|
133
|
+
- mike.crockett@weinfuse.com
|
134
|
+
executables: []
|
135
|
+
extensions: []
|
136
|
+
extra_rdoc_files: []
|
137
|
+
files:
|
138
|
+
- CHANGELOG.md
|
139
|
+
- CODE_OF_CONDUCT.md
|
140
|
+
- Gemfile
|
141
|
+
- LICENSE
|
142
|
+
- README.md
|
143
|
+
- Rakefile
|
144
|
+
- change_health.gemspec
|
145
|
+
- lib/change_health.rb
|
146
|
+
- lib/change_health/authentication.rb
|
147
|
+
- lib/change_health/change_health_exception.rb
|
148
|
+
- lib/change_health/connection.rb
|
149
|
+
- lib/change_health/models/eligibility.rb
|
150
|
+
- lib/change_health/models/encounter.rb
|
151
|
+
- lib/change_health/models/provider.rb
|
152
|
+
- lib/change_health/models/subscriber.rb
|
153
|
+
- lib/change_health/version.rb
|
154
|
+
homepage: https://github.com/WeInfuse/change_health
|
155
|
+
licenses:
|
156
|
+
- MIT
|
157
|
+
metadata:
|
158
|
+
allowed_push_host: https://rubygems.org
|
159
|
+
post_install_message:
|
160
|
+
rdoc_options: []
|
161
|
+
require_paths:
|
162
|
+
- lib
|
163
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
164
|
+
requirements:
|
165
|
+
- - ">="
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: '0'
|
168
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
169
|
+
requirements:
|
170
|
+
- - ">="
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: '0'
|
173
|
+
requirements: []
|
174
|
+
rubyforge_project:
|
175
|
+
rubygems_version: 2.7.6
|
176
|
+
signing_key:
|
177
|
+
specification_version: 4
|
178
|
+
summary: Ruby wrapper for the ChangeHealth API
|
179
|
+
test_files: []
|