change_health 5.13.3 → 5.14.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7702b4860062f9d920c9b92404599c3284b6ccb8bcb8253dc796f565091286b4
4
- data.tar.gz: af12858fe1a4a3926a8eba27ddbaaabdf398e7de4f046f4430cd2c289740604a
3
+ metadata.gz: 48a9d4f78c8b44747e2f593a4cb24fa6050d586fe991c4fda19097e232d493ae
4
+ data.tar.gz: bc14ef980d21d8f86e883fb1089b8751225c90770ac6b893b11a64ca9342be79
5
5
  SHA512:
6
- metadata.gz: 86dd0e8891c4d9f5a2cf0eaefc2f313879813b8d5cdd8e5eff38c72622f378ab0e82ada56f372735c4ad849f0f6598b1546e0c09f7be4b3edc96228d3dcb00ba
7
- data.tar.gz: bd7c909af6015ee49ea629948e97a3c1c8911061a102bc731f278180fa62996a76e1f1312fa812d757decae855e2147fce6074b451de093df1479fee840e9d47
6
+ metadata.gz: 3b1b7588b4d23e366e4e53ce1deefea29ee56f03216768e9af36130342f1abedef3ed086960487181c34a39e4e481b7ac3594a3ce45920ca2c3f5327f7be4a9c
7
+ data.tar.gz: fdf31926f445379f99b9a8645b7be6f5529f8a38c3936a044264330572f1bd7a3ac818d216de3da418abd9e23dce60ff17de5534949925cad7ac95415dd1304c
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.14.0] - 2024-06-11
9
+
10
+ ### Added
11
+
12
+ * The following report methods can override the base URI, endpoint, and authentication headers per request if needed:
13
+ - `ChangeHealth::Request::Claim::Report.report_list`
14
+ - `ChangeHealth::Request::Claim::Report.get_report`
15
+ - `ChangeHealth::Request::Claim::Report.delete_report`
16
+
17
+ Provide the following parameters to override the defaults set in Configuration:
18
+ - `base_uri`
19
+ - `endpoint`
20
+ - `auth_headers` - an empty hash can also be provided (`{}`), which will issue a request to the authentication endpoint instead of using the configured headers.
21
+
8
22
  # [5.13.3] - 2024-05-20
9
23
 
10
24
  ### Fixed
@@ -692,6 +706,7 @@ Added the ability to hit professional claim submission API. For more details, se
692
706
  * Authentication
693
707
  * Configuration
694
708
 
709
+ [5.14.0]: https://github.com/WeInfuse/change_health/compare/v5.13.3...v5.14.0
695
710
  [5.13.3]: https://github.com/WeInfuse/change_health/compare/v5.13.2...v5.13.3
696
711
  [5.13.2]: https://github.com/WeInfuse/change_health/compare/v5.13.1...v5.13.2
697
712
  [5.13.1]: https://github.com/WeInfuse/change_health/compare/v5.13.0...v5.13.1
@@ -9,14 +9,15 @@ module ChangeHealth
9
9
  @request_time = nil
10
10
  end
11
11
 
12
- def authenticate
12
+ def authenticate(base_uri: nil)
13
13
  if (self.expires?)
14
+ base_uri ||= Connection.base_uri
14
15
  request = {
15
16
  body: { client_id: ChangeHealth.configuration.client_id, client_secret: ChangeHealth.configuration.client_secret, grant_type: ChangeHealth.configuration.grant_type },
16
17
  endpoint: AUTH_ENDPOINT
17
18
  }
18
19
 
19
- response = Connection.new.request(**request, auth: false)
20
+ response = Connection.new.request(**request, auth: false, base_uri: base_uri)
20
21
 
21
22
  if (false == response.ok?)
22
23
  @response = nil
@@ -13,12 +13,22 @@ module ChangeHealth
13
13
 
14
14
  format :json
15
15
 
16
- def request(endpoint:, query: nil, body: nil, headers: {}, auth: true, verb: :post)
16
+ def request(
17
+ endpoint:,
18
+ query: nil,
19
+ body: nil,
20
+ headers: {},
21
+ auth: true,
22
+ verb: :post,
23
+ base_uri: nil,
24
+ auth_headers: nil
25
+ )
26
+ base_uri ||= Connection.base_uri
17
27
  body = body.to_json if body.is_a?(Hash)
18
28
  headers = {} if headers.nil?
19
- headers = auth_header.merge(headers) if auth
29
+ headers = auth_header(base_uri: base_uri, auth_headers: auth_headers).merge(headers) if auth
20
30
 
21
- self.class.send(verb.to_s, endpoint, query: query, body: body, headers: headers)
31
+ self.class.send(verb.to_s, endpoint, query: query, body: body, headers: headers, base_uri: base_uri)
22
32
  end
23
33
 
24
34
  def self.endpoint_for(klass, default_endpoint: nil)
@@ -30,13 +40,15 @@ module ChangeHealth
30
40
 
31
41
  private
32
42
 
33
- def auth_header
34
- if ChangeHealth.configuration.auth_headers.nil?
43
+ def auth_header(base_uri: nil, auth_headers: nil)
44
+ auth_headers ||= ChangeHealth.configuration.auth_headers
45
+
46
+ if auth_headers.nil? || auth_headers.empty?
35
47
  @auth ||= Authentication.new
