Class: DevinApi::Resources::Attachment

Inherits:
Base
  • Object
show all
Defined in:
lib/devin_api/resources/attachment.rb

Overview

Attachment resource for the Devin API

Instance Attribute Summary

Attributes inherited from Base

#attributes, #client

Instance Method Summary collapse

Methods inherited from Base

#[], #[]=, create, #id, #initialize, #method_missing, pagination_supported?, resource_name, resource_path, #respond_to_missing?, #to_hash

Constructor Details

This class inherits a constructor from DevinApi::Resources::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class DevinApi::Resources::Base

Instance Method Details

#path ⇒ Object



9
10
11
# File 'lib/devin_api/resources/attachment.rb', line 9

def path
  '/v1/attachments'
end

#upload_file(file) ⇒ String

Upload a file for Devin to work with during sessions

Parameters:

  • file (File) —

    File object to upload

Returns:

  • (String) —

    URL where the uploaded file can be accessed

See Also:



18
19
20
21
22
# File 'lib/devin_api/resources/attachment.rb', line 18

def upload_file(file)
  payload = { file: Faraday::UploadIO.new(file.path, 'application/octet-stream', File.basename(file.path)) }

  client.connection.post(path, payload).body
end