trizetto-api 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 60c7ed11ee2e04e48734c1e3b557c9e904d2e268
4
- data.tar.gz: 3b35cbee1b0e2ffb45ae3e9533ec546983f4d130
3
+ metadata.gz: b3d7816b2c859d5c94ed3433e86421c54a8c2fca
4
+ data.tar.gz: 1d932011c08b984fc4fc260cdf57165aedfc29df
5
5
  SHA512:
6
- metadata.gz: 2471cf69c92ddac9b6b47d0d41c7dd8e020f7374418b9c08e2034907f783071ed052e45829c7fa3989c4ab5b6b32c1ea476d170de250868c2a7c995e602c4c91
7
- data.tar.gz: 4888af1330a52c70b84535c44ae4c912866482109b5e853858390d1d156bf8236bcfd1ef3b4bc27ab5912a74d0c215daee47cd1ff644c8db253d3f24032f5df8
6
+ metadata.gz: d5ef664108b8e07fbe0e343a4cb840bf651f27706f15e528c70b1ce60077b65bacada2d2410c9ba49f1ae3366566a918f7d7d07291b1a33d740089e5c66dd288
7
+ data.tar.gz: db5f856514b0c8e4e850ba31e6b4fc5bf81ca4c97b778bedb7605f73a7c277defe46849a02d071fc70521ff952a0047841b4ff5031e79f9450ebce975720ee8e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## 0.2.2 (January 19, 2018) ##
2
+
3
+ * The response from the DoInquiry eligiblity check now captures the raw XML and
4
+ can be recreated from stored XML.
5
+ * Traces are available as part of the DoInquiry eligibility response. Trizetto
6
+ adds a trace_id ("99Trizetto") and a trace_number to each request that can be
7
+ provided to them later as part of a support request. The payer may also add
8
+ a trace which is available also.
9
+
1
10
  ## 0.2.1 (January 18, 2018) ##
2
11
 
3
12
  * Sets required minimum version for ruby to 2.3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- trizetto-api (0.2.0)
4
+ trizetto-api (0.2.1)
5
5
  savon (~> 2.0)
6
6
  savon-multipart (~> 2.0)
7
7
 
@@ -43,12 +43,12 @@ GEM
43
43
  diff-lcs (>= 1.2.0, < 2.0)
44
44
  rspec-support (~> 3.7.0)
45
45
  rspec-support (3.7.0)
46
- savon (2.11.2)
46
+ savon (2.12.0)
47
47
  akami (~> 1.2)
48
48
  builder (>= 2.1.2)
49
49
  gyoku (~> 1.2)
50
50
  httpi (~> 2.3)
51
- nokogiri (>= 1.4.0)
51
+ nokogiri (>= 1.8.1)
52
52
  nori (~> 2.4)
53
53
  wasabi (~> 3.4)
54
54
  savon-multipart (2.1.1)
@@ -67,7 +67,7 @@ PLATFORMS
67
67
 
68
68
  DEPENDENCIES
69
69
  bundler (~> 1.16)
70
- byebug (>= 9.0)
70
+ byebug (~> 9.0)
71
71
  rake (~> 10.0)
72
72
  rspec (~> 3.0)
73
73
  trizetto-api!
data/README.md CHANGED
@@ -8,10 +8,27 @@ Ruby wrapper for Trizetto APIs for Ruby 2.3 and above.
8
8
 
9
9
  <b>Requires Ruby 2.3 or above</b>
10
10
 
11
- Add this line to your application's Gemfile:
11
+ Add this line, and maybe some others, to your application's Gemfile:
12
12
 
13
13
  ```ruby
14
14
  gem 'trizetto-api'
15
+
16
+ # Savon-multipart is used in the CORE II API. savon-multipart 2.1.1 has the
17
+ # mail gem, pinned to exactly 2.5.4. As of Jan 18, 2018, there is an
18
+ # unreleased version that uses ~> 2.6. Depending on your existing gems
19
+ # you may need to add an explicit dependency on savon-multipart if bundle
20
+ # install fails with a mail gem dependency.
21
+ #
22
+ # You can savon-multipart, or use git diretly with one of the below
23
+ #
24
+ # savon-multipart as of Jan 18, 2018:
25
+ # gem 'savon-multipart', git: "git@github.com:savonrb/savon-multipart.git", ref: 'd9a138b6c166cd7c30c28e8888ff19011f8ec071'
26
+ #
27
+ # live on the edge
28
+ # gem 'savon-multipart', git: "git@github.com:savonrb/savon-multipart.git", branch: :master
29
+ #
30
+ # Your fork?
31
+ # gem 'savon-multipart', git: "git@github.com:YOU/savon-multipart.git"
15
32
  ```
