Class: Mailtrap::SandboxAttachmentsAPI

Inherits:
Object
  • Object
show all
Includes:
BaseAPI
Defined in:
lib/mailtrap/sandbox_attachments_api.rb

Instance Attribute Summary collapse

Attributes included from BaseAPI

#account_id, #client

Instance Method Summary collapse

Methods included from BaseAPI

included

Constructor Details

#initialize(account_id, sandbox_id, sandbox_message_id, client = Mailtrap::Client.new) ⇒ SandboxAttachmentsAPI

Returns a new instance of SandboxAttachmentsAPI.

Parameters:

  • account_id (Integer) —

    The account ID

  • sandbox_id (Integer) —

    The sandbox ID

  • sandbox_message_id (Integer) —

    The message ID

  • client (Mailtrap::Client) (defaults to: Mailtrap::Client.new) —

    The client instance

Raises:

  • (ArgumentError) —

    If account_id is nil

  • (ArgumentError) —

    If sandbox_id is nil



21
22
23
24
25
26
27
28
29
# File 'lib/mailtrap/sandbox_attachments_api.rb', line 21

def initialize(, sandbox_id, sandbox_message_id, client = Mailtrap::Client.new)
  raise ArgumentError, 'sandbox_id is required' if sandbox_id.nil?
  raise ArgumentError, 'sandbox_message_id is required' if sandbox_message_id.nil?

  @sandbox_id = sandbox_id
  @sandbox_message_id = sandbox_message_id

  super(, client)
end

Instance Attribute Details

#sandbox_id ⇒ Object (readonly)

Returns the value of attribute sandbox_id.



11
12
13
# File 'lib/mailtrap/sandbox_attachments_api.rb', line 11

def sandbox_id
  @sandbox_id
end

#sandbox_message_id ⇒ Object (readonly)

Returns the value of attribute sandbox_message_id.



11
12
13
# File 'lib/mailtrap/sandbox_attachments_api.rb', line 11

def sandbox_message_id
  @sandbox_message_id
end

Instance Method Details

#get(sandbox_attachment_id) ⇒ SandboxAttachment

Retrieves a specific sandbox attachment

Parameters:

  • sandbox_attachment_id (Integer) —

    The sandbox attachment ID

Returns:

Raises:



42
43
44
# File 'lib/mailtrap/sandbox_attachments_api.rb', line 42

def get(sandbox_attachment_id)
  base_get(sandbox_attachment_id)
end

#inbox_id ⇒ Integer

Deprecated.

Use #sandbox_id instead.

Returns The sandbox ID.

Returns:

  • (Integer) —

    The sandbox ID



33
34
35
36
# File 'lib/mailtrap/sandbox_attachments_api.rb', line 33

def inbox_id
  Deprecation.warn('Mailtrap::SandboxAttachmentsAPI#inbox_id', 'Mailtrap::SandboxAttachmentsAPI#sandbox_id')
  sandbox_id
end

#list ⇒ Array<SandboxAttachment>

Lists all sandbox attachments for a message, limited up to 30 at once

Returns:

Raises:



49
50
51
# File 'lib/mailtrap/sandbox_attachments_api.rb', line 49

def list
  base_list
end