change_health 5.4.2 → 5.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/lib/change_health/connection.rb +13 -2
- data/lib/change_health/request/eligibility.rb +3 -1
- data/lib/change_health/request/submission.rb +25 -9
- data/lib/change_health/response/eligibility/eligibility_benefits.rb +6 -6
- data/lib/change_health/response/eligibility/eligibility_data.rb +1 -1
- data/lib/change_health/version.rb +1 -1
- data/lib/change_health.rb +7 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8495cb12f20da060485853dced1cd55349f12f832d2248fac2df969cb010bdac
|
4
|
+
data.tar.gz: 146f312abc8a2e1aa29ba48aec980201c100b6675ddeb3552a8a9b0f7428c5ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59fea4e29a8a61b08fd30ddaba4e507b0e7aa0f4caaeb99aa50445121e5f8e408ea71dd91074800a5277dba545d3a1bb48040e2ef690f7d8c663f63b516893ba
|
7
|
+
data.tar.gz: 97eced181397c5c9629028a077c068e7e4aed773d919488eb6979d6e19ea5caf707ba290b785cfa2a56985f0eefa3e79f163b9ec1bbaaf2809ab8222008a862f
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
6
6
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
|
+
# [5.6.0] - 2024-03-06
|
9
|
+
|
10
|
+
### Added
|
11
|
+
|
12
|
+
* Changed claim submission to use new endpoint override option
|
13
|
+
|
14
|
+
# [5.5.0] - 2024-03-06
|
15
|
+
|
16
|
+
### Added
|
17
|
+
|
18
|
+
* Added new configuration options for endpoint overrides and different authorization
|
19
|
+
* Now Ruby 3.x compatible
|
20
|
+
* Changed eligibilty to use new override option
|
21
|
+
|
8
22
|
# [5.4.2] - 2023-10-31
|
9
23
|
|
10
24
|
### Added
|
@@ -599,6 +613,8 @@ Added the ability to hit professional claim submission API. For more details, se
|
|
599
613
|
* Authentication
|
600
614
|
* Configuration
|
601
615
|
|
616
|
+
[5.6.0]: https://github.com/WeInfuse/change_health/compare/v5.5.0...v5.6.0
|
617
|
+
[5.5.0]: https://github.com/WeInfuse/change_health/compare/v5.4.2...v5.5.0
|
602
618
|
[5.4.2]: https://github.com/WeInfuse/change_health/compare/v5.4.1...v5.4.2
|
603
619
|
[5.4.1]: https://github.com/WeInfuse/change_health/compare/v5.4.0...v5.4.1
|
604
620
|
[5.4.0]: https://github.com/WeInfuse/change_health/compare/v5.3.1...v5.4.0
|
@@ -21,12 +21,23 @@ module ChangeHealth
|
|
21
21
|
self.class.send(verb.to_s, endpoint, query: query, body: body, headers: headers)
|
22
22
|
end
|
23
23
|
|
24
|
+
def self.endpoint_for(klass, default_endpoint: nil)
|
25
|
+
endpoint_options = ChangeHealth.configuration.endpoints || {}
|
26
|
+
default_endpoint ||= klass::ENDPOINT
|
27
|
+
|
28
|
+
endpoint_options[klass.to_s] || endpoint_options[klass.to_s.to_sym] || default_endpoint
|
29
|
+
end
|
30
|
+
|
24
31
|
private
|
25
32
|
|
26
33
|
def auth_header
|
27
|
-
|
34
|
+
if ChangeHealth.configuration.auth_headers.nil?
|
35
|
+
@auth ||= Authentication.new
|
28
36
|
|
29
|
-
|
37
|
+
@auth.authenticate.access_header
|
38
|
+
else
|
39
|
+
ChangeHealth.configuration.auth_headers
|
40
|
+
end
|
30
41
|
end
|
31
42
|
end
|
32
43
|
end
|
@@ -25,7 +25,9 @@ module ChangeHealth
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def query
|
28
|
-
|
28
|
+
endpoint = ChangeHealth::Connection.endpoint_for(self.class)
|
29
|
+
|
30
|
+
ChangeHealth::Response::EligibilityData.new(response: ChangeHealth::Connection.new.request(endpoint: endpoint, body: self.to_h))
|
29
31
|
end
|
30
32
|
|
31
33
|
def self.health_check
|
@@ -36,11 +36,12 @@ module ChangeHealth
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def submission(is_professional: true)
|
39
|
-
endpoint = is_professional ? PROFESSIONAL_ENDPOINT : INSTITUTIONAL_ENDPOINT
|
40
|
-
endpoint += SUBMISSION_SUFFIX
|
41
39
|
ChangeHealth::Response::Claim::SubmissionData.new(
|
42
40
|
response: ChangeHealth::Connection.new.request(
|
43
|
-
endpoint: endpoint
|
41
|
+
endpoint: self.class.endpoint(
|
42
|
+
is_professional: is_professional,
|
43
|
+
suffix: SUBMISSION_SUFFIX
|
44
|
+
),
|
44
45
|
body: to_h,
|
45
46
|
headers: is_professional ? professional_headers : institutional_headers
|
46
47
|
)
|
@@ -48,11 +49,12 @@ module ChangeHealth
|
|
48
49
|
end
|
49
50
|
|
50
51
|
def validation(is_professional: true)
|
51
|
-
endpoint = is_professional ? PROFESSIONAL_ENDPOINT : INSTITUTIONAL_ENDPOINT
|
52
|
-
endpoint += VALIDATION_SUFFIX
|
53
52
|
ChangeHealth::Response::Claim::SubmissionData.new(
|
54
53
|
response: ChangeHealth::Connection.new.request(
|
55
|
-
endpoint: endpoint
|
54
|
+
endpoint: self.class.endpoint(
|
55
|
+
is_professional: is_professional,
|
56
|
+
suffix: VALIDATION_SUFFIX
|
57
|
+
),
|
56
58
|
body: to_h,
|
57
59
|
headers: is_professional ? professional_headers : institutional_headers
|
58
60
|
)
|
@@ -60,15 +62,29 @@ module ChangeHealth
|
|
60
62
|
end
|
61
63
|
|
62
64
|
def self.health_check(is_professional: true)
|
63
|
-
|
64
|
-
|
65
|
-
|
65
|
+
ChangeHealth::Connection.new.request(
|
66
|
+
endpoint: endpoint(
|
67
|
+
is_professional: is_professional,
|
68
|
+
suffix: HEALTH_CHECK_SUFFIX
|
69
|
+
),
|
70
|
+
verb: :get
|
71
|
+
)
|
66
72
|
end
|
67
73
|
|
68
74
|
def self.ping(is_professional: true)
|
69
75
|
health_check(is_professional: is_professional)
|
70
76
|
end
|
71
77
|
|
78
|
+
def self.endpoint(is_professional: true, suffix: '')
|
79
|
+
default_endpoint = is_professional ? PROFESSIONAL_ENDPOINT : INSTITUTIONAL_ENDPOINT
|
80
|
+
default_endpoint += suffix
|
81
|
+
|
82
|
+
ChangeHealth::Connection.endpoint_for(
|
83
|
+
ChangeHealth::Request::Claim::Submission,
|
84
|
+
default_endpoint: default_endpoint
|
85
|
+
)
|
86
|
+
end
|
87
|
+
|
72
88
|
def professional_headers
|
73
89
|
return unless self[:headers]
|
74
90
|
|
@@ -42,12 +42,12 @@ module ChangeHealth
|
|
42
42
|
method_name = "#{method}_#{type_mod}"
|
43
43
|
|
44
44
|
define_method(method_name) do |**kwargs|
|
45
|
-
self.send(method).send("#{type_mod}s").where(kwargs).first
|
45
|
+
self.send(method).send("#{type_mod}s").where(**kwargs).first
|
46
46
|
end
|
47
47
|
|
48
48
|
if ('copayment' == type_mod)
|
49
49
|
define_method(method_name.gsub('copayment', 'copay')) do |**kwargs|
|
50
|
-
self.send(method_name, kwargs)
|
50
|
+
self.send(method_name, **kwargs)
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
@@ -57,24 +57,24 @@ module ChangeHealth
|
|
57
57
|
method_name = "#{method}_#{type_mod}_#{time_mod}"
|
58
58
|
|
59
59
|
define_method(method_name) do |**kwargs|
|
60
|
-
self.send(method).send("#{type_mod}s").send("#{time_mod}s").where(kwargs).first || self.send(method).send("#{type_mod}s").where(kwargs).first
|
60
|
+
self.send(method).send("#{type_mod}s").send("#{time_mod}s").where(**kwargs).first || self.send(method).send("#{type_mod}s").where(**kwargs).first
|
61
61
|
end
|
62
62
|
|
63
63
|
if ('out_of_pocket' == type_mod)
|
64
64
|
define_method(method_name.gsub('out_of_pocket', 'oop')) do |**kwargs|
|
65
|
-
self.send(method_name, kwargs)
|
65
|
+
self.send(method_name, **kwargs)
|
66
66
|
end
|
67
67
|
|
68
68
|
if ('year' == time_mod)
|
69
69
|
define_method(method_name.gsub('out_of_pocket', 'oop').gsub('year', 'total')) do |**kwargs|
|
70
|
-
self.send(method_name, kwargs)
|
70
|
+
self.send(method_name, **kwargs)
|
71
71
|
end
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
75
|
if ('year' == time_mod)
|
76
76
|
define_method(method_name.gsub('year', 'total')) do |**kwargs|
|
77
|
-
self.send(method_name, kwargs)
|
77
|
+
self.send(method_name, **kwargs)
|
78
78
|
end
|
79
79
|
end
|
80
80
|
end
|
data/lib/change_health.rb
CHANGED
@@ -61,11 +61,13 @@ require 'change_health/response/trading_partner/trading_partners_data'
|
|
61
61
|
|
62
62
|
module ChangeHealth
|
63
63
|
class Configuration
|
64
|
-
attr_accessor :client_id, :client_secret, :grant_type
|
64
|
+
attr_accessor :client_id, :client_secret, :grant_type, :auth_headers, :endpoints
|
65
65
|
|
66
66
|
def initialize
|
67
|
+
@auth_headers = nil
|
67
68
|
@client_id = nil
|
68
69
|
@client_secret = nil
|
70
|
+
@endpoints = nil
|
69
71
|
@grant_type = :client_credentials
|
70
72
|
end
|
71
73
|
|
@@ -79,16 +81,20 @@ module ChangeHealth
|
|
79
81
|
|
80
82
|
def to_h
|
81
83
|
{
|
84
|
+
auth_headers: @auth_headers,
|
82
85
|
client_id: @client_id,
|
83
86
|
client_secret: @client_secret,
|
87
|
+
endpoints: @endpoints,
|
84
88
|
grant_type: @grant_type,
|
85
89
|
api_endpoint: api_endpoint
|
86
90
|
}
|
87
91
|
end
|
88
92
|
|
89
93
|
def from_h(h)
|
94
|
+
self.auth_headers = h[:auth_headers]
|
90
95
|
self.client_id = h[:client_id]
|
91
96
|
self.client_secret = h[:client_secret]
|
97
|
+
self.endpoints = h[:endpoints]
|
92
98
|
self.grant_type = h[:grant_type]
|
93
99
|
self.api_endpoint = h[:api_endpoint]
|
94
100
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: change_health
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Crockett
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|