Sha256: a9dffd9d8693d1b73c862fd6f9c1eebc7c6f1fc727150a7598132ba93247c582

Contents?: true

Size: 796 Bytes

Versions: 2

Compression:

Stored size: 796 Bytes

Contents

module AruxApp
  module API
    class BankInfo
      def self.public_uri
        AruxApp::API.uri(subdomain: "banks")
      end

      def public_uri
        self.class.public_uri
      end

      def self.api_uri
        AruxApp::API.uri(subdomain: "banks.api")
      end

      def api_uri
        self.class.api_uri
      end

      def get(routing_number)
        routing_number = AruxApp::API.uri_escape(routing_number.to_s)

        request = HTTPI::Request.new
        request.url = "#{api_uri}/#{routing_number}"
        request.headers = {'User-Agent' => USER_AGENT}

        response = HTTPI.get(request)

        if !response.error?
          JSON.parse(response.body)
        else
          raise(API::Error.new(response.code, response.body))
        end
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
arux_app-3.0.1 lib/arux_app/api/bank_info.rb
arux_app-3.0.0 lib/arux_app/api/bank_info.rb