-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenu.rb
165 lines (142 loc) · 3.23 KB
/
menu.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
require 'dotenv/load'
require 'hello_sign'
require 'date'
require_relative('account-requests.rb')
require_relative('nonembedded-requests.rb')
require_relative('template-requests.rb')
require_relative('team-requests.rb')
def selection(option)
case option
when "1"
account
when "2"
update_account
when "3"
create_account
when "4"
puts "Enter an email to verify:"
email = input
if verify_account(email)
puts "An account for #{email} exists."
else
puts "There is no account for #{email}."
end
when "5"
puts "Enter Signature Request ID:"
id = input
get_signature_request(id)
when "6"
list_signature_requests
when "7"
send_signature_request
when "8"
send_with_template
when "9"
puts "Enter Signature Request ID:"
id = gets.chomp
puts "Enter email address to send reminder to:"
email = gets.chomp
send_reminder(id, email)
when "10"
puts "Enter Signature Request ID:"
request_id = gets.chomp
puts "Enter Signature ID:"
sig_id = gets.chomp
puts "Enter new email address:"
email = gets.chomp
update_request(request_id, sig_id, email)
when "11"
puts "Enter Signature Request ID:"
id = gets.chomp
cancel_request(id)
when "12"
puts "Enter Signature Request ID:"
id = gets.chomp
remove_access(id)
when "13"
puts "Enter Signature Request ID:"
id = gets.chomp
get_files(id)
when "14"
puts "Enter Template ID"
id = gets.chomp
get_template(id)
when "15"
list_templates
when "16"
puts "Enter Template ID:"
id = gets.chomp
puts "Enter email address:"
email = gets.chomp
add_template_access(id, email)
when "17"
puts "Enter Template ID:"
id = gets.chomp
puts "Enter email address:"
email = gets.chomp
remove_template_access(id, email)
when "18"
puts "Enter Template ID:"
id = gets.chomp
delete_template(id)
when "19"
puts "Enter Template ID:"
id = gets.chomp
get_template_files(id)
when "20"
puts "Enter Template ID:"
id = gets.chomp
update_template_files(id)
when "21"
get_team
when "22"
puts "Enter team name:"
name = gets.chomp
create_team(name)
when "23"
puts "Enter new team name:"
name = gets.chomp
update_team(name)
else
puts "I did not understand that request"
menu
end
end
def menu
puts <<-EOS
Welcome to the HelloSign Ruby Console App!
Select from the menu:
// ACCOUNT
1 - Get Account
2 - Update Account
3 - Create Account
4 - Verify Account
// NON-EMBEDDED SIGNATURE REQUEST
5 - Get Signature Request
6 - List Signature Requests
7 - Send Signature Request
8 - Send with Template
9 - Send Request Reminder
10 - Update Signature Request
11 - Cancel Incomplete Signature Request
12 - Remove Signature Request Access
13 - Get Files
// TEMPLATE
14 - Get Template
15 - List Templates
16 - Add User Access to Template
17 - Remove User Access to Template
18 - Delete Template
19 - Get Template Files
20 - Update Template Files
// TEAM
21 - Get Team
22 - Create Team
23 - Update Team
24 - Delete Team
25 - Add User to Team
26 - Remove User from Team
EOS
response = input
selection(response)
end