class Tengai::Ephemeris
Public Class Methods
fetch(client, body, options={})
click to toggle source
Public: fetch an ephemeris table for a given body using the client
client - Tengai::Client
body - a Tengai::Body
instance whose ephemeris is needed options - A Hash of options for refining the ephemeris table
:start_time - The Time beginning of the ephemeris :stop_time - The Time end of the ephemeris :interval - The resolution of the table in minutes
# File lib/tengai/ephemeris.rb, line 37 def self.fetch(client, body, options={}) start_time = options[:start_time] || Date.today.to_time # defaults start at today stop_time = options[:stop_time] || (Date.today + 1).to_time # and end tomorrow interval = options[:interval] || 1440 # Inject dependencies request = options[:request] || EphemerisRequest parser = options[:parser] || VectorEphemerisParser data = request.fetch( client, body.id, start_time: start_time, stop_time: stop_time, interval: interval) data = parser.parse(data) new(client, data) end
new(client, data)
click to toggle source
Calls superclass method
# File lib/tengai/ephemeris.rb, line 16 def initialize(client, data) super(data) @client = client end
Public Instance Methods
ephemeris_table=(table)
click to toggle source
# File lib/tengai/ephemeris.rb, line 25 def ephemeris_table=(table) @ephemeris_table = VectorEphemerisTable.new_with_table(table) end
target_body()
click to toggle source
# File lib/tengai/ephemeris.rb, line 21 def target_body @target_body ||= Tengai::Body.find(@client, target_body_id) end