36
48
 
37
- @auth.authenticate.access_header
49
+ @auth.authenticate(base_uri: base_uri).access_header
38
50
  else
39
- ChangeHealth.configuration.auth_headers
51
+ auth_headers
40
52
  end
41
53
  end
42
54
  end
@@ -5,11 +5,16 @@ module ChangeHealth
5
5
  ENDPOINT = '/medicalnetwork/reports/v2'.freeze
6
6
  HEALTH_CHECK_ENDPOINT = ENDPOINT + '/healthcheck'.freeze
7
7
 
8
- def self.report_list(headers: nil, more_url: nil)
9
- endpoint = ChangeHealth::Connection.endpoint_for(self) + more_url.to_s
8
+ def self.report_list(headers: nil, more_url: nil, base_uri: nil, endpoint: nil, auth_headers: nil)
9
+ endpoint ||= ChangeHealth::Connection.endpoint_for(self)
10
+ endpoint += more_url.to_s
10
11
  final_headers = ChangeHealth::Request::Claim::Report.report_headers(headers)
11
12
  ChangeHealth::Response::Claim::ReportListData.new(response: ChangeHealth::Connection.new.request(
12
- endpoint: endpoint, verb: :get, headers: final_headers
13
+ endpoint: endpoint,
14
+ verb: :get,
15
+ headers: final_headers,
16
+ base_uri: base_uri,
17
+ auth_headers: auth_headers
13
18
  ))
14
19
  end
15
20
 
@@ -17,13 +22,16 @@ module ChangeHealth
17
22
  report_name,
18
23
  as_json_report: true,
19
24
  headers: nil,
20
- report_type: nil
25
+ report_type: nil,
26
+ base_uri: nil,
27
+ endpoint: nil,
28
+ auth_headers: nil
21
29
  )
22
30
  return if report_name.nil? || report_name.empty?
23
31
 
24
32
  final_headers = ChangeHealth::Request::Claim::Report.report_headers(headers)
25
33
 
26
- endpoint = ChangeHealth::Connection.endpoint_for(self)
34
+ endpoint ||= ChangeHealth::Connection.endpoint_for(self)
27
35
 
28
36
  individual_report_endpoint = "#{endpoint}/#{report_name}"
29
37
 
@@ -38,7 +46,9 @@ module ChangeHealth
38
46
  response = ChangeHealth::Connection.new.request(
39
47
  endpoint: individual_report_endpoint,
40
48
  verb: :get,
41
- headers: final_headers
49
+ headers: final_headers,
50
+ base_uri: base_uri,
51
+ auth_headers: auth_headers
42
52
  )
43
53
  if ChangeHealth::Response::Claim::ReportData.is_277?(report_name)
44
54
  ChangeHealth::Response::Claim::Report277Data
@@ -58,18 +68,20 @@ module ChangeHealth
58
68
  end
59
69
  end
60
70
 
61
- def self.delete_report(report_name, headers: nil)
71
+ def self.delete_report(report_name, headers: nil, base_uri: nil, endpoint: nil, auth_headers: nil)
62
72
  return if report_name.nil? || report_name.empty?
63
73
 
64
74
  final_headers = ChangeHealth::Request::Claim::Report.report_headers(headers)
65
75
 
66
- endpoint = ChangeHealth::Connection.endpoint_for(self)
76
+ endpoint ||= ChangeHealth::Connection.endpoint_for(self)
67
77
  individual_report_endpoint = "#{endpoint}/#{report_name}"
68
78
 
69
79
  ChangeHealth::Connection.new.request(
70
80
  endpoint: individual_report_endpoint,
71
81
  verb: :delete,
72
- headers: final_headers
82
+ headers: final_headers,
83
+ base_uri: base_uri,
84
+ auth_headers: auth_headers
73
85
  )
74
86
  end
75
87
 
@@ -1,3 +1,3 @@
1
1
  module ChangeHealth
2
- VERSION = '5.13.3'.freeze
2
+ VERSION = '5.14.0'.freeze
3
3
  end
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.13.3
4
+ version: 5.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Crockett
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-05-20 00:00:00.000000000 Z
11
+ date: 2024-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -128,7 +128,7 @@ dependencies:
128
128
  - - "~>"
129
129
  - !ruby/object:Gem::Version
130
130
  version: '0.9'
131
- description:
131
+ description:
132
132
  email:
133
133
  - mike.crockett@weinfuse.com
134
134
  executables: []
@@ -206,7 +206,7 @@ licenses:
206
206
  - MIT
207
207
  metadata:
208
208
  allowed_push_host: https://rubygems.org
209
- post_install_message:
209
+ post_install_message:
210
210
  rdoc_options: []
211
211
  require_paths:
212
212
  - lib
@@ -222,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
222
  version: '0'
223
223
  requirements: []
224
224
  rubygems_version: 3.1.6
225
- signing_key:
225
+ signing_key:
226
226
  specification_version: 4
227
227
  summary: Ruby wrapper for the ChangeHealth API
228
228
  test_files: []