Class: Sendgrid::Web::FilterCommands

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

Instance Method Summary collapse

Methods inherited from Client

base_uri, config, #config, configure

Instance Method Details

#activate_app(name: nil) ⇒ Sendgrid::Web::Response

Note:

name is required.

Activate an app.

Parameters:

  • name (String) (defaults to: nil)

    The app in which to activate.

Returns:

Raises:

  • (ArgumentError)


20
21
22
23
24
25
26
# File 'lib/sendgrid/web/filter_commands.rb', line 20

def activate_app(name: nil)
  raise ArgumentError.new('Missing required `name` option') if name.nil?
  res = connection.post(
    '/api/filter.activate.json',
    default_params(name: name))
  craft_response(res)
end

#deactivate_app(name: nil) ⇒ Sendgrid::Web::Response

Note:

name is required.

Deactivate an app.

Parameters:

  • name (String) (defaults to: nil)

    The app in which to deactivate.

Returns:

Raises:

  • (ArgumentError)


33
34
35
36
37
38
39
# File 'lib/sendgrid/web/filter_commands.rb', line 33

def deactivate_app(name: nil)
  raise ArgumentError.new('Missing required `name` option') if name.nil?
  res = connection.post(
    '/api/filter.deactivate.json',
    default_params(name: name))
  craft_response(res)
end

#get_availableSendgrid::Web::Response

Note:

The name entry is used in all the other API calls to identify the app.

List all of the available apps.

Returns:



8
9
10
11
12
13
# File 'lib/sendgrid/web/filter_commands.rb', line 8

def get_available
  res = connection.post(
    '/api/filter.getavailable.json',
    default_params)
  craft_response(res)
end

#get_settings(name: nil) ⇒ Sendgrid::Web::Response

Note:

name is required.

Retrieve the settings of an app.

Parameters:

  • name (String) (defaults to: nil)

    The app in which to retrieve.

Returns:

Raises:

  • (ArgumentError)


59
60
61
62
63
64
65
# File 'lib/sendgrid/web/filter_commands.rb', line 59

def get_settings(name: nil)
  raise ArgumentError.new('Missing required `name` option') if name.nil?
  res = connection.post(
    '/api/filter.getsettings.json',
    default_params(name: name))
  craft_response(res)
end

#setup_app(options = {}) ⇒ Sendgrid::Web::Response

Note:

Other options are dependant on the app in question.

Update an apps settings.

Parameters:

  • name (String)

    The app in which to update.

Returns:

Raises:

  • (ArgumentError)


46
47
48
49
50
51
52
# File 'lib/sendgrid/web/filter_commands.rb', line 46

def setup_app(options = {})
  raise ArgumentError.new('Missing required `name` option') if options[:name].nil?
  res = connection.post(
    '/api/filter.setup.json',
    default_params(options))
  craft_response(res)
end