Class: Regis::Response::Model::Section

Inherits:
Base
  • Object
show all
Defined in:
lib/regis/responses/models/section.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ Section

Returns a new instance of Section.



46
47
48
49
50
# File 'lib/regis/responses/models/section.rb', line 46

def initialize(json)
    super(json)
    
    @instructors = parse(@instructors, Instructor)
end

Instance Attribute Details

#audits_long_nameObject (readonly)

Returns the value of attribute audits_long_name.



40
41
42
# File 'lib/regis/responses/models/section.rb', line 40

def audits_long_name
  @audits_long_name
end

#corequisitesObject (readonly)

Returns the value of attribute corequisites.



21
22
23
# File 'lib/regis/responses/models/section.rb', line 21

def corequisites
  @corequisites
end

#course_descriptionObject (readonly)

Returns the value of attribute course_description.



10
11
12
# File 'lib/regis/responses/models/section.rb', line 10

def course_description
  @course_description
end

#course_nameObject (readonly)

Returns the value of attribute course_name.



9
10
11
# File 'lib/regis/responses/models/section.rb', line 9

def course_name
  @course_name
end

#course_titleObject (readonly)

Returns the value of attribute course_title.



11
12
13
# File 'lib/regis/responses/models/section.rb', line 11

def course_title
  @course_title
end

#credits_long_nameObject (readonly)

Returns the value of attribute credits_long_name.



41
42
43
# File 'lib/regis/responses/models/section.rb', line 41

def credits_long_name
  @credits_long_name
end

#current_statusObject (readonly)

Returns the value of attribute current_status.



23
24
25
# File 'lib/regis/responses/models/section.rb', line 23

def current_status
  @current_status
end

#end_dateObject (readonly)

Returns the value of attribute end_date.



26
27
28
# File 'lib/regis/responses/models/section.rb', line 26

def end_date
  @end_date
end

#end_timesObject (readonly)

Returns the value of attribute end_times.



29
30
31
# File 'lib/regis/responses/models/section.rb', line 29

def end_times
  @end_times
end

#instructorsObject (readonly)

Returns the value of attribute instructors.



44
45
46
# File 'lib/regis/responses/models/section.rb', line 44

def instructors
  @instructors
end

#is_audioObject (readonly)

Returns the value of attribute is_audio.



17
18
19
# File 'lib/regis/responses/models/section.rb', line 17

def is_audio
  @is_audio
end

#is_eveningObject (readonly)

Returns the value of attribute is_evening.



33
34
35
# File 'lib/regis/responses/models/section.rb', line 33

def is_evening
  @is_evening
end

#is_oncampusObject (readonly)

Returns the value of attribute is_oncampus.



18
19
20
# File 'lib/regis/responses/models/section.rb', line 18

def is_oncampus
  @is_oncampus
end

#is_pass_failObject (readonly)

Returns the value of attribute is_pass_fail.



42
43
44
# File 'lib/regis/responses/models/section.rb', line 42

def is_pass_fail
  @is_pass_fail
end

#is_unlistedObject (readonly)

Returns the value of attribute is_unlisted.



36
37
38
# File 'lib/regis/responses/models/section.rb', line 36

def is_unlisted
  @is_unlisted
end

#is_waitlistObject (readonly)

Returns the value of attribute is_waitlist.



34
35
36
# File 'lib/regis/responses/models/section.rb', line 34

def is_waitlist
  @is_waitlist
end

#is_weekdayObject (readonly)

Returns the value of attribute is_weekday.



32
33
34
# File 'lib/regis/responses/models/section.rb', line 32

def is_weekday
  @is_weekday
end

#is_weekendObject (readonly)

Returns the value of attribute is_weekend.



31
32
33
# File 'lib/regis/responses/models/section.rb', line 31

def is_weekend
  @is_weekend
end

#location_codeObject (readonly)

Returns the value of attribute location_code.



13
14
15
# File 'lib/regis/responses/models/section.rb', line 13

def location_code
  @location_code
end

#location_long_nameObject (readonly)

Returns the value of attribute location_long_name.



14
15
16
# File 'lib/regis/responses/models/section.rb', line 14

def location_long_name
  @location_long_name
end

#meeting_daysObject (readonly)

Returns the value of attribute meeting_days.



27
28
29
# File 'lib/regis/responses/models/section.rb', line 27

def meeting_days
  @meeting_days
end

#prerequisitesObject (readonly)

Returns the value of attribute prerequisites.



