Class: SendGrid4r::CLI::Campaign::Contact::List
- Inherits:
-
SgThor
- Object
- Thor
- SgThor
- SendGrid4r::CLI::Campaign::Contact::List
show all
- Defined in:
- lib/sendgrid4r/cli/campaign/contact/list.rb
Overview
SendGrid Web API v3 Marketing Campaigns - List
Instance Method Summary
collapse
Methods inherited from SgThor
#initialize
Instance Method Details
#create ⇒ Object
10
11
12
13
14
|
# File 'lib/sendgrid4r/cli/campaign/contact/list.rb', line 10
def create
puts @client.post_list(parameterise(options))
rescue RestClient::ExceptionWithResponse => e
puts e.inspect
end
|
#delete ⇒ Object
42
43
44
45
46
|
# File 'lib/sendgrid4r/cli/campaign/contact/list.rb', line 42
def delete
puts @client.delete_lists(parameterise(options))
rescue RestClient::ExceptionWithResponse => e
puts e.inspect
end
|
#get ⇒ Object
25
26
27
28
29
|
# File 'lib/sendgrid4r/cli/campaign/contact/list.rb', line 25
def get
puts @client.get_list(parameterise(options))
rescue RestClient::ExceptionWithResponse => e
puts e.inspect
end
|
#list ⇒ Object
17
18
19
20
21
|
# File 'lib/sendgrid4r/cli/campaign/contact/list.rb', line 17
def list
puts @client.get_lists
rescue RestClient::ExceptionWithResponse => e
puts e.inspect
end
|
#recipient(action) ⇒ Object
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/sendgrid4r/cli/campaign/contact/list.rb', line 54
def recipient(action)
case action
when 'add'
puts @client.post_recipients_to_list(parameterise(options))
when 'remove'
puts @client.delete_recipient_from_list(parameterise(options))
when 'list'
puts @client.get_recipients_from_list(parameterise(options))
else
puts "error: #{action} is not supported in action parameter"
end
rescue RestClient::ExceptionWithResponse => e
puts e.inspect
end
|
#rename ⇒ Object
34
35
36
37
38
|
# File 'lib/sendgrid4r/cli/campaign/contact/list.rb', line 34
def rename
puts @client.patch_list(parameterise(options))
rescue RestClient::ExceptionWithResponse => e
puts e.inspect
end
|