Class: EVSS::Letters::Service

Inherits:
Service show all
Defined in:
lib/evss/letters/service.rb

Overview

Proxy Service for Letters Caseflow.

Examples:

Creating a service and fetching letters for a user

letters_response = EVSS::Letters::Service.new.get_letters

Constant Summary collapse

INVALID_ADDRESS_ERROR =
'letterDestination.addressLine1.invalid'

Constants inherited from Service

Service::STATSD_KEY_PREFIX

Instance Attribute Summary

Attributes inherited from Service

#transaction_id

Instance Method Summary collapse

Methods inherited from Service

#headers, #initialize, #perform, service_is_up?

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

#with_monitoring

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 EVSS::Service

Instance Method Details

#get_letter_beneficiaryEVSS::Letters::BeneficiaryResponse

Returns benefit and service information for a user.

an array of military service objects

Returns:



47
48
49
50
51
52
# File 'lib/evss/letters/service.rb', line 47

def get_letter_beneficiary
  with_monitoring_and_error_handling do
    raw_response = perform(:get, 'letterBeneficiary')
    EVSS::Letters::BeneficiaryResponse.new(raw_response.status, raw_response)
  end
end

#get_lettersEVSS::Letters::LettersResponse

Returns letters for a user.

array of letter objects

Returns:



32
33
34
35
36
37
38
39
# File 'lib/evss/letters/service.rb', line 32

def get_letters
  with_monitoring do
    raw_response = perform(:get, '')
    EVSS::Letters::LettersResponse.new(raw_response.status, raw_response)
  end
rescue => e
  handle_error(e)
end