gettestmail 1.0.0 → 1.0.2
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 +4 -4
- data/README.md +94 -1
- data/lib/models/attachment.rb +2 -2
- data/lib/models/get_test_mail.rb +1 -1
- metadata +3 -3
- /data/lib/{client.rb → gettestmailclient.rb} +0 -0
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,2 +1,95 @@
|
|
1
1
|
# ruby-sdk
|
2
|
-
|
2
|
+
|
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
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'gettestmail'
|
10
|
+
|
11
|
+
|
12
|
+
And then execute:
|
13
|
+
|
14
|
+
```
|
15
|
+
$ bundle install
|
16
|
+
```
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
```
|
21
|
+
$ gem install gettestmail
|
22
|
+
```
|
23
|
+
|
24
|
+
## Usage
|
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. To get an API key, sign up for a free [account](https://gettestmail.com).
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
require 'gettestmailclient'
|
31
|
+
|
32
|
+
api_key = 'your-api-key'
|
33
|
+
client = GetTestMailClient.new(api_key)
|
34
|
+
```
|
35
|
+
|
36
|
+
### Creating a New GetTestMail Instance
|
37
|
+
To create a new GetTestMail instance, call the create_new method on the client:
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
get_test_mail = client.create_new
|
41
|
+
puts "Email address: #{get_test_mail.email_address}"
|
42
|
+
puts "Expires at: #{get_test_mail.expires_at}"
|
43
|
+
```
|
44
|
+
|
45
|
+
### Waiting for a Message
|
46
|
+
To wait for a message, call the wait_for_message method with the email address:
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
message = client.wait_for_message(get_test_mail.id)
|
50
|
+
puts "Message from: #{message.from}"
|
51
|
+
puts "Message subject: #{message.subject}"
|
52
|
+
puts "Message: #{message}"
|
53
|
+
```
|
54
|
+
|
55
|
+
## Models
|
56
|
+
|
57
|
+
### GetTestMail
|
58
|
+
|
59
|
+
The GetTestMail model represents a disposable email address. It has the following attributes:
|
60
|
+
|
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
|
65
|
+
|
66
|
+
### Message
|
67
|
+
|
68
|
+
The Message received by the email address. It has the following attributes:
|
69
|
+
|
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
|
77
|
+
|
78
|
+
### Attachment
|
79
|
+
|
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
|
85
|
+
|
86
|
+
|
87
|
+
## Error Handling
|
88
|
+
|
89
|
+
|
90
|
+
If the API returns an error, the client will raise an ApiError exception with a ProblemDTO object containing error details.
|
91
|
+
|
92
|
+
|
93
|
+
License
|
94
|
+
|
95
|
+
This gem is available as open-source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
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
|
@@ -36,7 +36,7 @@ files:
|
|
36
36
|
- LICENSE
|
37
37
|
- README.md
|
38
38
|
- lib/api_error.rb
|
39
|
-
- lib/
|
39
|
+
- lib/gettestmailclient.rb
|
40
40
|
- lib/models/attachment.rb
|
41
41
|
- lib/models/base_dto.rb
|
42
42
|
- lib/models/get_test_mail.rb
|
File without changes
|