class DataStream::Stream

Attributes

result[R]

Public Class Methods

new(session, instrument, date) click to toggle source
# File lib/data_stream_api.rb, line 50
def initialize(session, instrument, date)
  @session = session
  path = "/DswsClient/V1/DSService.svc/rest/GetData"

  options = {
    headers: {
      "Content-Type" => "application/json"
    },
    body: {
      "DataRequest" => {
        "Date" => date,
        "Instrument" => instrument,
        "Tag" => nil
      },
      "Properties" => nil,
      "TokenValue" => @session.token
    }.to_json
  }

  if session.configured?
    @result = self.class.post path, options
    @session.logger.debug @result
  else
    session.not_configured_error
  end
end