Sha256: 906435a3ba53fcd41ae90aa19f9835fba88d4dd687d1f0ce0cddd0d21c794e02

Contents?: true

Size: 1.03 KB

Versions: 14

Compression:

Stored size: 1.03 KB

Contents

module Docdata
  #
  # This class bundles all the needed logic and methods for IDEAL specific stuff.
  #
  class Ideal

    #
    # List of supported banks.
    #
    # @visibility public
    #
    # @example
    #   Docdata.banks
    #
    # For the lack of an available list of banks by Docdata,
    # this gem uses the list provided by competitor Mollie.
    # 
    # @return [Array<Docdata::Ideal>] list of supported +Bank+'s.
    def self.banks
      begin
        @source ||= open('https://secure.mollie.nl/xml/ideal?a=banklist')
      rescue 
        # in case the mollie API isn't available
        # use the cached version (august 2014) of the XML file
        @source = open("#{File.dirname(__FILE__)}/xml/bank-list.xml")
      end
      @response ||= Nokogiri::XML(@source)
      @list = []
      @response.xpath("//bank").each do |b|
        bank = Docdata::Bank.new(
          id: b.xpath("bank_id").first.content,
          name: b.xpath("bank_name").first.content
        )
        @list << bank
      end
      return @list
    end

  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
docdata-0.2.3 lib/docdata/ideal.rb
docdata-0.2.2 lib/docdata/ideal.rb
docdata-0.2.1 lib/docdata/ideal.rb
docdata-0.2.0 lib/docdata/ideal.rb
docdata-0.1.8 lib/docdata/ideal.rb
docdata-0.1.7 lib/docdata/ideal.rb
docdata-0.1.6 lib/docdata/ideal.rb
docdata-0.1.5 lib/docdata/ideal.rb
docdata-0.1.4 lib/docdata/ideal.rb
docdata-0.1.2 lib/docdata/ideal.rb
docdata-0.1.1 lib/docdata/ideal.rb
docdata-0.1.0 lib/docdata/ideal.rb
docdata-0.0.5 lib/docdata/ideal.rb
docdata-0.0.2 lib/docdata/ideal.rb