Class: EVSS::UpdateClaimFromRemoteJob
- Inherits:
-
Object
- Object
- EVSS::UpdateClaimFromRemoteJob
- Includes:
- Sidekiq::Job
- Defined in:
- app/sidekiq/evss/update_claim_from_remote_job.rb
Instance Method Summary collapse
Instance Method Details
#perform(user_uuid, claim_id) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/sidekiq/evss/update_claim_from_remote_job.rb', line 10 def perform(user_uuid, claim_id) Sentry.(source: 'claims-status') user = User.find user_uuid claim = EVSSClaim.find claim_id auth_headers = EVSS::AuthHeaders.new(user).to_h raw_claim = EVSS::ClaimsService.new( auth_headers ).find_claim_with_docs_by_id(claim.evss_id).body.fetch('claim', {}) claim.update(data: raw_claim) set_status(user_uuid, claim_id, 'SUCCESS') rescue set_status(user_uuid, claim_id, 'FAILED') raise end |
#set_status(user_uuid, claim_id, status) ⇒ Object (private)
27 28 29 30 31 |
# File 'app/sidekiq/evss/update_claim_from_remote_job.rb', line 27 def set_status(user_uuid, claim_id, status) tracker = EVSSClaimsSyncStatusTracker.find_or_build(user_uuid) tracker.claim_id = claim_id tracker.set_single_status(status) end |