Class: BGS::FlashUpdater
Constant Summary
collapse
- STATSD_KEY_PREFIX =
'worker.bgs.flash_updater'
Instance Attribute Summary collapse
Instance Method Summary
collapse
wrap_with_logging
#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger, #set_sentry_metadata
Instance Attribute Details
#submission_id ⇒ Object
Returns the value of attribute submission_id.
12
13
14
|
# File 'app/sidekiq/bgs/flash_updater.rb', line 12
def submission_id
@submission_id
end
|
Instance Method Details
#add_flashes ⇒ Object
84
85
86
87
88
89
90
91
92
|
# File 'app/sidekiq/bgs/flash_updater.rb', line 84
def add_flashes
flashes.each do |flash_name|
service.add_flash(file_number: ssn, flash_name:)
rescue BGS::ShareError, BGS::PublicError => e
Sentry.set_tags(source: '526EZ-all-claims', submission_id:)
log_exception_to_sentry(e)
end
end
|
#bgs_service ⇒ Object
122
123
124
125
126
127
128
|
# File 'app/sidekiq/bgs/flash_updater.rb', line 122
def bgs_service
BGS::Services.new(
external_uid: ssn,
external_key: ssn
)
end
|
#confirm_flash_addition ⇒ Object
94
95
96
97
98
99
100
101
102
103
104
|
# File 'app/sidekiq/bgs/flash_updater.rb', line 94
def confirm_flash_addition
assigned_flashes = service.find_assigned_flashes(ssn)[:flashes]
flashes.each do |flash_name|
assigned_flash = assigned_flashes.find { |af| af[:flash_name].strip == flash_name }
if assigned_flash.blank?
Sentry.set_tags(source: '526EZ-all-claims', submission_id:)
e = StandardError.new("Failed to assign '#{flash_name}' to Veteran")
log_exception_to_sentry(e)
end
end
end
|
#flashes ⇒ Object
106
107
108
|
# File 'app/sidekiq/bgs/flash_updater.rb', line 106
def flashes
@flashes ||= submission.form[Form526Submission::FLASHES]
end
|
75
76
77
78
79
80
|
# File 'app/sidekiq/bgs/flash_updater.rb', line 75
def perform(submission_id)
@submission_id = submission_id
add_flashes
confirm_flash_addition
end
|
#service ⇒ Object
118
119
120
|
# File 'app/sidekiq/bgs/flash_updater.rb', line 118
def service
@service ||= bgs_service.claimant
end
|
#ssn ⇒ Object
114
115
116
|
# File 'app/sidekiq/bgs/flash_updater.rb', line 114
def ssn
@ssn ||= submission.['va_eauth_pnid']
end
|
#submission ⇒ Object
110
111
112
|
# File 'app/sidekiq/bgs/flash_updater.rb', line 110
def submission
@submission ||= Form526Submission.find(submission_id)
end
|