Class: SynapsePayRest::VirtualDocument
- Defined in:
- lib/synapse_pay_rest/models/user/virtual_document.rb
Overview
Represents virtual documents that can be added to a base document.
Instance Attribute Summary collapse
-
#question_set ⇒ SynapsePayRest::Array<SynapsePayRest::Question>
readonly
Questions/answer choices returned when document status is MFA|PENDING.
Attributes inherited from Document
#base_document, #document_value, #id, #last_updated, #meta, #status, #type, #value
Class Method Summary collapse
Instance Method Summary collapse
- #add_question_set(question_set_data) ⇒ Object deprecated Deprecated.
-
#initialize(**options) ⇒ VirtualDocument
constructor
A new instance of VirtualDocument.
- #submit_kba ⇒ SynapsePayRest::VirtualDocument deprecated Deprecated.
Methods inherited from Document
Constructor Details
#initialize(**options) ⇒ VirtualDocument
Note:
It should not be necessary to call this method directly.
Returns a new instance of VirtualDocument.
21 22 23 |
# File 'lib/synapse_pay_rest/models/user/virtual_document.rb', line 21 def initialize(**) super(**) end |
Instance Attribute Details
#question_set ⇒ SynapsePayRest::Array<SynapsePayRest::Question> (readonly)
Returns questions/answer choices returned when document status is MFA|PENDING.
9 10 11 |
# File 'lib/synapse_pay_rest/models/user/virtual_document.rb', line 9 def question_set @question_set end |
Class Method Details
.from_response(data) ⇒ Object
Note:
Do not call this method directly.
13 14 15 16 17 |
# File 'lib/synapse_pay_rest/models/user/virtual_document.rb', line 13 def from_response(data) virtual_doc = super(data) virtual_doc.add_question_set(data['meta']['question_set']) if data['status'] == 'SUBMITTED|MFA_PENDING' virtual_doc end |
Instance Method Details
#add_question_set(question_set_data) ⇒ Object
Deprecated.
Maps question set from response to Question objects.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/synapse_pay_rest/models/user/virtual_document.rb', line 42 def add_question_set(question_set_data) questions = question_set_data['questions'].map do |question_info| # re-map question/answer hash structure answers = {} question_info['answers'].each do |answer_hash| answers[answer_hash['id']] = answer_hash['answer'] end Question.new( id: question_info['id'], question: question_info['question'], answers: answers ) end @question_set = questions end |
#submit_kba ⇒ SynapsePayRest::VirtualDocument
Deprecated.
Submits the question/answer selections to the API to attempt to verify the virtual document.
31 32 33 34 35 36 37 |
# File 'lib/synapse_pay_rest/models/user/virtual_document.rb', line 31 def submit_kba user = base_document.user response = user.client.users.update(user_id: user.id, payload: payload_for_kba) user = User.from_response(user.client, response) base_doc = user.base_documents.find { |doc| doc.id == base_document.id } ssn_doc = base_doc.virtual_documents.find { |doc| doc.id == id } end |