20
21
22
# File 'lib/regis/responses/models/section.rb', line 20

def prerequisites
  @prerequisites
end

#reporting_termObject (readonly)

Returns the value of attribute reporting_term.



38
39
40
# File 'lib/regis/responses/models/section.rb', line 38

def reporting_term
  @reporting_term
end

#roomObject (readonly)

Returns the value of attribute room.



15
16
17
# File 'lib/regis/responses/models/section.rb', line 15

def room
  @room
end

#section_codeObject (readonly)

Returns the value of attribute section_code.



12
13
14
# File 'lib/regis/responses/models/section.rb', line 12

def section_code
  @section_code
end

#secUUIDObject (readonly)

Returns the value of attribute secUUID.



8
9
10
# File 'lib/regis/responses/models/section.rb', line 8

def secUUID
  @secUUID
end

#start_dateObject (readonly)

Returns the value of attribute start_date.



25
26
27
# File 'lib/regis/responses/models/section.rb', line 25

def start_date
  @start_date
end

#start_timesObject (readonly)

Returns the value of attribute start_times.



28
29
30
# File 'lib/regis/responses/models/section.rb', line 28

def start_times
  @start_times
end

#termObject (readonly)

Returns the value of attribute term.



39
40
41
# File 'lib/regis/responses/models/section.rb', line 39

def term
  @term
end

Class Method Details

.formatted_location(value) ⇒ Object



88
89
90
# File 'lib/regis/responses/models/section.rb', line 88

def self.formatted_location(value)
    return value.gsub("VAN"," Vancouver").gsub("AUDIO", " Distance").gsub("PARA", " Para-church").gsub("IV", " Intervarsity").gsub("SKAG", " Skagit Valley").gsub("KENYA", " Kenya").gsub("CAM", " Costa Rica").gsub("EU", " France").gsub("ME", " Israel & Palestine")
end

.formatted_term(value) ⇒ Object



76
77
78
# File 'lib/regis/responses/models/section.rb', line 76

def self.formatted_term(value)
    return value.gsub("WI"," Winter Term").gsub("SUR"," Summer Term").gsub("SU", " Summer (Distance)").gsub("FA"," Fall Term").gsub("SP", " Spring Session").gsub("SS", " Summer Session")
end

Instance Method Details

#formatted_end_date(format = "%b %-d") ⇒ Object



72
73
74
# File 'lib/regis/responses/models/section.rb', line 72

def formatted_end_date(format="%b %-d")
    DateTime.strptime(@end_date,"%Y-%m-%dT%H:%M:%S").strftime(format)
end

#formatted_instructors(options = {:linked => true }) ⇒ Object



96
97
98
99
100
101
102
# File 'lib/regis/responses/models/section.rb', line 96

def formatted_instructors(options = {:linked => true })
    ret = Array.new
    for i in self.instructors
        ret << "#{i.full_name} "
    end
    return ret
end

#formatted_locationObject



92
93
94
# File 'lib/regis/responses/models/section.rb', line 92

def formatted_location
    self.location_code.present?? Section.formatted_location(self.location_code) : ""
end

#formatted_meeting_daysObject



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/regis/responses/models/section.rb', line 52

def formatted_meeting_days
    if self.meeting_days == "Monday Tuesday Wednesday Thursday Friday Saturday Sunday"
        return "Monday to Sunday"
    end
    if self.meeting_days == "Monday Tuesday Wednesday Thursday Friday"
        return "Monday to Friday"
    end
    if self.meeting_days == "Monday Tuesday Wednesday Thursday"
        return "Monday to Thursday"
    end
    if self.meeting_days == "Wednesday Thursday Friday"
        return "Wednesday to Friday"
    end
    return self.meeting_days
end

#formatted_start_date(format = "%b %-d") ⇒ Object



68
69
70
# File 'lib/regis/responses/models/section.rb', line 68

def formatted_start_date(format="%b %-d")
    DateTime.strptime(@start_date,"%Y-%m-%dT%H:%M:%S").strftime(format)
end

#formatted_termObject



80
81
82
83
84
85
86
# File 'lib/regis/responses/models/section.rb', line 80

def formatted_term
    if self.term["SU"] and self.location_code["VAN"]
        Section.formatted_term(self.term.gsub("SU","SUR")) # on-campus "SU" courses are guided studies, theses, major projects, etc. Term needs to not translate as Distance.
    else
        Section.formatted_term(self.term)
    end
end