Class: ChangeHealth::Request::Claim::Submission
- Inherits:
-
Hashie::Trash
- Object
- Hashie::Trash
- ChangeHealth::Request::Claim::Submission
- Defined in:
- lib/change_health/request/submission.rb
Constant Summary collapse
- PROFESSIONAL_ENDPOINT =
'/medicalnetwork/professionalclaims/v3'.freeze
- INSTITUTIONAL_ENDPOINT =
'/medicalnetwork/institutionalclaims/v1'.freeze
- HEALTH_CHECK_SUFFIX =
'/healthcheck'.freeze
- SUBMISSION_SUFFIX =
'/submission'.freeze
- VALIDATION_SUFFIX =
'/validation'.freeze
- ENDPOINT =
Deprecated but still here for backwards compatibility
PROFESSIONAL_ENDPOINT
- HEALTH_CHECK_ENDPOINT =
ENDPOINT + '/healthcheck'.freeze
- SUBMISSION_ENDPOINT =
ENDPOINT + '/submission'.freeze
- VALIDATION_ENDPOINT =
ENDPOINT + '/validation'.freeze
Class Method Summary collapse
- .endpoint(is_professional: true, suffix: '') ⇒ Object
- .health_check(is_professional: true) ⇒ Object
- .ping(is_professional: true) ⇒ Object
Instance Method Summary collapse
- #add_provider(provider) ⇒ Object
- #institutional_headers ⇒ Object
- #professional_headers ⇒ Object
- #submission(is_professional: true, headers: nil, base_uri: nil, auth_headers: nil, endpoint: nil) ⇒ Object
- #validation(is_professional: true) ⇒ Object
Class Method Details
.endpoint(is_professional: true, suffix: '') ⇒ Object
87 88 89 90 91 92 93 94 95 |
# File 'lib/change_health/request/submission.rb', line 87 def self.endpoint(is_professional: true, suffix: '') default_endpoint = is_professional ? PROFESSIONAL_ENDPOINT : INSTITUTIONAL_ENDPOINT default_endpoint += suffix ChangeHealth::Connection.endpoint_for( ChangeHealth::Request::Claim::Submission, default_endpoint: default_endpoint ) end |
.health_check(is_professional: true) ⇒ Object
73 74 75 76 77 78 79 80 81 |
# File 'lib/change_health/request/submission.rb', line 73 def self.health_check(is_professional: true) ChangeHealth::Connection.new.request( endpoint: endpoint( is_professional: is_professional, suffix: HEALTH_CHECK_SUFFIX ), verb: :get ) end |
.ping(is_professional: true) ⇒ Object
83 84 85 |
# File 'lib/change_health/request/submission.rb', line 83 def self.ping(is_professional: true) health_check(is_professional: is_professional) end |
Instance Method Details
#add_provider(provider) ⇒ Object
38 39 40 41 |
# File 'lib/change_health/request/submission.rb', line 38 def add_provider(provider) self[:providers] ||= [] self[:providers] << provider end |
#institutional_headers ⇒ Object
108 109 110 111 112 113 114 115 116 117 |
# File 'lib/change_health/request/submission.rb', line 108 def institutional_headers return unless self[:headers] { 'X-CHC-InstitutionalClaims-BillerId' => self[:headers][:biller_id], 'X-CHC-InstitutionalClaims-Pwd' => self[:headers][:password], 'X-CHC-InstitutionalClaims-SubmitterId' => self[:headers][:submitter_id], 'X-CHC-InstitutionalClaims-Username' => self[:headers][:username] } end |
#professional_headers ⇒ Object
97 98 99 100 101 102 103 104 105 106 |
# File 'lib/change_health/request/submission.rb', line 97 def professional_headers return unless self[:headers] { 'X-CHC-ClaimSubmission-BillerId' => self[:headers][:biller_id], 'X-CHC-ClaimSubmission-Pwd' => self[:headers][:password], 'X-CHC-ClaimSubmission-SubmitterId' => self[:headers][:submitter_id], 'X-CHC-ClaimSubmission-Username' => self[:headers][:username] } end |
#submission(is_professional: true, headers: nil, base_uri: nil, auth_headers: nil, endpoint: nil) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/change_health/request/submission.rb', line 43 def submission(is_professional: true, headers: nil, base_uri: nil, auth_headers: nil, endpoint: nil) headers ||= is_professional ? professional_headers : institutional_headers endpoint ||= self.class.endpoint( is_professional: is_professional, suffix: SUBMISSION_SUFFIX ) ChangeHealth::Response::Claim::SubmissionData.new( response: ChangeHealth::Connection.new.request( endpoint: endpoint, base_uri: base_uri, body: to_h, headers: headers, auth_headers: auth_headers ) ) end |
#validation(is_professional: true) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/change_health/request/submission.rb', line 60 def validation(is_professional: true) ChangeHealth::Response::Claim::SubmissionData.new( response: ChangeHealth::Connection.new.request( endpoint: self.class.endpoint( is_professional: is_professional, suffix: VALIDATION_SUFFIX ), body: to_h, headers: is_professional ? professional_headers : institutional_headers ) ) end |