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
- .get_report(report_name, as_json_report: true, headers: nil) ⇒ Object
- .health_check ⇒ Object
- .ping ⇒ Object
- .report_headers(headers) ⇒ Object
- .report_list(headers: nil) ⇒ Object
Class Method Details
.get_report(report_name, as_json_report: true, headers: nil) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/change_health/request/report.rb', line 13 def self.get_report(report_name, as_json_report: true, headers: nil) return if report_name.nil? || report_name.empty? final_headers = ChangeHealth::Request::Claim::Report.report_headers(headers) report_type = ChangeHealth::Response::Claim::ReportData.report_type(report_name) return if report_type.nil? individual_report_endpoint = ENDPOINT + '/' + report_name # https://developers.changehealthcare.com/eligibilityandclaims/docs/what-file-types-does-this-api-get-from-the-mailbox individual_report_endpoint += '/' + report_type if as_json_report response = ChangeHealth::Connection.new.request(endpoint: individual_report_endpoint, verb: :get, headers: final_headers) if ChangeHealth::Response::Claim::ReportData.is_277?(report_name) ChangeHealth::Response::Claim::Report277Data .new(report_name, as_json_report, response: response) else ChangeHealth::Response::Claim::Report835Data .new(report_name, as_json_report, response: response) end end |
.health_check ⇒ Object
39 40 41 |
# File 'lib/change_health/request/report.rb', line 39 def self.health_check ChangeHealth::Connection.new.request(endpoint: HEALTH_CHECK_ENDPOINT, verb: :get) end |
.ping ⇒ Object
43 44 45 |
# File 'lib/change_health/request/report.rb', line 43 def self.ping self.health_check end |
.report_headers(headers) ⇒ Object
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/change_health/request/report.rb', line 47 def self.report_headers(headers) if headers extra_headers = {} extra_headers["X-CHC-Reports-Username"] = headers[:username] extra_headers["X-CHC-Reports-Password"] = headers[:password] extra_headers else nil end end |
.report_list(headers: nil) ⇒ Object
8 9 10 11 |
# File 'lib/change_health/request/report.rb', line 8 def self.report_list(headers: nil) 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)) end |