Class: GolfSwitch::CourseAvailDate

Inherits:
Object
  • Object
show all
Defined in:
lib/golf_switch/course_avail_date.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCourseAvailDate

Returns a new instance of CourseAvailDate.



6
7
8
# File 'lib/golf_switch/course_avail_date.rb', line 6

def initialize
  @al_times = []
end

Instance Attribute Details

#al_timesObject

Returns the value of attribute al_times.



3
4
5
# File 'lib/golf_switch/course_avail_date.rb', line 3

def al_times
  @al_times
end

#dtObject Also known as: date

Returns the value of attribute dt.



3
4
5
# File 'lib/golf_switch/course_avail_date.rb', line 3

def dt
  @dt
end

Class Method Details

.parse_date_info(al_date) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/golf_switch/course_avail_date.rb', line 10

def self.parse_date_info(al_date)

  avail_date = CourseAvailDate.new
  avail_date.dt= al_date[:dt]
  if al_date[:times] && al_date[:times][:al_time].is_a?(Array)
    al_date[:times][:al_time].each do |al_time|
      avail_date.al_times << CourseAvailTime.new(al_time)
    end
  elsif al_date[:times] && al_date[:times][:al_time].is_a?(Hash)
    avail_date.al_times << CourseAvailTime.new(al_date[:times][:al_time])
  end
  avail_date
end