Module: Easemob::Fileoperation

Included in:
Easemob
Defined in:
lib/easemob/fileoperation.rb

Instance Method Summary collapse

Instance Method Details

#download_chatfile(chatfile_uuid, share_secret: nil, thumbnail: false) ⇒ Object



10
11
12
# File 'lib/easemob/fileoperation.rb', line 10

def download_chatfile(chatfile_uuid, share_secret: nil, thumbnail: false)
  FileoperationMessage.new request :download, "chatfiles/#{chatfile_uuid}", share_secret: share_secret, thumbnail: thumbnail
end

#upload_chatfile(file_path, restrict_access: true) ⇒ Object



4
5
6
7
8
# File 'lib/easemob/fileoperation.rb', line 4

def upload_chatfile(file_path, restrict_access: true)
  FileoperationMessage.new request :upload, 'chatfiles', form: { file: HTTP::FormData::File.new(file_path),
                                                                 hack: 'X' }, # Existing here for http-form_data 1.0.1 handle single param improperly, see https://github.com/httprb/form_data.rb/issues/4
                                                         restrict_access: restrict_access
end