The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::API::Gett::File - Gett file object

PURPOSE

Encapsulate Gett files. You normally shouldn't instantiate this class on its own, as the library will create and return this object as appropriate.

ATTRIBUTES

These are read only attributes unless otherwise noted.

filename

Scalar string.

fileid

Scalar string.

downloads

Scalar integer. The number of times this particular file has been downloaded

readystate

Scalar string. Signifies the state a particular file is in. See the Gett developer docs for more information.

getturl

Scalar string. The URL to use in a browser to access a file.

download

Scalar string. The URL to use to get the file contents.

size

Scalar integer. The size in bytes of this file.

created

Scalar integer. The Unix epoch time when this file was created in Gett. This value is suitable for use in localtime().

sharename

Scalar string. The share in which this file lives inside.

put_upload_url

Scalar string. The url to use to upload the contents of this file using the PUT method. (This attribute is only populated during certain times.)

post_upload_url

Scalar string. This url to use to upload the contents of this file using the POST method. (This attribute is only populated during certain times.)

chunk_size

Scalar integer. This is the chunk size to use for file uploads. It defaults to 1,048,576 bytes (1 MB). This attribute is read-only.

user

Net::API::Gett::User object. has_user() predicate.

request

Net::API::Gett::Request object.

METHODS

send_file()

This method actually uploads the file to the Gett service. This method is normally invoked by the upload_file() method, but it might be useful in combination with get_upload_url(). It takes the following parameters:

  • a Gett put upload url

  • data

    a scalar representing the file contents which can be one of: a buffer, an IO::Handle object, or a file pathname.

  • encoding

    an encoding scheme. By default, it uses :raw.

  • chunk_size

    The maximum chunksize to load into to memory at one time. If the file to transmit is larger than this size, it will be dynamically streamed.

Returns a true value on success.

get_upload_url()

This method returns a scalar PUT upload URL for the specified sharename/fileid parameters. Potentially useful in combination with send_file().

destroy()

This method destroys the file represented by the object. Returns a true value on success.

contents()

This method retrieves the contents of a this file in the Gett service. You are responsible for outputting the file (if desired) with any appropriate encoding. Does not require an access token.

thumbnail()

This method returns a thumbnail if the file in Gett is an image. Does not require an access token, but is really only meaningful if the data is a valid image format file.

SEE ALSO

Net::API::Gett