Class: SynapsePay::BankMfaQuestionsEndpoint

Inherits:
APIEndpoint
  • Object
show all
Defined in:
lib/synapse_pay/endpoints/bank_mfa_questions_endpoint.rb

Instance Attribute Summary

Attributes inherited from APIEndpoint

#client

Instance Method Summary collapse

Methods inherited from APIEndpoint

#initialize

Constructor Details

This class inherits a constructor from SynapsePay::APIEndpoint

Instance Method Details

#answer(access_token, bank, mfa, params = {}, headers = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/synapse_pay/endpoints/bank_mfa_questions_endpoint.rb', line 4

def answer(access_token, bank, mfa, params={}, headers={})
  params = ParamsBuilder.merge({
    :access_token => access_token,
    :bank => bank,
    :mfa => mfa,
  }, params)
  method = APIMethod.new(:post, "/bank/mfa", params, headers, self)
  json = @client.execute(method)
  if(json[:is_mfa] && json[:response][:type] == "questions")
    BankMfaQuestions.new(json[:response], method, @client)
  elsif(json[:is_mfa] && json[:response][:type] == "device")
    BankMfaDevice.new(json[:response], method, @client)
  else
    APIList.new(:Bank, json[:banks], method, @client)
  end
end