Class: ChangeHealth::Request::Eligibility

Inherits:
Hashie::Trash
  • Object
show all
Defined in:
lib/change_health/request/eligibility.rb

Constant Summary collapse

ENDPOINT =
'/medicalnetwork/eligibility/v3'.freeze
HEALTH_CHECK_ENDPOINT =
ENDPOINT + '/healthcheck'.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.health_checkObject



33
34
35
# File 'lib/change_health/request/eligibility.rb', line 33

def self.health_check
  ChangeHealth::Connection.new.request(endpoint: HEALTH_CHECK_ENDPOINT, verb: :get)
end

.pingObject



37
38
39
# File 'lib/change_health/request/eligibility.rb', line 37

def self.ping
  self.health_check
end

Instance Method Details

#add_dependent(dependent) ⇒ Object



22
23
24
25
# File 'lib/change_health/request/eligibility.rb', line 22

def add_dependent(dependent)
  self[:dependents] ||= []
  self[:dependents] << dependent
end

#queryObject



27
28
29
30
31
# File 'lib/change_health/request/eligibility.rb', line 27

def query
  endpoint = ChangeHealth::Connection.endpoint_for(self.class)

  ChangeHealth::Response::EligibilityData.new(response: ChangeHealth::Connection.new.request(endpoint: endpoint, body: self.to_h))
end