Class: Tengai::EphemerisRequest
- Inherits:
-
Object
- Object
- Tengai::EphemerisRequest
- Defined in:
- lib/tengai/requests/ephemeris_request.rb
Constant Summary collapse
- SYSTEM_PROMPT =
%r{Horizons>}.freeze
- DEFAULT_PROMPT =
%r{<cr>:\s*$}- TABLE_PROMPT =
%r{Observe, Elements, Vectors \[o,e,v,\?\] :\s*$}.freeze
- FIRST_OBSERVER_PROMPT =
%r{Coordinate center \[ <id>,coord,geo \] :\s*$}.freeze
- SUBSEQUENT_OBSERVER_PROMPT =
%r{Use previous center \[ cr=\(y\), n, \? \] :\s*$}.freeze
- OBSERVER_PROMPT =
Regexp.union(FIRST_OBSERVER_PROMPT, SUBSEQUENT_OBSERVER_PROMPT).freeze
- CONFIRM_OBSERVER_PROMPT =
%r{Confirm selected station \[ y/n \] -->\s*$}.freeze
- REFERNCE_PLANE_PROMPT =
%r{Reference plane \[eclip, frame, body \] :\s*}.freeze
- START_TIME_PROMPT =
%r{Starting (C|U)T .* :\s*$}.freeze
- END_TIME_PROMPT =
%r{Ending \s* (C|U)T .* :\s*$}.freeze
- INTERVAL_PROMPT =
%r{Output interval \[ex: 10m, 1h, 1d, \? \] :\s*$}.freeze
- ACCEPT_DEFAULT_OUTPUT_PROMPT =
%r{Accept default output \[ cr=\(y\), n, \?\] :\s*$}.freeze
- OUTPUT_REFERENCE_FRAME_PROMPT =
%r{Output reference frame \[J2000, B1950\] :\s*$}.freeze
- CORRECTIONS_PROMPT =
%r{Corrections \[ 1=NONE, 2=LT, 3=LT\+S \] :\s*$}.freeze
- OUTPUT_UNITS =
%r{Output units \[1=KM-S, 2=AU-D, 3=KM-D\] :\s*$}.freeze
- CSV_FORMAT_PROMPT =
%r{Spreadsheet CSV format \[ YES, NO \] :\s*$}.freeze
- LABEL_CARTESIAN_OUTPUT_PROMPT =
%r{Label cartesian output \[ YES, NO \] :\s*$}.freeze
- SELECT_OUTPUT_TABLE_TYPE_PROMPT =
%r{Select output table type \[ 1-6, \? \] :\s*$}.freeze
- SELECT_QUANTITIES_PROMPT =
%r{Select table quantities \[ <#,#\.\.>, \?\] :\s*$}.freeze
- COMPLETED_PROMPT =
%r{>>> Select\.\.\. \[A\]gain, \[N\]ew-case, \[F\]tp, \[K\]ermit, \[M\]ail, \[R\]edisplay, \? :\s*$}.freeze
- ANY_PROMPT =
Regexp.union( DEFAULT_PROMPT, TABLE_PROMPT, OBSERVER_PROMPT, CONFIRM_OBSERVER_PROMPT, REFERNCE_PLANE_PROMPT, START_TIME_PROMPT, END_TIME_PROMPT, INTERVAL_PROMPT, ACCEPT_DEFAULT_OUTPUT_PROMPT, SELECT_QUANTITIES_PROMPT, COMPLETED_PROMPT, OUTPUT_REFERENCE_FRAME_PROMPT, CORRECTIONS_PROMPT, OUTPUT_UNITS, CSV_FORMAT_PROMPT, LABEL_CARTESIAN_OUTPUT_PROMPT, SELECT_OUTPUT_TABLE_TYPE_PROMPT, SYSTEM_PROMPT).freeze
- TIME_FORMAT =
'%Y-%b-%d %H:%M'.freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#fetch ⇒ Object
Public: initiates the ephemeris request.
-
#initialize(client, body, options = {}) ⇒ EphemerisRequest
constructor
A new instance of EphemerisRequest.
Constructor Details
#initialize(client, body, options = {}) ⇒ EphemerisRequest
Returns a new instance of EphemerisRequest.
34 35 36 37 38 39 40 41 42 |
# File 'lib/tengai/requests/ephemeris_request.rb', line 34 def initialize(client, body, ={}) @client = client @body = body.to_s @start_time = [:start_time] @stop_time = [:stop_time] @interval = [:interval] || 1440 @options = @state = :ready end |
Class Method Details
.fetch(client, body, options = {}) ⇒ Object
44 45 46 |
# File 'lib/tengai/requests/ephemeris_request.rb', line 44 def self.fetch(client, body, ={}) new(client, body, ).fetch end |
Instance Method Details
#fetch ⇒ Object
56 57 58 59 60 61 |
# File 'lib/tengai/requests/ephemeris_request.rb', line 56 def fetch raise "Not ready" unless @state == :ready @state = :fetching send_command(@body) @data end |