Class: LPImgApp::Controllers::Edition

Inherits:
R
  • Object
show all
Defined in:
lib/easylittleprinter.rb

Overview

If the user requests /edition/, unless a local delivery time is not specified, the program checks whether it is a monday and, if it is, renders the current edition.

Instance Method Summary collapse

Instance Method Details

#getObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/easylittleprinter.rb', line 31

def get

@passedLDT = @input.local_delivery_time

	if @input.any? == false
    r(400, "No local_delivery_time. This is not the page you are looking for. Move along.")
else
    userDate = Date.new
    userDate = Time.parse(@passedLDT)
    if $publishes == "every_monday"
        if userDate.monday? == true
            render :currentEdition
        else
            r(200, "Error 200. Nothing to report, boss")
        end
    elsif $publishes == "every_tuesday"
        if userDate.tuesday? == true
            render :currentEdition
        else
            r(200, "Error 200. Nothing to report, boss")
        end
    elsif $publishes == "every_wednesday"
        if userDate.wednesday? == true
            render :currentEdition
        else
            r(200, "Error 200. Nothing to report, boss")
        end
    elsif $publishes == "every_thursday"
        if userDate.thursday? == true
            render :currentEdition
        else
            r(200, "Error 200. Nothing to report, boss")
        end
    elsif $publishes == "every_friday"
        if userDate.friday? == true
            render :currentEdition
        else
            r(200, "Error 200. Nothing to report, boss")
        end
    elsif $publishes == "every_saturday"
        if userDate.saturday? == true
            render :currentEdition
        else
            r(200, "Error 200. Nothing to report, boss")
        end
    elsif $publishes == "every_sunday"
        if userDate.sunday? == true
            render :currentEdition
        else
            r(200, "Error 200. Nothing to report, boss")
        end
    elsif $publishes == "everyday"
            render :currentEdition
    elsif $publishes == "every_mwf"
        if userDate.monday? == true or userDate.wednesday? == true or userDate.friday? == true
            render :currentEdition
        else
            r(200, "Error 200. Nothing to report, boss")
        end
    end
end
end