Class: SendGrid4r::CLI::Suppressions::Block

Inherits:
SendGrid4r::CLI::SgThor show all
Defined in:
lib/sendgrid4r/cli/suppressions/block.rb

Overview

SendGrid Web API v3 Suppressions Block

Instance Method Summary collapse

Methods inherited from SendGrid4r::CLI::SgThor

#initialize

Constructor Details

This class inherits a constructor from SendGrid4r::CLI::SgThor

Instance Method Details

#deleteObject



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/sendgrid4r/cli/suppressions/block.rb', line 22

def delete
  if options[:email]
    puts @client.delete_block(email: options[:email])
  else
    puts @client.delete_blocks(
      delete_all: options[:delete_all], emails: options[:emails]
    )
  end
rescue RestClient::ExceptionWithResponse => e
  puts e.inspect
end

#getObject



36
37
38
39
40
# File 'lib/sendgrid4r/cli/suppressions/block.rb', line 36

def get
  puts @client.get_block(parameterise(options))
rescue RestClient::ExceptionWithResponse => e
  puts e.inspect
end

#listObject



12
13
14
15
16
# File 'lib/sendgrid4r/cli/suppressions/block.rb', line 12

def list
  puts @client.get_blocks(parameterise(options))
rescue RestClient::ExceptionWithResponse => e
  puts e.inspect
end