tempmail44 0.1.0
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.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data/lib/tempmail44.rb +80 -0
- data.tar.gz.sig +0 -0
- metadata +70 -0
- metadata.gz.sig +3 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: df28f7880b8cfd15606086cea4da7d5b3747b4d0ec899d005b6306be5e7a2c1c
|
4
|
+
data.tar.gz: a08d192401e3c149888b9a0c0d3beb1f7a78e5276a7a2ea8bde837af89321047
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5aabc3c665ea69a720308aafa33af339461a4add116d57ac15e1d36e00752e3f8a190c1c6c872e062459c6947e4aa3a7da100ca3d458d3c1dadc4963ce4e6870
|
7
|
+
data.tar.gz: 74d438e1383a42753fe0414d61a28962c4889a253d849256523e92ff292643fdc1fb1621167f56668f46c8264669f34e38ddcb829f0873d7de6ca3313bafce09
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data/lib/tempmail44.rb
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# file: tempmail44.rb
|
4
|
+
|
5
|
+
# description: Uses the Temp Mail API to create a temporary email address
|
6
|
+
|
7
|
+
# notes:
|
8
|
+
# * You must sign up to Rapid API to use the service
|
9
|
+
# * API usage is free for low usage
|
10
|
+
# * Subscribe to the Temp Mail API from the Rapid API site
|
11
|
+
|
12
|
+
# see https://rapidapi.com/calvinloveland335703-0p6BxLYIH8f/api/temp-mail44/
|
13
|
+
|
14
|
+
require 'uri'
|
15
|
+
require 'net/http'
|
16
|
+
require 'openssl'
|
17
|
+
|
18
|
+
|
19
|
+
class TempMail44
|
20
|
+
|
21
|
+
attr_reader :email
|
22
|
+
|
23
|
+
def initialize(host: 'temp-mail44.p.rapidapi.com', apikey: '', debug: false)
|
24
|
+
|
25
|
+
@host, @apikey, @debug = host, apikey, debug
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
# create an email address
|
30
|
+
#
|
31
|
+
def create()
|
32
|
+
|
33
|
+
h = api('/api/v3/email/new', :post) do |request|
|
34
|
+
|
35
|
+
request["content-type"] = 'application/json'
|
36
|
+
request.body = "{\n \"key1\": \"value\",\n \"key2\": \"value\"\n}"
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
puts 'create() h: ' + h.inspect if @debug
|
41
|
+
|
42
|
+
@email = h[:email]
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
# read the inbox
|
47
|
+
#
|
48
|
+
# message fields: id, from, to, cc, subject, body_text, body_html,
|
49
|
+
# created_at, attachments
|
50
|
+
#
|
51
|
+
def read()
|
52
|
+
|
53
|
+
api("/api/v3/email/#{@email}/messages").map {|x| OpenStruct.new(x)}
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
private
|
58
|
+
|
59
|
+
def api(uri, type=:get)
|
60
|
+
|
61
|
+
url = URI('https://' + @host + uri)
|
62
|
+
puts 'api() url: ' + url.inspect if @debug
|
63
|
+
|
64
|
+
http = Net::HTTP.new(url.host, url.port)
|
65
|
+
http.use_ssl = true
|
66
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
67
|
+
|
68
|
+
request = type == :get ? Net::HTTP::Get.new(url) : Net::HTTP::Post.new(url)
|
69
|
+
request["X-RapidAPI-Host"] = @host
|
70
|
+
request["X-RapidAPI-Key"] = @apikey
|
71
|
+
|
72
|
+
yield(request) if block_given?
|
73
|
+
|
74
|
+
response = http.request(request)
|
75
|
+
JSON.parse(response.read_body, symbolize_names: true)
|
76
|
+
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
data.tar.gz.sig
ADDED
Binary file
|
metadata
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tempmail44
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- James Robertson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjIwNTI3MDY1ODU0WhcN
|
15
|
+
MjMwNTI3MDY1ODU0WjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
|
16
|
+
cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQCWoajF
|
17
|
+
tGM++AZV9cAfkSJ4mq/A4ZzsR9ofgiQSuiRBNAsuldYfxTvGZZIW/AXmbl6w9CGk
|
18
|
+
xBIs/M998jMPBwM4zkuQV6spor9l5fzgRj8YHCBPSqdriw+kFtJpjvhitM+UM/Oq
|
19
|
+
RJ0R/ScpbiaYWS2hwmHXoJGSYmCZw6I5cM0le5etpMSsBk3qI1ARWYfgngyDDXE5
|
20
|
+
OlrtWoKkM/wX3g5ZB0sHYuDk1xzTLKYo8oQQYDFe+QTTFs7u1nE8xq/2eOxlhoz+
|
21
|
+
1DbiGvB3tAb73ig3o3lUc71gzgdAw7XrbPPMPjOg98Uo1CSg0heqMaWq+o5cZr1C
|
22
|
+
bKQqGxOI+9Smg+A5rp6NdoaivuhF7zxlfdb5v9dmVLJwxGYNxWgtwF6r/AObEnkU
|
23
|
+
hWgmmAWSh4EI2DXoycKu2MfdKx3WRBQLHLgGm7kTWi/JEny8jBxpUUQHULX+rnqW
|
24
|
+
HjM3COE7sItGB9Jl6wA63GnBp7/Fj/zi1xN5fUzuEj4idAQkRzLlVH4yfg8CAwEA
|
25
|
+
AaOBijCBhzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUCIPosW24
|
26
|
+
Sib1NT2WaxbR8QeCtbMwJgYDVR0RBB8wHYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0
|
27
|
+
c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1hc3RlckBqYW1lc3JvYmVydHNvbi5ldTAN
|
28
|
+
BgkqhkiG9w0BAQsFAAOCAYEAFqTNqsS+BM0aXMqWod/9mSSIhJH5Vz3NGDhHZxSK
|
29
|
+
pt3cpdANYUGuKuBBU4wW3G4/hSMbrbcyekMR0fPiq85H4XSCtPmxnZQ+NHOQkls5
|
30
|
+
2HDgv30Q6U1tTSdxcAKObLzxhoCIIiAF9J80RVYFMy0yBxz2aQ2qBfDiLlmD2Jcv
|
31
|
+
Xb6JwwV6fBweoLfOYxhsszzNzqgFvGALjt/PgVlhHCXBD6CEUH7uCBRDqj5S4FMB
|
32
|
+
Sxf02gcf1jdXcu7gub0KIuV94u0CmzYP6QSWSbA2lsXiICvo+Snn5fdxQDlK3Ncb
|
33
|
+
PMVHogD5B32riWuVFzjkQC970r7/2FMKlE3caiENzW4H9ZDXvEP6NJ1f3iV+NvE3
|
34
|
+
b8oQI3uyxc8tHi4SPUW4ECaU7PHfIH9aXzFg/mt6OCMDbyys4MeG8ZEnqeskUSDc
|
35
|
+
jrBzFztmfRMSB/OGGA+vTE6YOFNc/WZrrEukOa2gNgYqaR1Vuvbe+8hhpdLYgMQM
|
36
|
+
wwPI6OaBZx8qWLUmvzKzO3hV
|
37
|
+
-----END CERTIFICATE-----
|
38
|
+
date: 2022-05-27 00:00:00.000000000 Z
|
39
|
+
dependencies: []
|
40
|
+
description:
|
41
|
+
email: digital.robertson@gmail.com
|
42
|
+
executables: []
|
43
|
+
extensions: []
|
44
|
+
extra_rdoc_files: []
|
45
|
+
files:
|
46
|
+
- lib/tempmail44.rb
|
47
|
+
homepage: https://github.com/jrobertson/tempmail44
|
48
|
+
licenses:
|
49
|
+
- MIT
|
50
|
+
metadata: {}
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options: []
|
53
|
+
require_paths:
|
54
|
+
- lib
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
requirements: []
|
66
|
+
rubygems_version: 3.2.22
|
67
|
+
signing_key:
|
68
|
+
specification_version: 4
|
69
|
+
summary: Uses the Temp Mail API to create a temporary email address.
|
70
|
+
test_files: []
|
metadata.gz.sig
ADDED