class Emarsys::File

Methods for the File API

Public Class Methods

collection(account: nil, **params) click to toggle source

List files

@param params [Hash] optional search params @option params [Integer, String] :folder filter by folder @return [Hash] List of files @example

Emarsys::File.collection
Emarsys::File.collection(:folder => 3)
# File lib/emarsys/data_objects/file.rb, line 18
def collection(account: nil, **params)
  get account, 'file', params
end
create(filename:, file:, folder: nil, account: nil) click to toggle source

Upload a file to the media database

@param filename [String] The filename @param file [String] Base64 encoded version of the file @param folder [Integer, String] optional folder to put the file into @return [Hash] Result data @example

Emarsys::File.create("my_file.jpg", "asdhkajsh...")
Emarsys::File.create("my_file.jpg", "asdhkajsh...", 3)
# File lib/emarsys/data_objects/file.rb, line 31
def create(filename:, file:, folder: nil, account: nil)
  params = {:filename => filename, :file => file}
  params.merge!(:folder => folder) unless folder.nil?
  post account, 'file', params
end