Class: ChangeHealth::Request::Claim::Report
- Inherits:
-
Object
- Object
- ChangeHealth::Request::Claim::Report
- Defined in:
- lib/change_health/request/report.rb
Constant Summary collapse
- ENDPOINT =
'/medicalnetwork/reports/v2'.freeze
- HEALTH_CHECK_ENDPOINT =
ENDPOINT + '/healthcheck'.freeze
Class Method Summary collapse
- .delete_report(report_name, headers: nil, base_uri: nil, endpoint: nil, auth_headers: nil) ⇒ Object
- .get_report(report_name, as_json_report: true, headers: nil, report_type: nil, base_uri: nil, endpoint: nil, auth_headers: nil) ⇒ Object
- .health_check ⇒ Object
- .ping ⇒ Object
- .report_headers(headers) ⇒ Object
- .report_list(headers: nil, more_url: nil, base_uri: nil, endpoint: nil, auth_headers: nil) ⇒ Object
Class Method Details
.delete_report(report_name, headers: nil, base_uri: nil, endpoint: nil, auth_headers: nil) ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/change_health/request/report.rb', line 71 def self.delete_report(report_name, headers: nil, base_uri: nil, endpoint: nil, auth_headers: nil) return if report_name.nil? || report_name.empty? final_headers = ChangeHealth::Request::Claim::Report.report_headers(headers) endpoint ||= ChangeHealth::Connection.endpoint_for(self) individual_report_endpoint = "#{endpoint}/#{report_name}" ChangeHealth::Connection.new.request( endpoint: individual_report_endpoint, verb: :delete, headers: final_headers, base_uri: base_uri, auth_headers: auth_headers ) end |
.get_report(report_name, as_json_report: true, headers: nil, report_type: nil, base_uri: nil, endpoint: nil, auth_headers: nil) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/change_health/request/report.rb', line 21 def self.get_report( report_name, as_json_report: true, headers: nil, report_type: nil, base_uri: nil, endpoint: nil, auth_headers: nil ) return if report_name.nil? || report_name.empty? final_headers = ChangeHealth::Request::Claim::Report.report_headers(headers) endpoint ||= ChangeHealth::Connection.endpoint_for(self) individual_report_endpoint = "#{endpoint}/#{report_name}" # https://developers.changehealthcare.com/eligibilityandclaims/docs/what-file-types-does-this-api-get-from-the-mailbox if report_type individual_report_endpoint += "/#{report_type}" elsif as_json_report report_type = ChangeHealth::Response::Claim::ReportData.report_type(report_name) individual_report_endpoint += "/#{report_type}" end response = ChangeHealth::Connection.new.request( endpoint: individual_report_endpoint, verb: :get, headers: final_headers, base_uri: base_uri, auth_headers: auth_headers ) if ChangeHealth::Response::Claim::ReportData.is_277?(report_name) ChangeHealth::Response::Claim::Report277Data .new(report_name, as_json_report, response: response) elsif ChangeHealth::Response::Claim::ReportData.is_835?(report_name) ChangeHealth::Response::Claim::Report835Data .new(report_name, as_json_report, response: response) else ChangeHealth::Response::Claim::ReportData .new(report_name, as_json_report, response: response) end end |
.health_check ⇒ Object
88 89 90 |
# File 'lib/change_health/request/report.rb', line 88 def self.health_check ChangeHealth::Connection.new.request(endpoint: HEALTH_CHECK_ENDPOINT, verb: :get) end |
.ping ⇒ Object
92 93 94 |
# File 'lib/change_health/request/report.rb', line 92 def self.ping health_check end |
.report_headers(headers) ⇒ Object
96 97 98 99 100 101 102 103 |
# File 'lib/change_health/request/report.rb', line 96 def self.report_headers(headers) return unless headers extra_headers = {} extra_headers['X-CHC-Reports-Username'] = headers[:username] extra_headers['X-CHC-Reports-Password'] = headers[:password] extra_headers end |
.report_list(headers: nil, more_url: nil, base_uri: nil, endpoint: nil, auth_headers: nil) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/change_health/request/report.rb', line 8 def self.report_list(headers: nil, more_url: nil, base_uri: nil, endpoint: nil, auth_headers: nil) endpoint ||= ChangeHealth::Connection.endpoint_for(self) endpoint += more_url.to_s final_headers = ChangeHealth::Request::Claim::Report.report_headers(headers) ChangeHealth::Response::Claim::ReportListData.new(response: ChangeHealth::Connection.new.request( endpoint: endpoint, verb: :get, headers: final_headers, base_uri: base_uri, auth_headers: auth_headers )) end |