Class: EVSS::IntentToFile::Service

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

Overview

Proxy Service for Intent To File.

Examples:

Create a service and fetching intent to file for a user

itf_response = IntentToFile::Service.new.get_intent_to_file

Constant Summary collapse

ITF_SOURCE =
'VETS.GOV'

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

#create_intent_to_file(itf_type) ⇒ EVSS::IntentToFIle::IntentToFileResponse

Creates a new intent to file

Parameters:

  • itf_type (String)

    Type of intent to file

Returns:

  • (EVSS::IntentToFIle::IntentToFileResponse)

    Intent to file response object



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

Parameters:

  • itf_type (String)

    Type of intent to file

Returns:



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_fileEVSS::IntentToFile::IntentToFilesResponse

Returns all intents to file for a user

an array of intents to file

Returns:



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