Class: MailinatorClient::Domains

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

Overview

Class containing all the actions for the Domains Resource

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Domains

Returns a new instance of Domains.



30
31
32
# File 'lib/mailinator_client/domains.rb', line 30

def initialize(client)
  @client = client
end

Instance Method Details

#create_domain(params = {}) ⇒ Object

This endpoint creates a private domain attached to your account. Note, the domain must be unique to the system and you must have not reached your maximum number of Private Domains.

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

Parameters:

  • string domainId - The Domain name

Responses:

Raises:

  • (ArgumentError)


98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/mailinator_client/domains.rb', line 98

def create_domain(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]}"

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

#delete_domain(params = {}) ⇒ Object

This endpoint deletes a Private 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)


127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/mailinator_client/domains.rb', line 127

def delete_domain(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]}"

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

#get_domain(params = {}) ⇒ Object

Fetches a specific 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)


68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/mailinator_client/domains.rb', line 68

def get_domain(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]}"

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

#get_domainsObject

Fetches a list of all your domains.

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

Responses:



42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/mailinator_client/domains.rb', line 42

def get_domains()
  query_params = {}
  headers = {}
  body = nil

  path = "/domains"

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