Class: AstroInsight::Models::BirthDetails

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(day:, month:, year:, hour:, min:, sec: 0, tzone: 5.5, lat: 28.6139, lon: 77.2090) ⇒ BirthDetails

Returns a new instance of BirthDetails.



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/astroinsight/models/birth_details.rb', line 8

def initialize(day:, month:, year:, hour:, min:, sec: 0, tzone: 5.5, lat: 28.6139, lon: 77.2090)
  @day = day.to_i
  @month = month.to_i
  @year = year.to_i
  @hour = hour.to_i
  @min = min.to_i
  @sec = sec.to_i
  @tzone = tzone.to_f
  @lat = lat.to_f
  @lon = lon.to_f
end

Instance Attribute Details

#dayObject

Returns the value of attribute day.



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

def day
  @day
end

#hourObject

Returns the value of attribute hour.



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

def hour
  @hour
end

#latObject

Returns the value of attribute lat.



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

def lat
  @lat
end

#lonObject

Returns the value of attribute lon.



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

def lon
  @lon
end

#minObject

Returns the value of attribute min.



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

def min
  @min
end

#monthObject

Returns the value of attribute month.



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

def month
  @month
end

#secObject

Returns the value of attribute sec.



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

def sec
  @sec
end

#tzoneObject

Returns the value of attribute tzone.



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

def tzone
  @tzone
end

#yearObject

Returns the value of attribute year.



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

def year
  @year
end

Instance Method Details

#to_hObject



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/astroinsight/models/birth_details.rb', line 20

def to_h
  {
    day: @day,
    month: @month,
    year: @year,
    hour: @hour,
    min: @min,
    sec: @sec,
    tzone: @tzone,
    lat: @lat,
    lon: @lon
  }
end

#to_json(*_args) ⇒ Object



34
35
36
# File 'lib/astroinsight/models/birth_details.rb', line 34

def to_json(*_args)
  to_h.to_json
end