Class: Mailtrap::SandboxesAPI
- Inherits:
-
Object
- Object
- Mailtrap::SandboxesAPI
- Includes:
- BaseAPI
- Defined in:
- lib/mailtrap/sandboxes_api.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes included from BaseAPI
Instance Method Summary collapse
-
#clean(sandbox_id) ⇒ Sandbox
Delete all messages (emails) from the sandbox.
-
#create(options) ⇒ Sandbox
Creates a new sandbox.
-
#delete(sandbox_id) ⇒ Hash?
Deletes a sandbox.
-
#get(sandbox_id) ⇒ Sandbox
Retrieves a specific sandbox.
-
#list ⇒ Array<Sandbox>
Lists all sandboxes for the account.
-
#mark_as_read(sandbox_id) ⇒ Sandbox
Mark all messages in the sandbox as read.
-
#reset_credentials(sandbox_id) ⇒ Sandbox
Reset SMTP credentials of the sandbox.
-
#reset_email_username(sandbox_id) ⇒ Sandbox
Reset username of email address per sandbox.
-
#toggle_email_username(sandbox_id) ⇒ Sandbox
Turn the email address of the sandbox on/off.
-
#update(sandbox_id, options) ⇒ Sandbox
Updates an existing sandbox.
Methods included from BaseAPI
Instance Method Details
#clean(sandbox_id) ⇒ Sandbox
Delete all messages (emails) from the sandbox
66 67 68 69 |
# File 'lib/mailtrap/sandboxes_api.rb', line 66 def clean(sandbox_id) response = client.patch("#{base_path}/#{sandbox_id}/clean") handle_response(response) end |
#create(options) ⇒ Sandbox
Creates a new sandbox
35 36 37 38 39 40 |
# File 'lib/mailtrap/sandboxes_api.rb', line 35 def create() (, + [:project_id]) response = client.post("/api/accounts/#{account_id}/projects/#{[:project_id]}/inboxes", wrap_request()) handle_response(response) end |
#delete(sandbox_id) ⇒ Hash?
Deletes a sandbox
46 47 48 |
# File 'lib/mailtrap/sandboxes_api.rb', line 46 def delete(sandbox_id) base_delete(sandbox_id) end |
#get(sandbox_id) ⇒ Sandbox
Retrieves a specific sandbox
24 25 26 |
# File 'lib/mailtrap/sandboxes_api.rb', line 24 def get(sandbox_id) base_get(sandbox_id) end |
#list ⇒ Array<Sandbox>
Lists all sandboxes for the account
16 17 18 |
# File 'lib/mailtrap/sandboxes_api.rb', line 16 def list base_list end |
#mark_as_read(sandbox_id) ⇒ Sandbox
Mark all messages in the sandbox as read
75 76 77 78 |
# File 'lib/mailtrap/sandboxes_api.rb', line 75 def mark_as_read(sandbox_id) response = client.patch("#{base_path}/#{sandbox_id}/all_read") handle_response(response) end |
#reset_credentials(sandbox_id) ⇒ Sandbox
Reset SMTP credentials of the sandbox
84 85 86 87 |
# File 'lib/mailtrap/sandboxes_api.rb', line 84 def reset_credentials(sandbox_id) response = client.patch("#{base_path}/#{sandbox_id}/reset_credentials") handle_response(response) end |
#reset_email_username(sandbox_id) ⇒ Sandbox
Reset username of email address per sandbox
102 103 104 105 |
# File 'lib/mailtrap/sandboxes_api.rb', line 102 def reset_email_username(sandbox_id) response = client.patch("#{base_path}/#{sandbox_id}/reset_email_username") handle_response(response) end |
#toggle_email_username(sandbox_id) ⇒ Sandbox
Turn the email address of the sandbox on/off
93 94 95 96 |
# File 'lib/mailtrap/sandboxes_api.rb', line 93 def toggle_email_username(sandbox_id) response = client.patch("#{base_path}/#{sandbox_id}/toggle_email_username") handle_response(response) end |
#update(sandbox_id, options) ⇒ Sandbox
Updates an existing sandbox
58 59 60 |
# File 'lib/mailtrap/sandboxes_api.rb', line 58 def update(sandbox_id, ) base_update(sandbox_id, , + [:email_username]) end |