Class: EVSS::IntentToFile::Service
- Inherits:
-
Service
- Object
- Common::Client::Base
- Service
- EVSS::IntentToFile::Service
- Defined in:
- lib/evss/intent_to_file/service.rb
Overview
Proxy Service for Intent To File.
Constant Summary collapse
- ITF_SOURCE =
'VETS.GOV'
Constants inherited from Service
Instance Attribute Summary
Attributes inherited from Service
Instance Method Summary collapse
-
#create_intent_to_file(itf_type) ⇒ EVSS::IntentToFIle::IntentToFileResponse
Creates a new intent to file.
-
#get_active(itf_type) ⇒ EVSS::IntentToFile::IntentToFilesResponse
Returns all active intents to file of a particular type.
-
#get_intent_to_file ⇒ EVSS::IntentToFile::IntentToFilesResponse
Returns all intents to file for a user.
- #handle_error(error) ⇒ Object private
Methods inherited from Service
#headers, #initialize, #perform, #save_error_details, service_is_up?, #with_monitoring_and_error_handling
Methods included from Common::Client::Concerns::Monitoring
#increment, #increment_failure, #increment_total, #with_monitoring
Methods inherited from Common::Client::Base
#config, configuration, #connection, #delete, #get, #perform, #post, #put, #raise_backend_exception, #raise_not_authenticated, #request, #sanitize_headers!, #service_name
Methods included from SentryLogging
#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger, #set_sentry_metadata
Constructor Details
This class inherits a constructor from EVSS::Service
Instance Method Details
#create_intent_to_file(itf_type) ⇒ EVSS::IntentToFIle::IntentToFileResponse
Creates a new intent to file
57 58 59 60 61 62 |
# File 'lib/evss/intent_to_file/service.rb', line 57 def create_intent_to_file(itf_type) with_monitoring_and_error_handling do raw_response = perform(:post, itf_type.to_s, { source: ITF_SOURCE }.to_json, headers) EVSS::IntentToFile::IntentToFileResponse.new(raw_response.status, raw_response) end end |
#get_active(itf_type) ⇒ EVSS::IntentToFile::IntentToFilesResponse
Returns all active intents to file of a particular type
an array of intents to file
44 45 46 47 48 49 |
# File 'lib/evss/intent_to_file/service.rb', line 44 def get_active(itf_type) with_monitoring_and_error_handling do raw_response = perform(:get, "#{itf_type}/active") EVSS::IntentToFile::IntentToFileResponse.new(raw_response.status, raw_response) end end |
#get_intent_to_file ⇒ EVSS::IntentToFile::IntentToFilesResponse
Returns all intents to file for a user
an array of intents to file
30 31 32 33 34 35 |
# File 'lib/evss/intent_to_file/service.rb', line 30 def get_intent_to_file with_monitoring_and_error_handling do raw_response = perform(:get, '') EVSS::IntentToFile::IntentToFilesResponse.new(raw_response.status, raw_response) end end |
#handle_error(error) ⇒ Object (private)
66 67 68 69 70 71 72 73 |
# File 'lib/evss/intent_to_file/service.rb', line 66 def handle_error(error) if error.is_a?(Common::Client::Errors::ClientError) && error.status != 403 && error.body.is_a?(Hash) save_error_details(error) raise EVSS::IntentToFile::ServiceException, error.body else super(error) end end |