Class: SendGrid4r::CLI::Webhooks::Event

Inherits:
SgThor
  • Object
show all
Defined in:
lib/sendgrid4r/cli/webhooks/event.rb

Overview

SendGrid Web API v3 Webhooks Event

Instance Method Summary collapse

Methods inherited from SgThor

#initialize

Constructor Details

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

Instance Method Details

#disableObject



37
38
39
40
41
42
# File 'lib/sendgrid4r/cli/webhooks/event.rb', line 37

def disable
  params = { enabled: false }
  puts @client.patch_settings_event_notification(params: params)
rescue RestClient::ExceptionWithResponse => e
  puts e.inspect
end

#enableObject



27
28
29
30
31
32
33
34
# File 'lib/sendgrid4r/cli/webhooks/event.rb', line 27

def enable
  params = parameterise(options)
  params[:enabled] = true
  event = SendGrid4r::Factory::EventFactory.create(params)
  puts @client.patch_settings_event_notification(params: event)
rescue RestClient::ExceptionWithResponse => e
  puts e.inspect
end

#getObject



8
9
10
11
12
# File 'lib/sendgrid4r/cli/webhooks/event.rb', line 8

def get
  puts @client.get_settings_event_notification
rescue RestClient::ExceptionWithResponse => e
  puts e.inspect
end

#testObject



46
47
48
49
50
# File 'lib/sendgrid4r/cli/webhooks/event.rb', line 46

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