Class: MailinatorClient::Rules

Inherits:
Object
  • Object
show all
Defined in:
lib/mailinator_client/rules.rb

Overview

Class containing all the actions for the Rules Resource

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Rules

Returns a new instance of Rules.



8
9
10
# File 'lib/mailinator_client/rules.rb', line 8

def initialize(client)
  @client = client
end

Instance Method Details

#create_rule(params = {}) ⇒ Object

Deprecated.

Rules endpoints are deprecated in this client.

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:

Raises:

  • (ArgumentError)


25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/mailinator_client/rules.rb', line 25

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 = {}) ⇒ Object

Deprecated.

Rules endpoints are deprecated in this client.

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:

Raises:

  • (ArgumentError)


185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/mailinator_client/rules.rb', line 185

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 = {}) ⇒ Object

Deprecated.

Rules endpoints are deprecated in this client.

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:

Raises:

  • (ArgumentError)


91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/mailinator_client/rules.rb', line 91

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 = {}) ⇒ Object

Deprecated.

Rules endpoints are deprecated in this client.

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:

Raises:

  • (ArgumentError)


59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/mailinator_client/rules.rb', line 59

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 = {}) ⇒ Object

Deprecated.

Rules endpoints are deprecated in this client.

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:

Raises:

  • (ArgumentError)


122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/mailinator_client/rules.rb', line 122

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 = {}) ⇒ Object

Deprecated.

Rules endpoints are deprecated in this client.

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:

Raises:

  • (ArgumentError)


153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/mailinator_client/rules.rb', line 153

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