Sha256: 61da844aad8058f94e22acf411017e4f56c6a7cc3dcc7611f0717c8b87083784

Contents?: true

Size: 1.48 KB

Versions: 5

Compression:

Stored size: 1.48 KB

Contents

module SynapsePay
  class BankEndpoint < APIEndpoint
    
    def add(params={}, headers={})
      method = APIMethod.new(:post, "/bank/add", params, headers, self)
      json = @client.execute(method)
      Bank.new(json[:bank], method, @client)
    end

    def all(params={}, headers={})
      method = APIMethod.new(:post, "/bank/show", params, headers, self)
      json = @client.execute(method)
      APIList.new(:Bank, json[:banks], method, @client)
    end

    def link(params={}, headers={})
      method = APIMethod.new(:post, "/bank/login", 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

    def refresh(id, params={}, headers={})
      params = ParamsBuilder.merge({
        :id => id,
      }, params)
      method = APIMethod.new(:post, "/bank/refresh", params, headers, self)
      json = @client.execute(method)
      APIList.new(:Bank, json[:banks], method, @client)
    end

    def remove(bank_id, params={}, headers={})
      params = ParamsBuilder.merge({
        :bank_id => bank_id,
      }, params)
      method = APIMethod.new(:post, "/bank/delete", params, headers, self)
      json = @client.execute(method)
      json
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
synapse_pay-0.0.8 lib/synapse_pay/endpoints/bank_endpoint.rb
synapse_pay-0.0.7 lib/synapse_pay/endpoints/bank_endpoint.rb
synapse_pay-0.0.6 lib/synapse_pay/endpoints/bank_endpoint.rb
synapse_pay-0.0.4 lib/synapse_pay/endpoints/bank_endpoint.rb
synapse_pay-0.0.3 lib/synapse_pay/endpoints/bank_endpoint.rb