Class: HCA::Service
- Inherits:
-
Common::Client::Base
- Object
- Common::Client::Base
- HCA::Service
- Defined in:
- lib/hca/service.rb
Constant Summary collapse
- STATSD_KEY_PREFIX =
'api.1010ez'
Instance Method Summary collapse
- #health_check ⇒ Object
-
#initialize(user = nil) ⇒ Service
constructor
A new instance of Service.
- #submit_form(form) ⇒ Object
Methods included from VA1010Forms::Utils
#es_submit, #log_payload_info, #override_parsed_form, #soap, #submission_body
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
#initialize(user = nil) ⇒ Service
Returns a new instance of Service.
18 19 20 |
# File 'lib/hca/service.rb', line 18 def initialize(user = nil) @user = user end |
Instance Method Details
#health_check ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/hca/service.rb', line 36 def health_check submission = soap.build_request(:get_form_submission_status, message: { formSubmissionId: HCA::Configuration::HEALTH_CHECK_ID }) response = with_monitoring do perform(:post, '', submission.body) end root = response.body.locate('S:Envelope/S:Body/retrieveFormSubmissionStatusResponse').first { formSubmissionId: root.locate('formSubmissionId').first.text.to_i, timestamp: root.locate('timeStamp').first&.text || Time.now.getlocal.to_s } end |
#submit_form(form) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/hca/service.rb', line 23 def submit_form(form) is_short_form = HealthCareApplication.new(form: form.to_json).short_form? with_monitoring do es_submit(form, @user, '10-10EZ') rescue => e increment_failure('submit_form_short_form', e) if is_short_form raise e ensure increment_total('submit_form_short_form') if is_short_form end end |