Module: EmailFuse::Emails::Attachments
- Defined in:
- lib/email_fuse/emails/attachments.rb
Overview
Module for sent email attachments API operations
Class Method Summary collapse
-
.get(params = {}) ⇒ Hash
Retrieve a single attachment from a sent email.
-
.list(params = {}) ⇒ Hash
List attachments from a sent email with optional pagination.
Class Method Details
.get(params = {}) ⇒ Hash
Retrieve a single attachment from a sent email
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/email_fuse/emails/attachments.rb', line 20 def get(params = {}) = params[:id] email_id = params[:email_id] raise ArgumentError, ":email_id is required" if email_id.nil? || email_id.to_s.empty? raise ArgumentError, ":id is required" if .nil? || .to_s.empty? path = "emails/#{email_id}/attachments/#{}" EmailFuse::Request.new(path, {}, "get").perform end |
.list(params = {}) ⇒ Hash
List attachments from a sent email with optional pagination
57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/email_fuse/emails/attachments.rb', line 57 def list(params = {}) email_id = params[:email_id] raise ArgumentError, ":email_id is required" if email_id.nil? || email_id.to_s.empty? base_path = "emails/#{email_id}/attachments" # Extract pagination parameters pagination_params = params.slice(:limit, :after, :before) path = EmailFuse::PaginationHelper.build_paginated_path(base_path, pagination_params) EmailFuse::Request.new(path, {}, "get").perform end |