Class: PRLS::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/prls/cli.rb

Defined Under Namespace

Classes: BPP, CONCORD, DPS, MTI, PLAYSCRIPTS, PRO, Scraper

Constant Summary collapse

SESSION =
[]

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCLI



5
6
7
# File 'lib/prls/cli.rb', line 5

def initialize
    SESSION << self
end

Class Method Details

.sessionObject



9
10
11
# File 'lib/prls/cli.rb', line 9

def self.session 
    SESSION.first
end

Instance Method Details

#callObject



13
14
15
16
# File 'lib/prls/cli.rb', line 13

def call
    header
    menu
end

#headerObject



18
19
20
21
22
# File 'lib/prls/cli.rb', line 18

def header
    puts ""
    puts "PERFORMING RIGHTS LOOKUP SERVICE"
    puts "--------------------------------"
end


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
# File 'lib/prls/cli.rb', line 38

def menu
    input = nil
    while input != 'exit'
    pros
    input = gets.chomp.downcase
    case input.to_s
    when '1'
        puts ""
        puts "Loading..."
        puts ""
        DPS.get_plays
        DPS.list_plays
    when '2'
        puts ""
        puts "Loading..."
        puts ""
        CONCORD.get_plays
        CONCORD.list_plays
    when '3'
        puts ""
        puts "Loading..."
        puts ""
        MTI.get_plays
        MTI.list_plays
    when '4'
        puts ""
        puts "Loading..."
        puts ""
        PLAYSCRIPTS.get_plays
        PLAYSCRIPTS.list_plays
    when '5'
        puts ""
        puts "Loading..."
        puts ""
        BPP.get_plays
        BPP.list_plays
    when 'exit'
        puts 'Exiting...'
        exit
    else
        puts 'Invalid entry. Please try again.'
        puts ""
        menu
    end
    end
end

#prosObject



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/prls/cli.rb', line 24

def pros
    puts ""
    puts "Select a PRO to see their currently featured plays:"
    puts ""
    puts "1. Dramatist's Play Service, Inc."
    puts "2. Concord Theatricals (formerly Samuel French, Ltd.)"
    puts "3. Music Theatre International"
    puts "4. Playscripts, Inc."
    puts "5. Broadway Play Publishing, Inc."
    puts ""
    puts "To exit, type 'exit'."
    puts ""
end