/ocman

Ruby gem for file managment and sharing in owncloud

Primary LanguageRubyMIT LicenseMIT

ocman

Ruby gem for file managment and sharing in owncloud

Installation

Rails

Add this line to your application's Gemfile:

gem "ocman", :git => 'git@github.com:tt-laboratories/ocman.git'

Configuration

Initialize Ocman with your access credentials somewhere during startup. In a rails application that may be an initializer like .../initializers/ocman.rb.

Ocman.configure do |config|
  config.base_url = 'https://example.org'
  config.user_name = ''
  config.password = ''
end

Optional configuration options

  config.dav_base_uri = '/remote.php/webdav/' # Optional - URI of the owncloud installation. Defaults to '/remote.php/webdav/'

Usage

Sharing

Share a folder or a file

>> Ocman.share('path/to/folder', 'user_name')
=> #<Hashie::Mash data=nil meta=#<Hashie::Mash message=nil status='ok' statuscode='100'>>

Delete a share for a folder or a file

>> Ocman.delete_share('path/to/folder', 'user_name')
=> #<Hashie::Mash data=nil meta=#<Hashie::Mash message=nil status='ok' statuscode='100'>>

File Management

List folder

>> Ocman.list('path/to/folder', options={})
=> [#<Hashie::Mash path="Documents" size=0 type="directory">, #<Hashie::Mash path="Test.zip" size=127 type="file">]
Available options:
  • recursive - If true the folder contents will be listed recursively

Create folder

>> Ocman.create_folder('path/to/folder')
=> ""

Upload a file

>> Ocman.put('local/file/path', 'remote/path/to/folder', <options>)
=> nil

Available options:

  • filename: filename of the file stored in owncloud (defaults to basename of the file)

Delete a file or folder

>> Ocman.delete('path/to/file')
=> nil

Move a file or folder

>> Ocman.move('source_path/of/file', 'destination_path')
=> ""

Contact

Web: https://www.toptranslation.com, https://developer.toptranslation.com

Github: https://www.github.com/tt-laboratories

Twitter: @tt_developers, @toptranslation

Mail: tech@toptranslation.com