16
33
 
17
34
  And then execute:
@@ -22,9 +39,9 @@ Or install it yourself as:
22
39
 
23
40
  $ gem install trizetto-api
24
41
 
25
-
26
42
  ## Usage
27
43
 
44
+
28
45
  ### Use the Eligibility Web Service with an XML payload to check eligibility in realtime
29
46
 
30
47
  This uses name/value pairs in a request and returns an XML docunment as a response.
@@ -32,9 +49,8 @@ This uses name/value pairs in a request and returns an XML docunment as a respon
32
49
  To simply check if the patient is covered by a health plan
33
50
 
34
51
  ```ruby
35
- GENERAL_HEALTH_PLAN_COVERAGE_CODE = "30"
36
52
  response = client.do_inquiry({...})
37
- response.active_coverage_for?(GENERAL_HEALTH_PLAN_COVERAGE_CODE) #=> true | false
53
+ response.active_coverage_for?("30`") #=> true | false
38
54
  ```
39
55
 
40
56
  ```ruby
@@ -53,7 +69,7 @@ client = Trizetto::Api::Eligibility::WebService::Client.new({
53
69
  })
54
70
 
55
71
  response = client.do_inquiry({
56
- 'ProviderLastName': 'BLUE CROSS BLUE SHIELD OF MASSACHUSETTS',
72
+ 'ProviderLastName': 'YOUR_COMPANY_NAME',
57
73
  'NPI': 'YOUR NPI HERE',
58
74
  'InsuredFirstName': 'Mickey',
59
75
  'InsuredLastName': 'Mouse',
@@ -72,6 +88,7 @@ response.errors.validation_failures.first.message # => "Please enter In
72
88
  response.success? # => true
73
89
  response.success_code # => "Success"
74
90
  response.transaction_id # => "c6eb40c5584f0496be3f3a48d0ddfd"
91
+ response.trace_number # => "88213481"
75
92
  response.payer_name # => "BLUE CROSS BLUE SHIELD OF MASSACHUSETTS"
76
93
  response.active_coverage_for?("30") # => true
77
94
 
@@ -116,16 +116,15 @@ module Trizetto
116
116
  #
117
117
  # @return DoInquiryResponse
118
118
  def do_inquiry(parameters={})
119
- DoInquiryResponse.new(
120
- @client.call( :do_inquiry, message: { 'Inquiry': {
121
- 'ResponseDataType': 'Xml',
122
- 'Parameters': {
123
- 'MyNameValue': parameters.map { |name, value|
124
- {'Name': name, 'Value': value}
125
- }
126
- }
127
- }})
128
- )
119
+ savon_response = @client.call( :do_inquiry, message: { 'Inquiry': {
120
+ 'ResponseDataType': 'Xml',
121
+ 'Parameters': {
122
+ 'MyNameValue': parameters.map { |name, value|
123
+ {'Name': name, 'Value': value}
124
+ }
125
+ }
126
+ }})
127
+ DoInquiryResponse.new(savon_response.body, savon_response.to_xml)
129
128
  end
130
129
 
131
130
  alias_method :check_eligibility, :do_inquiry
@@ -64,9 +64,42 @@ module Trizetto
64
64
  # @see InfoReceiver
65
65
  attr_accessor :info_receiver
66
66
 
67
+ # The full XML response from Trizetto if it was provided.
68
+ attr_accessor :raw_xml
67
69
 
68
- def initialize(response)
69
- response = response.to_hash.dig(:do_inquiry_response, :do_inquiry_result) || {}
70
+ # Parses the SOAP response from a DoInquiry request into ruby objects
71
+ #
72
+ # *Example*
73
+ #
74
+ # DoInquiryResponse.new({
75
+ # do_inquiry_response: {
76
+ # do_inquiry_result: {
77
+ # success_code: "Success",
78
+ # response_as_xml: "...",
79
+ # extra_processing_info: { ... }
80
+ # }
81
+ # }
82
+ # })
83
+ #
84
+ # *Example*
85
+ #
86
+ # client = Savon.client.new(...)
87
+ # savon_response = client.call( :do_inquiry, message: {...} )
88
+ # DoInquiryResponse.new(savon_response.body, savon_response.to_xml)
89
+ #
90
+ # *Example*
91
+ #
92
+ # parser = Nori.new(convert_tags_to: lambda { |tag| tag.snakecase.to_sym })
93
+ # raw_xml = File.read( xml_saved_on_disk_path )
94
+ # body = parser.parse(raw_xml).dig(:"soap:envelope", :"soap:body")
95
+ # DoInquiryResponse.new(body, raw_xml)
96
+ #
97
+ # @param body [Hash] the body of the SOAP request.
98
+ # @param xml [string] the raw XML of the SOAP request including the envelope
99
+ def initialize(body, xml = nil)
100
+ self.raw_xml = xml
101
+
102
+ response = body.dig(:do_inquiry_response, :do_inquiry_result) || {}
70
103
 
71
104
  self.success_code = response[:success_code]
72
105
  self.response_as_xml = response[:response_as_xml]
@@ -161,6 +194,22 @@ module Trizetto
161
194
  benefit.active_coverage? && benefit.service_type_codes.include?(service_type_code.to_s)
162
195
  end)
163
196
  end
197
+
198
+ # Trizetto adds a trace number to the subscriber or dependent that can
199
+ # be given to them later as part of a support request. Additionally
200
+ # the payer may add a trace. All the traces are available through
201
+ # `patient.traces`
202
+ #
203
+ # <b>Example</b>
204
+ #
205
+ # response.trace_number # => "81238881"
206
+ # response.trace_number('99Trizetto') # => "81238881"
207
+ # response.traces # => {"99TRIZETTO": "81238881"}
208
+ #
209
+ # @return [String] - a number that can be given to support for help with this request
210
+ def trace_number(trace_id="99Trizetto")
211
+ patient&.trace_number(trace_id)
212
+ end
164
213
  end
165
214
  end
166
215
  end
@@ -8,6 +8,8 @@ module Trizetto
8
8
  # Base class for parsed reponses in the eligibility response.
9
9
  class Node < OpenStruct
10
10
  def initialize(raw_hash = {})
11
+ raw_hash ||= {} # handle <Node/> tags - the hash comes through, but its nil
12
+
11
13
  required_keys = self.class.constants.include?(:REQUIRED_KEYS) ? self.class::REQUIRED_KEYS : {}
12
14
  clean_hash = required_keys.merge(raw_hash)
13
15
 
@@ -11,15 +11,29 @@ module Trizetto
11
11
  attr_accessor :name
12
12
 
13
13
  # The benefits this patient has.
14
- #
15
14
  attr_accessor :benefits
16
15
 
16
+ # The traces, by source (uppercased), in the response
17
+ #
18
+ # *Example*
19
+ #
20
+ # patient.traces # => {"99TRIZETTO" => "812341292"}
21
+ #
22
+ # *Example*
23
+ #
24
+ # patient.trace_number("99TRIZETTO") # => "812341292"
25
+ # patient.trace_number("99Trizeeto") # => "812341292"
26
+ attr_accessor :traces
27
+
17
28
  KEY_CLEANUP = {
18
29
  :patientid => :id
19
30
  }
20
31
 
21
32
  def initialize(raw_hash = {})
33
+ trace_ids, trace_numbers = Array(raw_hash.delete(:trace_id)), Array(raw_hash.delete(:trace_number))
34
+
22
35
  super(raw_hash)
36
+
23
37
  self.name = PatientName.new(raw_hash[:patientname]) if raw_hash.has_key?(:patientname)
24
38
 
25
39
  benefits_xml = raw_hash[:benefit] || []
@@ -28,6 +42,20 @@ module Trizetto
28
42
  self.benefits = benefits_xml.map do |benefit_xml|
29
43
  Benefit.new(benefit_xml)
30
44
  end
45
+
46
+ self.traces = {}
47
+ if trace_ids.length == trace_numbers.length
48
+ trace_ids.each.with_index do |id, index|
49
+ traces[id.upcase] = trace_numbers[index]
50
+ end
51
+ end
52
+ end
53
+
54
+ # Looks for a trace number by trace_id (who added the trace).
55
+ #
56
+ # @return [String]
57
+ def trace_number(trace_id="99Trizetto")
58
+ self.traces[trace_id&.upcase]
31
59
  end
32
60
  end
33
61
  end
@@ -22,7 +22,6 @@ module Trizetto
22
22
  end
23
23
  end
24
24
  end
25
-
26
25
  super(clean_hash)
27
26
  end
28
27
  end
@@ -1,5 +1,5 @@
1
1
  module Trizetto
2
2
  module Api
3
- VERSION = "0.2.1"
3
+ VERSION = "0.2.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trizetto-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Naegle
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-18 00:00:00.000000000 Z
11
+ date: 2018-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler