Class: BGS::AwardsService

Inherits:
Object
  • Object
show all
Includes:
SentryLogging
Defined in:
app/services/bgs/awards_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SentryLogging

#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger

Constructor Details

#initialize(user) ⇒ AwardsService

Returns a new instance of AwardsService.



9
10
11
12
13
14
15
# File 'app/services/bgs/awards_service.rb', line 9

def initialize(user)
  @participant_id = user.participant_id
  @ssn = user.ssn
  @common_name = user.common_name
  @email = user.email
  @icn = user.icn
end

Instance Attribute Details

#common_nameObject (readonly)

Returns the value of attribute common_name.



7
8
9
# File 'app/services/bgs/awards_service.rb', line 7

def common_name
  @common_name
end

#emailObject (readonly)

Returns the value of attribute email.



7
8
9
# File 'app/services/bgs/awards_service.rb', line 7

def email
  @email
end

#icnObject (readonly)

Returns the value of attribute icn.



7
8
9
# File 'app/services/bgs/awards_service.rb', line 7

def icn
  @icn
end

#participant_idObject (readonly)

Returns the value of attribute participant_id.



7
8
9
# File 'app/services/bgs/awards_service.rb', line 7

def participant_id
  @participant_id
end

#ssnObject (readonly)

Returns the value of attribute ssn.



7
8
9
# File 'app/services/bgs/awards_service.rb', line 7

def ssn
  @ssn
end

Instance Method Details

#get_awardsObject



17
18
19
20
21
22
# File 'app/services/bgs/awards_service.rb', line 17

def get_awards
  service.awards.find_award_by_participant_id(participant_id, ssn) || service.awards.find_award_by_ssn(ssn)
rescue => e
  log_exception_to_sentry(e, { icn: }, { team: Constants::SENTRY_REPORTING_TEAM })
  false
end