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'- HEALTH_CHECK_ENDPOINT =
"#{ENDPOINT}/healthcheck"
Class Method Summary collapse
-
.delete_report(report_name, headers: nil, base_uri: nil, endpoint: nil, auth_headers: nil) ⇒ Object
rubocop:enable Metrics/CyclomaticComplexity rubocop:enable Metrics/MethodLength rubocop:enable Metrics/PerceivedComplexity rubocop:enable Metrics/ParameterLists.
-
.get_report(report_name, as_json_report: true, headers: nil, report_type: nil, base_uri: nil, endpoint: nil, auth_headers: nil) ⇒ Object
rubocop:disable Metrics/CyclomaticComplexity rubocop:disable Metrics/MethodLength rubocop:disable Metrics/PerceivedComplexity rubocop:disable Metrics/ParameterLists.
- .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
rubocop:enable Metrics/CyclomaticComplexity rubocop:enable Metrics/MethodLength rubocop:enable Metrics/PerceivedComplexity rubocop:enable Metrics/ParameterLists
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/change_health/request/report.rb', line 81 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
rubocop:disable Metrics/CyclomaticComplexity rubocop:disable Metrics/MethodLength rubocop:disable Metrics/PerceivedComplexity rubocop:disable Metrics/ParameterLists
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 70 71 72 73 74 75 |
# File 'lib/change_health/request/report.rb', line 27 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
98 99 100 |
# File 'lib/change_health/request/report.rb', line 98 def self.health_check ChangeHealth::Connection.new.request(endpoint: HEALTH_CHECK_ENDPOINT, verb: :get) end |
.ping ⇒ Object
102 103 104 |
# File 'lib/change_health/request/report.rb', line 102 def self.ping health_check end |
.report_headers(headers) ⇒ Object
106 107 108 109 110 111 112 113 |
# File 'lib/change_health/request/report.rb', line 106 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
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/change_health/request/report.rb', line 10 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 |