Class: AstroInsight::Models::GeoLocation

Inherits:
Object
  • Object
show all
Defined in:
lib/astroinsight/models/geo_location.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(lat:, lon:, tzone: 5.5) ⇒ GeoLocation

Returns a new instance of GeoLocation.



8
9
10
11
12
# File 'lib/astroinsight/models/geo_location.rb', line 8

def initialize(lat:, lon:, tzone: 5.5)
  @lat = lat.to_f
  @lon = lon.to_f
  @tzone = tzone.to_f
end

Instance Attribute Details

#latObject

Returns the value of attribute lat.



6
7
8
# File 'lib/astroinsight/models/geo_location.rb', line 6

def lat
  @lat
end

#lonObject

Returns the value of attribute lon.



6
7
8
# File 'lib/astroinsight/models/geo_location.rb', line 6

def lon
  @lon
end

#tzoneObject

Returns the value of attribute tzone.



6
7
8
# File 'lib/astroinsight/models/geo_location.rb', line 6

def tzone
  @tzone
end

Instance Method Details

#to_hObject



14
15
16
17
18
19
20
# File 'lib/astroinsight/models/geo_location.rb', line 14

def to_h
  {
    lat: @lat,
    lon: @lon,
    tzone: @tzone
  }
end

#to_json(*_args) ⇒ Object



22
23
24
# File 'lib/astroinsight/models/geo_location.rb', line 22

def to_json(*_args)
  to_h.to_json
end