Class: DataStream::Stream

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/data_stream_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(session, instrument, date) ⇒ Stream

Returns a new instance of Stream.



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# 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

Instance Attribute Details

#resultObject (readonly)

Returns the value of attribute result.



48
49
50
# File 'lib/data_stream_api.rb', line 48

def result
  @result
end