<aside> 👉 Links (Object base class)

CommentObject

FileObject

TextObject

EmojiObject

FileUploadObject

UserObject

EquationObject

MentionObject

Notion Ruby Mapping Public API Reference

</aside>

1. Constructor

FileUploadObject.new(fname:, external_url: nil) → FileUploadObject

# Create a FileUploadObject by specifying a local filename
# If the file size exceeds 10MB, it will be automatically divided into 10MB parts and sent as multipart within the framework
fuo_by_file = FileUploadObject.new fname: "test.png"
=> #<FileUploadObject:XXXXXXXXXXXXXXXXXXX

# When an external URL is specified, Notion's server automatically imports it
fuo_by_url = FileUploadObject.new fname: "test.mp4", external_url: "https://..../test.mp4"
=> #<FileUploadObject:YYYYYYYYYYYYYYYYY

# You can verify the upload completion by checking the status with reload. (for external URL only)
while fuo_by_url.reload.status == "pending"
  sleep 15
end

2. Instance methods

reload

Reloads to update the file upload status.

fuo_by_url.reload
=> #<FileUploadObject:YYYYYYYYYYYYYYYYY

status → str

Checks the file upload status.

fuo_by_url.status
=> "pending"
fuo_by_url.reload.status
=> "uploaded"