Class: BGS::UploadedDocumentService
- Inherits:
-
Object
- Object
- BGS::UploadedDocumentService
- Includes:
- SentryLogging
- Defined in:
- app/services/bgs/uploaded_document_service.rb
Instance Attribute Summary collapse
-
#common_name ⇒ Object
readonly
Returns the value of attribute common_name.
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#icn ⇒ Object
readonly
Returns the value of attribute icn.
-
#participant_id ⇒ Object
readonly
Returns the value of attribute participant_id.
-
#ssn ⇒ Object
readonly
Returns the value of attribute ssn.
Instance Method Summary collapse
- #external_key ⇒ Object private
- #get_documents ⇒ Object
-
#initialize(user) ⇒ UploadedDocumentService
constructor
A new instance of UploadedDocumentService.
- #service ⇒ Object private
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) ⇒ UploadedDocumentService
Returns a new instance of UploadedDocumentService.
9 10 11 12 13 14 |
# File 'app/services/bgs/uploaded_document_service.rb', line 9 def initialize(user) @participant_id = user.participant_id @common_name = user.common_name @email = user.email @icn = user.icn end |
Instance Attribute Details
#common_name ⇒ Object (readonly)
Returns the value of attribute common_name.
7 8 9 |
# File 'app/services/bgs/uploaded_document_service.rb', line 7 def common_name @common_name end |
#email ⇒ Object (readonly)
Returns the value of attribute email.
7 8 9 |
# File 'app/services/bgs/uploaded_document_service.rb', line 7 def email @email end |
#icn ⇒ Object (readonly)
Returns the value of attribute icn.
7 8 9 |
# File 'app/services/bgs/uploaded_document_service.rb', line 7 def icn @icn end |
#participant_id ⇒ Object (readonly)
Returns the value of attribute participant_id.
7 8 9 |
# File 'app/services/bgs/uploaded_document_service.rb', line 7 def participant_id @participant_id end |
#ssn ⇒ Object (readonly)
Returns the value of attribute ssn.
7 8 9 |
# File 'app/services/bgs/uploaded_document_service.rb', line 7 def ssn @ssn end |
Instance Method Details
#external_key ⇒ Object (private)
29 30 31 32 33 34 |
# File 'app/services/bgs/uploaded_document_service.rb', line 29 def external_key @external_key ||= begin key = common_name.presence || email key.first(Constants::EXTERNAL_KEY_MAX_LENGTH) end end |
#get_documents ⇒ Object
16 17 18 19 20 21 |
# File 'app/services/bgs/uploaded_document_service.rb', line 16 def get_documents service.uploaded_document.find_by_participant_id(participant_id) # rubocop:disable Rails/DynamicFindBy rescue => e log_exception_to_sentry(e, { icn: }, { team: Constants::SENTRY_REPORTING_TEAM }) false end |
#service ⇒ Object (private)
25 26 27 |
# File 'app/services/bgs/uploaded_document_service.rb', line 25 def service @service ||= BGS::Services.new(external_uid: icn, external_key:) end |