mailinator_client 1.0.3 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,165 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2024 Manybrain, Inc.
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+
23
+ require "json"
24
+
25
+ module MailinatorClient
26
+
27
+ # Class containing all the actions for the Authenticators Resource
28
+ class Authenticators
29
+
30
+ def initialize(client)
31
+ @client = client
32
+ end
33
+
34
+ # Instant TOTP 2FA code
35
+ #
36
+ # Authentication:
37
+ # The client must be configured with a valid api
38
+ # access token to call this action.
39
+ #
40
+ # Parameters:
41
+ # * {string} totpSecretKey - totp secret key
42
+ #
43
+ # Responses:
44
+ # * Instant TOTP 2FA Code info (https://manybrain.github.io/m8rdocs/#instant-totp-2fa-code)
45
+ def instant_totp_2fa_code(params = {})
46
+ query_params = {}
47
+ headers = {}
48
+ body = nil
49
+
50
+ raise ArgumentError.new("totpSecretKey is required") unless params.has_key?(:totpSecretKey)
51
+
52
+ path = "/totp/#{params[:totpSecretKey]}"
53
+
54
+ response = @client.request(
55
+ method: :get,
56
+ path: path,
57
+ query: query_params,
58
+ headers: headers,
59
+ body: body)
60
+ end
61
+
62
+ # Fetch Authenticators
63
+ #
64
+ # Authentication:
65
+ # The client must be configured with a valid api
66
+ # access token to call this action.
67
+ #
68
+ # Responses:
69
+ # * Collection of passcodes (https://manybrain.github.io/m8rdocs/#fetch-authenticators)
70
+ def get_authenticators()
71
+ query_params = {}
72
+ headers = {}
73
+ body = nil
74
+
75
+ path = "/authenticators"
76
+
77
+ response = @client.request(
78
+ method: :get,
79
+ path: path,
80
+ query: query_params,
81
+ headers: headers,
82
+ body: body)
83
+ end
84
+
85
+ # Fetch the TOTP 2FA code from one of your saved Keys
86
+ #
87
+ # Authentication:
88
+ # The client must be configured with a valid api
89
+ # access token to call this action.
90
+ #
91
+ # Parameters:
92
+ # * {string} id - authenticator id
93
+ #
94
+ # Responses:
95
+ # * Authenticator (https://manybrain.github.io/m8rdocs/#fetch-authenticators-by-id)
96
+ def get_authenticators_by_id(params = {})
97
+ query_params = {}
98
+ headers = {}
99
+ body = nil
100
+
101
+ raise ArgumentError.new("id is required") unless params.has_key?(:id)
102
+
103
+ path = "/authenticators/#{params[:id]}"
104
+
105
+ response = @client.request(
106
+ method: :get,
107
+ path: path,
108
+ query: query_params,
109
+ headers: headers,
110
+ body: body)
111
+ end
112
+
113
+ # Fetch Authenticator
114
+ #
115
+ # Authentication:
116
+ # The client must be configured with a valid api
117
+ # access token to call this action.
118
+ #
119
+ # Responses:
120
+ # * Collection of passcodes (https://manybrain.github.io/m8rdocs/#fetch-authenticator)
121
+ def get_authenticator()
122
+ query_params = {}
123
+ headers = {}
124
+ body = nil
125
+
126
+ path = "/authenticator"
127
+
128
+ response = @client.request(
129
+ method: :get,
130
+ path: path,
131
+ query: query_params,
132
+ headers: headers,
133
+ body: body)
134
+ end
135
+
136
+ # Fetch Authenticator By Id
137
+ #
138
+ # Authentication:
139
+ # The client must be configured with a valid api
140
+ # access token to call this action.
141
+ #
142
+ # Parameters:
143
+ # * {string} id - authenticator id
144
+ #
145
+ # Responses:
146
+ # * Authenticator (https://manybrain.github.io/m8rdocs/#fetch-authenticator-by-id)
147
+ def get_authenticator_by_id(params = {})
148
+ query_params = {}
149
+ headers = {}
150
+ body = nil
151
+
152
+ raise ArgumentError.new("id is required") unless params.has_key?(:id)
153
+
154
+ path = "/authenticator/#{params[:id]}"
155
+
156
+ response = @client.request(
157
+ method: :get,
158
+ path: path,
159
+ query: query_params,
160
+ headers: headers,
161
+ body: body)
162
+ end
163
+
164
+ end
165
+ end
@@ -1,6 +1,6 @@
1
1
  # The MIT License (MIT)
