Sha256: 364244bb118a3fe3e14a4103ae819be18a9e1031538f566c224aaf78a682bcea

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

module SynapsePay
  class BankMfaDevice < APIResource
    attr_accessor :access_token
    attr_accessor :cookies
    attr_accessor :form_extra
    attr_accessor :mfa
    attr_accessor :type

    def answer(bank, mfa, params={}, headers={})
      params = ParamsBuilder.merge({
        :bank => bank,
        :mfa => mfa,
      }, params)
      params = ParamsBuilder.merge({
        :access_token => access_token,
      }, 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

    # Everything below here is used behind the scenes.
    APIResource.register_api_subclass(self, "bank_mfa_device")
    @api_attributes = {
      :access_token => {},
      :cookies => {},
      :form_extra => {},
      :mfa => {},
      :type => {},
    }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
synapse_pay-0.0.8 lib/synapse_pay/resources/bank_mfa_device.rb