Giter Site home page Giter Site logo

ocman's Introduction

ocman

Ruby gem for file managment and sharing in owncloud

Installation

Rails

Add this line to your application's Gemfile:

gem "ocman", :git => '[email protected]: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|
  # Required
  config.base_url = 'https://example.org'
  config.user_name = ''
  config.password = ''

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

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'>>

# Share with read-only permissions (default is 'all')
Ocman.share('path/to/folder', 'user_name', Ocman::Permission.read)
# => #<Hashie::Mash data=nil meta=#<Hashie::Mash message=nil status='ok' statuscode='100'>>

# Share with specific set of permissions
Ocman.share('path/to/folder', 'user_name', Ocman::Permission.new([:read, :create, :update]))
# => #<Hashie::Mash data=nil meta=#<Hashie::Mash message=nil status='ok' statuscode='100'>>

Valid permissions are:

  • read
  • create
  • update
  • delete
  • share
  • all

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: [email protected]

ocman's People

Contributors

coma2nd avatar farson avatar sr189 avatar

Stargazers

Martin Kolb avatar Kusanagi avatar Adrian Nowak avatar

Watchers

James Cloos avatar  avatar  avatar Martin Kolb avatar

ocman's Issues

Return values

Is there a reason, that ocman is giving back empty strings as an return value after for example successfully creating a folder? Also if I say Ocman.delete(some_path) and it deletes, it only returns nil. And the most confusing was, when I tried to list a folder, that wasn't there: it throws an exeption. For usage it would be so much more handy to make these methods return true or false or something that I could work with, without having to build a rescue block only for the question if a folder is already there...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.