class MailinatorClient::Rules

Class containing all the actions for the Rules Resource

Public Class Methods

new(client) click to toggle source
# File lib/mailinator_client/rules.rb, line 30
def initialize(client)
  @client = client
end

Public Instance Methods

create_rule(params = {}) click to toggle source

Creates a Rule. Note that in the examples, “:domain_id” can be one of your private domains.

Authentication: The client must be configured with a valid api access token to call this action.

Parameters:

Responses:

# File lib/mailinator_client/rules.rb, line 46
def create_rule(params = {})
  params = Utils.symbolize_hash_keys(params)
  query_params = { }
  headers = {}
  body = nil

  raise ArgumentError.new("domain id is required") unless params.has_key?(:domainId)
  raise ArgumentError.new("ruleToPost is required") unless params.has_key?(:ruleToPost)

  body = params[:ruleToPost] if params.has_key?(:ruleToPost)

  path = "/domains/#{params[:domainId]}/rules"

  @client.request(
    method: :post,
    path: path,
    query: query_params,
    headers: headers,
    body: body)
end
delete_rule(params = {}) click to toggle source

Deletes a specific rule for a Domain.

Authentication: The client must be configured with a valid api access token to call this action.

Parameters:

  • {string} domainId - The Domain name or the Domain id

  • {string} ruleId - The Rule id

Responses:

# File lib/mailinator_client/rules.rb, line 201
def delete_rule(params = {})
  params = Utils.symbolize_hash_keys(params)
  query_params = { }
  headers = {}
  body = nil

  raise ArgumentError.new("domain id is required") unless params.has_key?(:domainId)
  raise ArgumentError.new("rule id is required") unless params.has_key?(:ruleId)

  path = "/domains/#{params[:domainId]}/rules/#{params[:ruleId]}"

  @client.request(
    method: :delete,
    path: path,
    query: query_params,
    headers: headers,
    body: body)
end
disable_rule(params = {}) click to toggle source

Disables an existing Rule

Authentication: The client must be configured with a valid api access token to call this action.

Parameters:

  • {string} domainId - The Domain name or the Domain id

  • {string} ruleId - The Rule id

Responses:

# File lib/mailinator_client/rules.rb, line 110
def disable_rule(params = {})
  params = Utils.symbolize_hash_keys(params)
  query_params = { }
  headers = {}
  body = nil

  raise ArgumentError.new("domain id is required") unless params.has_key?(:domainId)
  raise ArgumentError.new("rule id is required") unless params.has_key?(:ruleId)

  path = "/domains/#{params[:domainId]}/rules/#{params[:ruleId]}/disable"

  @client.request(
    method: :put,
    path: path,
    query: query_params,
    headers: headers,
    body: body)
end
enable_rule(params = {}) click to toggle source

Enables an existing Rule

Authentication: The client must be configured with a valid api access token to call this action.

Parameters:

  • {string} domainId - The Domain name or the Domain id

  • {string} ruleId - The Rule id

Responses:

# File lib/mailinator_client/rules.rb, line 79
def enable_rule(params = {})
  params = Utils.symbolize_hash_keys(params)
  query_params = { }
  headers = {}
  body = nil

  raise ArgumentError.new("domain id is required") unless params.has_key?(:domainId)
  raise ArgumentError.new("rule id is required") unless params.has_key?(:ruleId)

  path = "/domains/#{params[:domainId]}/rules/#{params[:ruleId]}/enable"

  @client.request(
    method: :put,
    path: path,
    query: query_params,
    headers: headers,
    body: body)
end
get_all_rules(params = {}) click to toggle source

Fetches all Rules for a Domain.

Authentication: The client must be configured with a valid api access token to call this action.

Parameters:

  • {string} domainId - The Domain name or the Domain id

Responses:

# File lib/mailinator_client/rules.rb, line 140
def get_all_rules(params = {})
  params = Utils.symbolize_hash_keys(params)
  query_params = { }
  headers = {}
  body = nil

  raise ArgumentError.new("domain id is required") unless params.has_key?(:domainId)

  path = "/domains/#{params[:domainId]}/rules"

  @client.request(
    method: :get,
    path: path,
    query: query_params,
    headers: headers,
    body: body)
end
get_rule(params = {}) click to toggle source

Fetches a specific rule for a Domain.

Authentication: The client must be configured with a valid api access token to call this action.

Parameters:

  • {string} domainId - The Domain name or the Domain id

  • {string} ruleId - The Domain name or the Rule id

Responses:

# File lib/mailinator_client/rules.rb, line 170
def get_rule(params = {})
  params = Utils.symbolize_hash_keys(params)
  query_params = { }
  headers = {}
  body = nil

  raise ArgumentError.new("domain id is required") unless params.has_key?(:domainId)
  raise ArgumentError.new("rule id is required") unless params.has_key?(:ruleId)

  path = "/domains/#{params[:domainId]}/rules/#{params[:ruleId]}"

  @client.request(
    method: :get,
    path: path,
    query: query_params,
    headers: headers,
    body: body)
end