Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dropbox-invite

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dropbox-invite

  • 0.0.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

dropbox-invite

Code Climate

Introduction

This gem allows you to invite other users to a shared folder in Dropbox. It's known that Dropbox API doesn't allow this operation, however it's a requirement in some scenarios.

To achieve this functionality and due to the lack of implementation in the official API, the library relies on rest-client and nokogiri to perform the action through the web interface.

Scope

This gem is meant to provide a missing functionality, not to build another API implementation. Ideally you'd use this library in combination with some actual implementation of the Dropbox API.

I recommend dropbox-api just because I've included integration for it. If Dropbox::API is found the existing classes will be extended to allow you invite people to your folders. This is shown in the examples below.

Disclaimer

This gem depends 100% on the parsing of the HTML from Dropbox web pages, therefore a change in their layouts might result in a broken library. Please, keep this in mind if you're planning to use this in a production environment.

Another drawback of using the web interface is of course the speed.

How to use

First, you'll need to set up dropbox-api as explained in the [gem's README] (https://github.com/futuresimple/dropbox-api):

Dropbox::API::Config.app_key    = YOUR_APP_KEY
Dropbox::API::Config.app_secret = YOUR_APP_SECRET
Dropbox::API::Config.mode       = "dropbox" # This is a requirement

At this point you're able to instantiate a Dropbox::API::Client object either through web-based authorization or rake-based. So far, nothing new.

Additionally you'll need to set up the web login credentials as part of the API settings to enable the initialization of a web client when it's required.

Dropbox::API::Config.web_session = Dropbox::WebClient::Session.new(
  :email => "example@corkeryfisher.info",
  :password => "yourPassw0rd"
)

Note that the web authentication won't happen until you actually need it, i.e. when the invite method is invoked.

Now, assuming that you've got a Dropbox::API::Dir object called some_dir, you'd be able to perform this:

response = some_dir.invite("kirsten.greenholt@corkeryfisher.info")
# => #<Dropbox::WebClient::ResponseParser ... >
response.error?
# => false
response.response_data
# => {"success_msg"=>"Created shared folder 'folder x'", "sf_info"=>{"mount_point"=>"/folder x", "user_id"=>372486289, "extra_count"=>0, "sort_rank"=>nil, "encoded_sort_key"=>["NkhCMjROBloBDAEMAA=="], "other_emails"=>[], "other_names"=>[], "modified_pretty"=>"just now", "href"=>"/home/folder%20x", "modified_ts"=>1420051083, "filename"=>"folder x", "target_ns_id"=>791334450, "icon"=>"folder_user"}}

Additionally you can check who's included in the dir through members:

some_dir.members
# => ["example@corkeryfisher.info", "kirsten.greenholt@corkeryfisher.info"]
session = Dropbox::WebClient::Session.new(
  :email => "your@account.com",
  :password => "yourPassw0rd"
)
session.invite("/folder path", ["kirsten.greenholt@corkeryfisher.info"])
# => #<Dropbox::WebClient::ResponseParser ... >

To do

Would be nice to:

  • Record tests in HTTP instead of HTTPS so they'd be readable. To do so we'll need a proxy.
  • Implement other functions (share permissions, etc).
  • Improve error handling.
  • Add setting to disable lazy authentication.

Problems?

Please report them in issues

FAQs

Package last updated on 30 Dec 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc