Class: LibTAD::Astronomy::AstronomyCurrent

Inherits:
Object
  • Object
show all
Defined in:
lib/types/astronomy/astronomy_current.rb

Overview

Current information about an astronomy object.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ AstronomyCurrent

Returns a new instance of AstronomyCurrent.



46
47
48
49
50
51
52
53
54
55
# File 'lib/types/astronomy/astronomy_current.rb', line 46

def initialize(hash)
  @isotime = hash.fetch('isotime', nil)
  @utctime = hash.fetch('utctime', nil)
  @altitude = hash.fetch('altitude', nil)
  @azimuth = hash.fetch('azimuth', nil)
  @distance = hash.fetch('distance', nil)
  @illuminated = hash.fetch('illuminated', nil)
  @posangle = hash.fetch('posangle', nil)
  @moonphase = MoonPhase.new hash['moonphase'] unless !hash.key?('moonphase')
end

Instance Attribute Details

#altitudeFloat (readonly)

Altitude of the center of the queried astronomical object above an ideal horizon.

Returns:

  • (Float)


21
22
23
# File 'lib/types/astronomy/astronomy_current.rb', line 21

def altitude
  @altitude
end

#azimuthFloat (readonly)

Horizontal direction of the astronomical object at set/rise time (referring to true north). North is 0 degrees, east is 90 degrees, south is 180 degrees and west is 270 degrees.

Returns:

  • (Float)

    (degrees)



26
27
28
# File 'lib/types/astronomy/astronomy_current.rb', line 26

def azimuth
  @azimuth
end

#distanceFloat (readonly)

Distance of the earth’s center to the center of the queried astronomical object in kilometers.

Returns:

  • (Float)

    (km)



30
31
32
# File 'lib/types/astronomy/astronomy_current.rb', line 30

def distance
  @distance
end

#illuminatedFloat (readonly)

The fraction of the Moon’s surface illuminated by the Sun’s rays as seen from the selected location. Only available for the moon object.

Returns:

  • (Float)

    (percent)



35
36
37
# File 'lib/types/astronomy/astronomy_current.rb', line 35

def illuminated
  @illuminated
end

#isotimeString (readonly)

Local time stamp for the data in ISO 8601 format (including UTC offset). Only returned if requested by specifying the parameter isotime.

Example: 2012-04-17T00:57:42+02:00

Returns:

  • (String)


10
11
12
# File 'lib/types/astronomy/astronomy_current.rb', line 10

def isotime
  @isotime
end

#moonphaseMoonPhase (readonly)

The current phase of the moon. Only available for the moon object.

Returns:



44
45
46
# File 'lib/types/astronomy/astronomy_current.rb', line 44

def moonphase
  @moonphase
end

#posangleFloat (readonly)

The counterclockwise angle of the midpoint of the Moon’s bright limb as seen from the selected location. Only available for the moon object.

Returns:

  • (Float)

    (degrees)



40
41
42
# File 'lib/types/astronomy/astronomy_current.rb', line 40

def posangle
  @posangle
end

#utctimeString (readonly)

UTC time stamp for the data in ISO 8601 format. Only returned if requested by specifying the parameter utctime.

Example: 2012-04-16T22:57:42

Returns:

  • (String)


17
18
19
# File 'lib/types/astronomy/astronomy_current.rb', line 17

def utctime
  @utctime
end