Sha256: 2a29463cbce12fd9caf7e105be85ff13a5da1cf10887a10aa02327708368a0c9

Contents?: true

Size: 1.52 KB

Versions: 4

Compression:

Stored size: 1.52 KB

Contents

require_relative "model.rb"
module Figo
  # Retrieve specific bank
  #
  # @return [Bank] bank object
  def get_bank(bank_id)
    query_api_object Bank, "/rest/banks/#{bank_id}"
  end

  # Modify bank
  #
  # @param bank [Bank] modified bank object
  # @return [Bank] modified bank object returned by server
  def modify_bank(bank)
    query_api_object Bank, "/rest/banks/#{bank.bank_id}", bank.dump(), "PUT"
  end

  # Remove stored PIN from bank
  #
  # @param bank [Bank, String] the bank whose stored PIN should be removed or its ID
  # @return [nil]
  def remove_bank_pin(bank)
    query_api bank.is_a?(String) ? "/rest/banks/#{bank}/remove_pin" : "/rest/banks/#{bank.bank_id}/remove_pin", nil, "POST"
  end

  # Get bank information from standard bank code
  #
  # @param country_code [String]
  # @param bank_code [String] bank sort code (Bankleitzahl)
  # @return [Hash] JSON response
  def find_bank(bank_code, country_code = "DE")
    query_api "/rest/catalog/banks/#{country_code}/#{bank_code}"
  end

  # Get supported services
  #
  # @param country_code [String] the country code the service comes from
  # @param service [String] filter the type of service to request (optional): `banks`, `services` or everything (default)
  def get_supported_payment_services(country_code="DE", service)
    case service
    when "banks"
      query_api("/rest/catalog/banks/" + country_code, nil)
    when "service"
      query_api("/rest/catalog/services/" + country_code, nil)
    else
      query_api("/rest/catalog/" + country_code, nil)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
figo-1.4.2 lib/bank/api_call.rb
figo-1.4.1 lib/bank/api_call.rb
figo-1.4.0 lib/bank/api_call.rb
figo-1.3.3 lib/bank/api_call.rb