gettestmail 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +27 -27
- data/lib/models/attachment.rb +2 -2
- data/lib/models/get_test_mail.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4c995c040bc6afe8feff85a2ffbe83664c1e156b4ceffa401e27409f292ff39
|
4
|
+
data.tar.gz: 04dd8d859497d7c323a00b2f3e24cf228ffa01391104a9561db7a369c57c41c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f5b6feb878a02573d9f9fb3d807ef050bc4ca138e6358130dfe972fcf11aaeaf8bf58d1dd8cdaa0707b165c9afb9c18a00124ced22898259a1fadb9f2827150
|
7
|
+
data.tar.gz: dabd6f5ffdc8cee4127b687838135c19fe8827cef871cd1466836a77c893658f78316e3624d838792c60ee5cfbcd7b0963adb555e9cc53fa7862f2d8123386f7
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# ruby-sdk
|
2
2
|
|
3
|
-
A Ruby client for interacting with the GetTestMail API, which
|
3
|
+
A Ruby client for interacting with the GetTestMail API, which provides a simple way to create temporary email addresses and receive messages sent to them.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -23,8 +23,8 @@ $ gem install gettestmail
|
|
23
23
|
|
24
24
|
## Usage
|
25
25
|
|
26
|
-
Creating a New Client
|
27
|
-
To create a new GetTestMail API client, you need to instantiate the GetTestMailClient class with your API key
|
26
|
+
### Creating a New Client
|
27
|
+
To create a new GetTestMail API client, you need to instantiate the GetTestMailClient class with your API key. To get an API key, sign up for a free [account](https://gettestmail.com).
|
28
28
|
|
29
29
|
```ruby
|
30
30
|
require 'gettestmailclient'
|
@@ -33,17 +33,20 @@ api_key = 'your-api-key'
|
|
33
33
|
client = GetTestMailClient.new(api_key)
|
34
34
|
```
|
35
35
|
|
36
|
-
Creating a New GetTestMail Instance
|
36
|
+
### Creating a New GetTestMail Instance
|
37
37
|
To create a new GetTestMail instance, call the create_new method on the client:
|
38
38
|
|
39
39
|
```ruby
|
40
40
|
get_test_mail = client.create_new
|
41
41
|
puts "Email address: #{get_test_mail.email_address}"
|
42
42
|
puts "Expires at: #{get_test_mail.expires_at}"
|
43
|
-
|
44
|
-
|
43
|
+
```
|
44
|
+
|
45
|
+
### Waiting for a Message
|
46
|
+
To wait for a message, call the wait_for_message method with the email address:
|
45
47
|
|
46
|
-
|
48
|
+
```ruby
|
49
|
+
message = client.wait_for_message(get_test_mail.id)
|
47
50
|
puts "Message from: #{message.from}"
|
48
51
|
puts "Message subject: #{message.subject}"
|
49
52
|
puts "Message: #{message}"
|
@@ -55,34 +58,31 @@ puts "Message: #{message}"
|
|
55
58
|
|
56
59
|
The GetTestMail model represents a disposable email address. It has the following attributes:
|
57
60
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
61
|
+
* id - The id of the email address
|
62
|
+
* emailAddress - The email address
|
63
|
+
* expiresAt - The time at which the email address will expire
|
64
|
+
* message - The message received by the email address
|
62
65
|
|
63
66
|
### Message
|
64
67
|
|
65
|
-
The Message
|
68
|
+
The Message received by the email address. It has the following attributes:
|
66
69
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
attachments: An array of Attachment objects.
|
75
|
-
```
|
70
|
+
* id - The id of the message
|
71
|
+
* from - The sender of the message
|
72
|
+
* to - The recipient of the message
|
73
|
+
* subject - The subject of the message
|
74
|
+
* text - Text representation of the message
|
75
|
+
* html - HTML representation of the message
|
76
|
+
* attachments - List of attachments
|
76
77
|
|
77
78
|
### Attachment
|
78
79
|
|
79
|
-
The Attachment
|
80
|
+
The Attachment received by the email address. It has the following attributes:
|
81
|
+
|
82
|
+
* filename - The filename of the attachment
|
83
|
+
* mimeType - The mime type of the attachment
|
84
|
+
* content - The content of the attachment
|
80
85
|
|
81
|
-
```
|
82
|
-
filename: The name of the attached file.
|
83
|
-
mime_type: The MIME type of the attached file.
|
84
|
-
content: The content of the attached file.
|
85
|
-
```
|
86
86
|
|
87
87
|
## Error Handling
|
88
88
|
|
data/lib/models/attachment.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
class Attachment
|
2
|
-
attr_accessor :filename, :
|
2
|
+
attr_accessor :filename, :mimeType, :content
|
3
3
|
|
4
4
|
def initialize(json)
|
5
5
|
json.each { |key, value| instance_variable_set("@#{key}", value) }
|
6
6
|
end
|
7
7
|
|
8
8
|
def to_s
|
9
|
-
"Name: #{filename}, Mime-Type: #{
|
9
|
+
"Name: #{filename}, Mime-Type: #{mimeType}"
|
10
10
|
end
|
11
11
|
end
|
data/lib/models/get_test_mail.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gettestmail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bobby Donchev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|