Sha256: 9ba0a4ca2dbd4307640c653fe9510205e27a6a09c4b3215ed1c211946572111c

Contents?: true

Size: 536 Bytes

Versions: 4

Compression:

Stored size: 536 Bytes

Contents

module LatestStockPrice
  class Prices
    API_BASE_URL = "https://latest-stock-price.p.rapidapi.com/equities-enhanced"

    def self.fetch(symbols) # Param example - ['AAATECH.NS', 'AADHHOUS.NS']
      raise ArgumentError, "Search term cannot be nil or empty" if symbols.nil? || symbols.empty? # could improve by checking each array item

			symbols_param = URI.encode_www_form_component(symbols.join(','))
      uri = URI("#{API_BASE_URL}?Symbols=#{symbols_param}")
			LatestStockPrice::HttpClient.make_request(uri)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
latest_stock_price-1.0.3 lib/prices.rb
latest_stock_price-1.0.2 lib/prices.rb
latest_stock_price-1.0.1 lib/prices.rb
latest_stock_price-1.0.0 lib/latest_stock_price/prices.rb