Class: Mailtrap::InboundInboxesAPI
- Inherits:
-
Object
- Object
- Mailtrap::InboundInboxesAPI
- Includes:
- BaseAPI
- Defined in:
- lib/mailtrap/inbound_inboxes_api.rb
Constant Summary collapse
- CREATE_OPTIONS =
%i[name domain_id].freeze
- UPDATE_OPTIONS =
%i[name].freeze
Instance Attribute Summary
Attributes included from BaseAPI
Instance Method Summary collapse
-
#create(folder_id, options) ⇒ InboundInbox
Creates a new inbox in a folder.
-
#delete(folder_id, inbox_id) ⇒ Object
Deletes an inbox.
-
#get(folder_id, inbox_id) ⇒ InboundInbox
Retrieves a specific inbox.
-
#initialize(client = Mailtrap::Client.new) ⇒ InboundInboxesAPI
constructor
A new instance of InboundInboxesAPI.
-
#list(folder_id) ⇒ Array<InboundInbox>
Lists all inboxes in a folder.
-
#update(folder_id, inbox_id, options) ⇒ InboundInbox
Updates an inbox.
Methods included from BaseAPI
Constructor Details
#initialize(client = Mailtrap::Client.new) ⇒ InboundInboxesAPI
Returns a new instance of InboundInboxesAPI.
16 17 18 |
# File 'lib/mailtrap/inbound_inboxes_api.rb', line 16 def initialize(client = Mailtrap::Client.new) @client = client end |
Instance Method Details
#create(folder_id, options) ⇒ InboundInbox
Creates a new inbox in a folder
45 46 47 48 |
# File 'lib/mailtrap/inbound_inboxes_api.rb', line 45 def create(folder_id, ) (, CREATE_OPTIONS) handle_response(client.post(inboxes_path(folder_id), )) end |
#delete(folder_id, inbox_id) ⇒ Object
Deletes an inbox
68 69 70 |
# File 'lib/mailtrap/inbound_inboxes_api.rb', line 68 def delete(folder_id, inbox_id) client.delete("#{inboxes_path(folder_id)}/#{inbox_id}") end |
#get(folder_id, inbox_id) ⇒ InboundInbox
Retrieves a specific inbox
33 34 35 |
# File 'lib/mailtrap/inbound_inboxes_api.rb', line 33 def get(folder_id, inbox_id) handle_response(client.get("#{inboxes_path(folder_id)}/#{inbox_id}")) end |
#list(folder_id) ⇒ Array<InboundInbox>
Lists all inboxes in a folder
24 25 26 |
# File 'lib/mailtrap/inbound_inboxes_api.rb', line 24 def list(folder_id) client.get(inboxes_path(folder_id)).map { |item| handle_response(item) } end |
#update(folder_id, inbox_id, options) ⇒ InboundInbox
Updates an inbox
58 59 60 61 |
# File 'lib/mailtrap/inbound_inboxes_api.rb', line 58 def update(folder_id, inbox_id, ) (, UPDATE_OPTIONS) handle_response(client.patch("#{inboxes_path(folder_id)}/#{inbox_id}", )) end |