Class: SurgeAPI::Resources::Attachments

Inherits:
Object
  • Object
show all
Defined in:
lib/surge_api/resources/attachments.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Attachments

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Attachments.

Parameters:



30
31
32
# File 'lib/surge_api/resources/attachments.rb', line 30

def initialize(client:)
  @client = client
end

Instance Method Details

#get_file(attachment_id, request_options: {}) ⇒ SurgeAPI::Models::AttachmentGetFileResponse

Redirects to a signed URL where the attachment file can be downloaded. URL is short-lived, so redirect should be followed immediately.

Parameters:

  • attachment_id (String)

    The ID of the attachment.

  • request_options (SurgeAPI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



18
19
20
21
22
23
24
25
# File 'lib/surge_api/resources/attachments.rb', line 18

def get_file(attachment_id, params = {})
  @client.request(
    method: :get,
    path: ["attachments/%1$s/file", attachment_id],
    model: SurgeAPI::Models::AttachmentGetFileResponse,
    options: params[:request_options]
  )
end