Sha256: 732ea2d21b1715869c19a30877b0f4ff8d5763946fe2f8cc298627ba74095a5f

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

module IEX
  module Endpoints
    module RefData
      def ref_data_isin(isins, options = {})
        response = get('ref-data/isin', { token: publishable_token, isin: Array(isins).join(',') }.merge(options))

        if response.is_a?(Hash) # mapped option was set
          response.transform_values do |rows|
            rows&.map { |row| IEX::Resources::Symbol.new(row) }
          end
        else
          response.map { |row| IEX::Resources::Symbol.new(row) }
        end
      end

      def ref_data_symbols(options = {})
        response = get('ref-data/symbols', { token: publishable_token }.merge(options))
        response.map { |row| IEX::Resources::Symbols.new(row) }
      end

      def ref_data_symbols_for_exchange(exchange, options = {})
        response = get("ref-data/exchange/#{exchange}/symbols", { token: publishable_token }.merge(options))
        response.map { |row| IEX::Resources::Symbols.new(row) }
      end

      def ref_data_symbols_for_region(region, options = {})
        response = get("ref-data/region/#{region}/symbols", { token: publishable_token }.merge(options))
        response.map { |row| IEX::Resources::Symbols.new(row) }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
iex-ruby-client-2.1.0 lib/iex/endpoints/ref_data.rb
iex-ruby-client-2.0.0 lib/iex/endpoints/ref_data.rb