Class: Schwab::Operations::GetInstrument
- Inherits:
-
BaseOperation
- Object
- BaseOperation
- Schwab::Operations::GetInstrument
- Defined in:
- lib/schwab/operations/get_instrument.rb
Constant Summary collapse
- PROJECTIONS =
%w[symbol-search symbol-regex desc-search desc-regex search fundamental]
Constants inherited from BaseOperation
BaseOperation::HTTP_DEBUG_OUTPUT
Instance Attribute Summary
Attributes inherited from BaseOperation
Instance Method Summary collapse
Methods inherited from BaseOperation
Methods included from Util
Methods included from Error
Constructor Details
This class inherits a constructor from Schwab::Operations::BaseOperation
Instance Method Details
#call(symbols, projection:) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/schwab/operations/get_instrument.rb', line 8 def call(symbols, projection:) raise ArgumentError, "projection must be in #{PROJECTIONS}" unless PROJECTIONS.include?(projection) symbol = symbols.is_a?(Array) ? symbols.join(',') : symbols params = { symbol: symbol, projection: } response = perform_api_get_request( url: 'https://api.schwabapi.com/marketdata/v1/instruments', query: params, ) response end |