Class: Dtn::Lookups::Historical::IntervalTimeframe

Inherits:
Interval show all
Defined in:
lib/dtn/lookups/historical/interval_timeframe.rb

Overview

Interval timeframe requests

Constant Summary collapse

TEMPLATE =
"HIT,%<symbol>s,%<interval>d,%<begin_datetime>s,%<end_datetime>s,%<max_datapoints>d,"\
"%<begin_filter_time>s,%<end_filter_time>s,%<data_direction>d,%<id>d,"\
"%<datapoints_per_send>d,%<interval_type>s"

Constants inherited from Base

Base::DEFAULT_BEGIN_FILTER_TIME, Base::DEFAULT_DATAPOINTS_PER_SEND, Base::DEFAULT_DATA_DIRECTION, Base::DEFAULT_END_FILTER_TIME, Base::DEFAULT_MAX_DATAPOINTS

Constants included from Concerns::Validation

Concerns::Validation::DATE_FORMAT, Concerns::Validation::DATE_TIME_FORMAT, Concerns::Validation::DEFAULT_INTERVAL_TYPE, Concerns::Validation::MAX_INT16

Constants inherited from Request

Request::END_OF_MESSAGE_CHARACTERS, Request::NO_DATA_CHARACTERS, Request::PORT, Request::SYNTAX_ERROR_CHARACTERS

Instance Attribute Summary

Attributes inherited from Request

#combined_options

Instance Method Summary collapse

Methods inherited from Interval

#expected_messages_class

Methods inherited from Request

call

Methods included from Concerns::Id

#id

Instance Method Details

#call(symbol:, interval:, begin_datetime:, end_datetime:, **options) ⇒ Object

HIT - Retrieves interval data between [BeginDate BeginTime] and [EndDate EndTime] for the specified [Symbol].

Example message

HIT,[Symbol],[Interval],[BeginDate BeginTime],[EndDate EndTime],[MaxDatapoints],\
[BeginFilterTime],[EndFilterTime],[DataDirection],[RequestID],[DatapointsPerSend],\
[IntervalType]<CR><LF>


22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/dtn/lookups/historical/interval_timeframe.rb', line 22

def call(symbol:, interval:, begin_datetime:, end_datetime:, **options)
  self.combined_options = defaults(**options).merge(
    {
      symbol: validate_symbol(symbol),
      interval: validate_int(interval),
      interval_type: validate_interval_type(options[:interval_type]),
      begin_datetime: validate_datetime(begin_datetime),
      end_datetime: validate_datetime(end_datetime)
    }
  )
  super
end