Sha256: df53d99754f31d65180d35a3850e105a39f977b56c7c1e1801fb458feb3e55a8

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

module AqumulateAPI
  class FinancialInstitution < Entity

    SOURCE_ASSOCIATIONS = [
        { key: 'FILoginParameters', class: LoginParameter, attr: :login_parameters },
        { key: 'FiFetchParamList', class: FetchParameter, attr: :fetch_parameters },
        { key: 'FiAccountDataList', class: AccountData, attr: :account_data },
    ]

    ATTR_MAP = {
        id: 'FIId',
        name: 'FIName',
        url: 'Url',
    }

    attr_accessor :id, :name, :url, :login_parameters, :fetch_parameters, :account_data

    def login_parameters
      @login_parameters ||= []
    end

    def fetch_parameters
      @fetch_parameters ||= []
    end

    def account_data
      @account_data ||= []
    end

    def self.find(id)
      response = AggAccount.advisor_get_financial_institution({ 'FIId' => id })
      from_source(response['FinancialInstitution'])
    end

    def self.search(keyword)
      response = AggAccount.advisor_search_financial_institution({ 'Keyword' => keyword })
      return [] unless response.has_key?('FinancialInstitutions')

      response['FinancialInstitutions'].map { |source| from_source(source) }
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aqumulate_api-0.2.0 lib/aqumulate_api/entities/financial_institution.rb