change_health 5.4.2 → 5.5.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: af43602cc9e01d2d00aaf0c370af2b4181b73f6eb44a274dc2ca6f3a4f2db587
4
- data.tar.gz: 69c3b4623a0980c90c5f08bb32e5678db24828b2f2c88ba430d60b3556155c9e
3
+ metadata.gz: 68c9d3df25d6f47b5a970058fc6aef97b372a605a2be2a7f81569b665b6d69ba
4
+ data.tar.gz: 79b1857e502ab8e6fae635e230a5d22362c814b3aadb161d912d53d970cf00e4
5
5
  SHA512:
6
- metadata.gz: 3a016fd6bdeecfb3675b84a221e4be8833363852f3202251e0d52de44ff9e27f585a7c6ab9f407b184a2a733e3fa099f3d116f328dea58c48c2e552172686751
7
- data.tar.gz: 6ab2c8f756d52aee78c4cf1de226f51b25625f2375a9fa6b25423c91e022f9a54328f0053e9168cf453a795651e0b0a8e49aa0bfc6c179ef4251ed09dd7c1daf
6
+ metadata.gz: f5a37f908a5da6a9b1c2cb09bc19f94355c54b1eebea564faba52746f22c9fefce045d0f95b51a7aac932bdb6be0e953a7d945baa46f6ea66aa341fcb8a43a69
7
+ data.tar.gz: 60c0fbc7030dd5caee716952620e2b09c7b7d320a7249d26f3937ee22e75164b049ac3d9b99391b8a609ca6f325eba028ef96e6033c7dccb240e407f9547caed
data/CHANGELOG.md CHANGED
@@ -5,6 +5,14 @@ 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.5.0] - 2024-03-06
9
+
10
+ ### Added
11
+
12
+ * Added new configuration options for endpoint overrides and different authorization
13
+ * Now Ruby 3.x compatible
14
+ * Changed eligibilty to use new override option
15
+
8
16
  # [5.4.2] - 2023-10-31
9
17
 
10
18
  ### Added
@@ -599,6 +607,7 @@ Added the ability to hit professional claim submission API. For more details, se
599
607
  * Authentication
600
608
  * Configuration
601
609
 
610
+ [5.5.0]: https://github.com/WeInfuse/change_health/compare/v5.4.2...v5.5.0
602
611
  [5.4.2]: https://github.com/WeInfuse/change_health/compare/v5.4.1...v5.4.2
603
612
  [5.4.1]: https://github.com/WeInfuse/change_health/compare/v5.4.0...v5.4.1
604
613
  [5.4.0]: https://github.com/WeInfuse/change_health/compare/v5.3.1...v5.4.0
@@ -21,12 +21,22 @@ 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)
25
+ endpoint_options = ChangeHealth.configuration.endpoints || {}
26
+
27
+ endpoint_options[klass.to_s] || endpoint_options[klass.to_s.to_sym] || klass::ENDPOINT
28
+ end
29
+
24
30
  private
25
31
 
26
32
  def auth_header
27
- @auth ||= Authentication.new
33
+ if ChangeHealth.configuration.auth_headers.nil?
34
+ @auth ||= Authentication.new
28
35
 
29
- @auth.authenticate.access_header
36
+ @auth.authenticate.access_header
37
+ else
38
+ ChangeHealth.configuration.auth_headers
39
+ end
30
40
  end
31
41
  end
32
42
  end
@@ -25,7 +25,9 @@ module ChangeHealth
25
25
  end
26
26
 
27
27
  def query
28
- ChangeHealth::Response::EligibilityData.new(response: ChangeHealth::Connection.new.request(endpoint: ENDPOINT, body: self.to_h))
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
@@ -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
@@ -66,7 +66,7 @@ module ChangeHealth
66
66
  end
67
67
 
68
68
  def medicare?(**kwargs)
69
- false == benefits.empty? && benefits.where(kwargs).all? {|b| b.medicare? }
69
+ false == benefits.empty? && benefits.where(**kwargs).all? {|b| b.medicare? }
70
70
  end
71
71
 
72
72
  def plan?(name)
@@ -1,3 +1,3 @@
1
1
  module ChangeHealth
2
- VERSION = '5.4.2'.freeze
2
+ VERSION = '5.5.0'.freeze
3
3
  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.2
4
+ version: 5.5.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: 2023-10-31 00:00:00.000000000 Z
11
+ date: 2024-03-06 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: []