2
2
  #
3
- # Copyright (c) 2020 Manybrain, Inc.
3
+ # Copyright (c) 2024 Manybrain, Inc.
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the "Software"), to deal
@@ -23,6 +23,7 @@
23
23
  require "httparty"
24
24
 
25
25
  module MailinatorClient
26
+ require_relative 'version'
26
27
  # Mailinator API
27
28
  #
28
29
  # User API for accessing Mailinator data
@@ -31,7 +32,11 @@ module MailinatorClient
31
32
 
32
33
  def initialize(options = {})
33
34
  @auth_token = options.fetch(:auth_token, nil)
34
- @url = "https://mailinator.com/api/v2"
35
+ @url = "https://api.mailinator.com/api/v2"
36
+ end
37
+
38
+ def authenticators
39
+ @authenticators ||= Authenticators.new(self)
35
40
  end
36
41
 
37
42
  def domains
@@ -50,12 +55,17 @@ module MailinatorClient
50
55
  @rules ||= Rules.new(self)
51
56
  end
52
57
 
58
+ def webhooks
59
+ @webhooks ||= Webhooks.new(self)
60
+ end
61
+
53
62
  def request(options = {})
54
63
  headers = options.fetch(:headers, {})
55
64
  method = options.fetch(:method, :get)
56
65
 
57
66
  headers["Accept"] = "application/json"
58
67
  headers["Content-Type"] = "application/json"
68
+ headers["User-Agent"] = "Mailinator SDK - Ruby V#{MailinatorClient::VERSION}"
59
69
  headers["Authorization"] = @auth_token if @auth_token
60
70
  path = @url + options.fetch(:path, "")
61
71
 
@@ -1,6 +1,6 @@
1
1
  # The MIT License (MIT)
2
2
  #
3
- # Copyright (c) 2020 Manybrain, Inc.
3
+ # Copyright (c) 2024 Manybrain, Inc.
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the "Software"), to deal
@@ -83,5 +83,64 @@ module MailinatorClient
83
83
  body: body)
84
84
  end
85
85
 
86
+ # This endpoint creates a private domain attached to your account.
87
+ # Note, the domain must be unique to the system and you must have not reached your maximum number of Private Domains.
88
+ #
89
+ # Authentication:
90
+ # The client must be configured with a valid api
91
+ # access token to call this action.
92
+ #
93
+ # Parameters:
94
+ # * {string} domainId - The Domain name
95
+ #
96
+ # Responses:
97
+ # * Status (https://manybrain.github.io/m8rdocs/#create-domain)
98
+ def create_domain(params = {})
99
+ params = Utils.symbolize_hash_keys(params)
100
+ query_params = { }
101
+ headers = {}
102
+ body = nil
103
+
104
+ raise ArgumentError.new("domain id is required") unless params.has_key?(:domainId)
105
+
106
+ path = "/domains/#{params[:domainId]}"
107
+
108
+ @client.request(
109
+ method: :post,
110
+ path: path,
111
+ query: query_params,
112
+ headers: headers,
113
+ body: body)
114
+ end
115
+
116
+ # This endpoint deletes a Private Domain
117
+ #
118
+ # Authentication:
119
+ # The client must be configured with a valid api
120
+ # access token to call this action.
121
+ #
122
+ # Parameters:
123
+ # * {string} domainId - The Domain name or the Domain id
124
+ #
125
+ # Responses:
126
+ # * Status (https://manybrain.github.io/m8rdocs/#delete-domain)
127
+ def delete_domain(params = {})
128
+ params = Utils.symbolize_hash_keys(params)
129
+ query_params = { }
130
+ headers = {}
131
+ body = nil
132
+
133
+ raise ArgumentError.new("domain id is required") unless params.has_key?(:domainId)
134
+
135
+ path = "/domains/#{params[:domainId]}"
136
+
137
+ @client.request(
138
+ method: :delete,
139
+ path: path,
140
+ query: query_params,
141
+ headers: headers,
142
+ body: body)
143
+ end
144
+
86
145
  end
87
146
  end
@@ -1,6 +1,6 @@
1
1
  # The MIT License (MIT)
2
2
  #
3
- # Copyright (c) 2020 Manybrain, Inc.
3
+ # Copyright (c) 2024 Manybrain, Inc.
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the "Software"), to deal