Class: VAProfile::HealthBenefit::Service

Inherits:
Service show all
Includes:
Common::Client::Concerns::Monitoring
Defined in:
lib/va_profile/health_benefit/service.rb

Constant Summary collapse

OID =

placeholder

'1.2.3'

Constants inherited from Service

Service::STATSD_KEY_PREFIX

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Common::Client::Concerns::Monitoring

#with_monitoring

Methods inherited from Service

breakers_service, #initialize, #perform

Methods inherited from Common::Client::Base

configuration, #raise_backend_exception

Methods included from SentryLogging

#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger

Constructor Details

This class inherits a constructor from VAProfile::Service

Instance Attribute Details

#userObject (readonly)

Returns the value of attribute user.



16
17
18
# File 'lib/va_profile/health_benefit/service.rb', line 16

def user
  @user
end

Instance Method Details

#get_associated_personsObject



18
19
20
21
22
23
24
25
26
27
# File 'lib/va_profile/health_benefit/service.rb', line 18

def get_associated_persons
  return mock_get_associated_persons if config.mock_enabled?

  with_monitoring do
    response = perform(:get, v1_read_path)
    VAProfile::HealthBenefit::AssociatedPersonsResponse.from(response)
  end
rescue => e
  handle_error(e)
end

#mock_get_associated_personsObject



29
30
31
32
33
34
# File 'lib/va_profile/health_benefit/service.rb', line 29

def mock_get_associated_persons
  fixture_path = %w[spec fixtures va_profile health_benefit_v1_associated_persons.json]
  body = Rails.root.join(*fixture_path).read
  response = OpenStruct.new(status: 200, body:)
  VAProfile::HealthBenefit::AssociatedPersonsResponse.from(response)
end