Class: MailinatorClient::Authenticators

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

Overview

Class containing all the actions for the Authenticators Resource

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Authenticators

Returns a new instance of Authenticators.



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

def initialize(client)
  @client = client
end

Instance Method Details

#get_authenticatorObject

Fetch Authenticator

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

Responses:



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

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

  path = "/authenticator"

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

#get_authenticator_by_id(params = {}) ⇒ Object

Fetch Authenticator By Id

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

Parameters:

  • string id - authenticator id

Responses:

Raises:

  • (ArgumentError)


125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/mailinator_client/authenticators.rb', line 125

def get_authenticator_by_id(params = {})
  query_params = {}
  headers = {}
  body = nil

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

  path = "/authenticator/#{params[:id]}"

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

#get_authenticatorsObject

Fetch Authenticators

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

Responses:



48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/mailinator_client/authenticators.rb', line 48

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

  path = "/authenticators"

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

#get_authenticators_by_id(params = {}) ⇒ Object

Fetch the TOTP 2FA code from one of your saved Keys

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

Parameters:

  • string id - authenticator id

Responses:

Raises:

  • (ArgumentError)


74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/mailinator_client/authenticators.rb', line 74

def get_authenticators_by_id(params = {})
  query_params = {}
  headers = {}
  body = nil

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

  path = "/authenticators/#{params[:id]}"

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

#instant_totp_2fa_code(params = {}) ⇒ Object

Instant TOTP 2FA code

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

Parameters:

  • string totpSecretKey - totp secret key

Responses:

Raises:

  • (ArgumentError)


23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/mailinator_client/authenticators.rb', line 23

def instant_totp_2fa_code(params = {})
  query_params = {}
  headers = {}
  body = nil

  raise ArgumentError.new("totpSecretKey is required") unless params.has_key?(:totpSecretKey)

  path = "/totp/#{params[:totpSecretKey]}"

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