Class: Sendgrid::Web::ParseWebhookSettings

Inherits:
Client
  • Object
show all
Defined in:
lib/sendgrid/web/parse_webhook_settings.rb

Instance Method Summary collapse

Methods inherited from Client

base_uri, config, #config, configure

Instance Method Details

#delete(hostname: nil) ⇒ Sendgrid::Web::Response

Note:

hostname is a required parameter.

Delete the existing settings for parsing incoming emails.

Parameters:

  • hostname (String) (defaults to: nil)

    The hostname (domain or subdomain) for which you would like to configure a Parse Webhook callback URL.

Returns:



67
68
69
70
71
72
73
74
75
# File 'lib/sendgrid/web/parse_webhook_settings.rb', line 67

def delete(hostname: nil)
  if hostname.nil?
    raise ArgumentError.new('Missing required `hostname` option')
  end
  res = connection.post(
    '/api/parse.delete.json',
    default_params(hostname: hostname))
  craft_response(res)
end

#edit(hostname: nil, url: nil, spam_check: nil) ⇒ Sendgrid::Web::Response

Note:

hostname and url are required parameters.

Edit your existing settings for parsing incoming emails.

Parameters:

  • hostname (String) (defaults to: nil)

    The hostname (domain or subdomain) for which you would like to configure a Parse Webhook callback URL.

  • url (String) (defaults to: nil)

    The callback URL to which Parse Webhook payloads will be POSTed.

  • spam_check (Integer) (defaults to: nil)

    If spam check is enabled, messages that look like spam will not be POSTed.

Returns:



46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/sendgrid/web/parse_webhook_settings.rb', line 46

def edit(hostname: nil, url: nil, spam_check: nil)
  if hostname.nil?
    raise ArgumentError.new('Missing required `hostname` option')
  elsif url.nil?
    raise ArgumentError.new('Missing required `url` option')
  end
  res = connection.post(
    '/api/parse.edit.json',
    default_params(
      hostname: hostname,
      url: url,
      spam_check: spam_check))
  craft_response(res)
end

#getSendgrid::Web::Response

Retrieve settings already configured for parsing incoming email.

Returns:



6
7
8
9
# File 'lib/sendgrid/web/parse_webhook_settings.rb', line 6

def get
  res = connection.post('/api/parse.get.json', default_params)
  craft_response(res)
end

#set(hostname: nil, url: nil, spam_check: nil) ⇒ Sendgrid::Web::Response

Note:

hostname and url are required parameters.

Specify the hostname and url for parsing incoming emails.

Parameters:

  • hostname (String) (defaults to: nil)

    The hostname (domain or subdomain) for which you would like to configure a Parse Webhook callback URL.

  • url (String) (defaults to: nil)

    The callback URL to which Parse Webhook payloads will be POSTed.

  • spam_check (Integer) (defaults to: nil)

    If spam check is enabled, messages that look like spam will not be POSTed.

Returns:



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/sendgrid/web/parse_webhook_settings.rb', line 21

def set(hostname: nil, url: nil, spam_check: nil)
  if hostname.nil?
    raise ArgumentError.new('Missing required `hostname` option')
  elsif url.nil?
    raise ArgumentError.new('Missing required `url` option')
  end
  res = connection.post(
    '/api/parse.set.json',
    default_params(
      hostname: hostname,
      url: url,
      spam_check: spam_check))
  craft_response(res)
end