Class: SendGrid4r::CLI::Settings::Mail
Overview
SendGrid Web API v3 Settings Mail
Instance Method Summary
collapse
#initialize
Instance Method Details
#bcc(action) ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/sendgrid4r/cli/settings/mail.rb', line 35
def bcc(action)
case action
when 'get'
puts @client.get_settings_bcc
when 'enable', 'disable'
params = parameterise(options)
params[:enabled] = action == 'enable'
puts @client.patch_settings_bcc(params: params)
else
puts "error: #{action} is not supported in action parameter"
end
rescue RestClient::ExceptionWithResponse => e
puts e.inspect
end
|
#bounce_purge(action) ⇒ Object
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/sendgrid4r/cli/settings/mail.rb', line 53
def bounce_purge(action)
case action
when 'get'
puts @client.get_settings_bounce_purge
when 'enable', 'disable'
params = parameterise(options)
params[:enabled] = action == 'enable'
puts @client.patch_settings_bounce_purge(params: params)
else
puts "error: #{action} is not supported in action parameter"
end
rescue RestClient::ExceptionWithResponse => e
puts e.inspect
end
|
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
# File 'lib/sendgrid4r/cli/settings/mail.rb', line 71
def (action)
case action
when 'get'
puts @client.
when 'enable', 'disable'
params = parameterise(options)
params[:enabled] = action == 'enable'
puts @client.(params: params)
else
puts "error: #{action} is not supported in action parameter"
end
rescue RestClient::ExceptionWithResponse => e
puts e.inspect
end
|
#forward_bounce(action) ⇒ Object
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
# File 'lib/sendgrid4r/cli/settings/mail.rb', line 88
def forward_bounce(action)
case action
when 'get'
puts @client.get_settings_forward_bounce
when 'enable', 'disable'
params = parameterise(options)
params[:enabled] = action == 'enable'
puts @client.patch_settings_forward_bounce(params: params)
else
puts "error: #{action} is not supported in action parameter"
end
rescue RestClient::ExceptionWithResponse => e
puts e.inspect
end
|
#forward_spam(action) ⇒ Object
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
# File 'lib/sendgrid4r/cli/settings/mail.rb', line 105
def forward_spam(action)
case action
when 'get'
puts @client.get_settings_forward_spam
when 'enable', 'disable'
params = parameterise(options)
params[:enabled] = action == 'enable'
puts @client.patch_settings_forward_spam(params: params)
else
puts "error: #{action} is not supported in action parameter"
end
rescue RestClient::ExceptionWithResponse => e
puts e.inspect
end
|
#list ⇒ Object
10
11
12
13
14
|
# File 'lib/sendgrid4r/cli/settings/mail.rb', line 10
def list
puts @client.get_mail_settings(parameterise(options))
rescue RestClient::ExceptionWithResponse => e
puts e.inspect
end
|
#plain_content(action) ⇒ Object
156
157
158
159
160
161
162
163
164
165
166
167
168
|
# File 'lib/sendgrid4r/cli/settings/mail.rb', line 156
def plain_content(action)
case action
when 'get'
puts @client.get_settings_plain_content
when 'enable', 'disable'
params = { enabled: action == 'enable' }
puts @client.patch_settings_plain_content(params: params)
else
puts "error: #{action} is not supported in action parameter"
end
rescue RestClient::ExceptionWithResponse => e
puts e.inspect
end
|
#spam_check(action) ⇒ Object
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
# File 'lib/sendgrid4r/cli/settings/mail.rb', line 123
def spam_check(action)
case action
when 'get'
puts @client.get_settings_spam_check
when 'enable', 'disable'
params = parameterise(options)
params[:enabled] = action == 'enable'
puts @client.patch_settings_spam_check(params: params)
else
puts "error: #{action} is not supported in action parameter"
end
rescue RestClient::ExceptionWithResponse => e
puts e.inspect
end
|
#template(action) ⇒ Object
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
# File 'lib/sendgrid4r/cli/settings/mail.rb', line 140
def template(action)
case action
when 'get'
puts @client.get_settings_template
when 'enable', 'disable'
params = parameterise(options)
params[:enabled] = action == 'enable'
puts @client.patch_settings_template(params: params)
else
puts "error: #{action} is not supported in action parameter"
end
rescue RestClient::ExceptionWithResponse => e
puts e.inspect
end
|
#whitelist(action) ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/sendgrid4r/cli/settings/mail.rb', line 18
def whitelist(action)
case action
when 'get'
puts @client.get_settings_address_whitelist
when 'enable', 'disable'
params = parameterise(options)
params[:enabled] = action == 'enable'
puts @client.patch_settings_address_whitelist(params: params)
else
puts "error: #{action} is not supported in action parameter"
end
rescue RestClient::ExceptionWithResponse => e
puts e.inspect
end
|