You can define container fields on your model class with container:
class Honeybee < FmRest::Layout
container :photo, field_name: "Beehive Photo ID"
container :resume, field_name: "Resume"
end:field_name specifies the original field in the FM layout and is optional, if
not given it will default to the name of your attribute (just :photo in this
example).
(Note that you don't need to define container fields with attributes in
addition to the container definition.)
This will provide you with the following instance methods:
bee = Honeybee.new
bee.photo.url # The URL of the container file on the FileMaker server
bee.photo.download # Download the contents of the container as an IO object
bee.photo.upload(filename_or_io) # Upload a file to the containerupload also accepts an options hash with the following options:
:repetition- Sets the field repetition:filename- The filename to use when uploading (defaults tofilename_or_io.original_filenameif available):content_type- The MIME content type to use (defaults toapplication/octet-stream)
bee.photo.upload(filename_or_io, repetition: 2, filename: "beauty_wings.png", content_type: "image/png")