Project

skydrive

0.03
Repository is archived
No commit activity in last 3 years
No release in over 3 years
There's a lot of open issues
Simple ruby client library for Skydrive cloud storage service with OAuth2
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Skydrive

Simple client library for Microsoft Skydrive API with OAuth2 authentication

Installation

Add this line to your application's Gemfile:

gem 'skydrive'

And then execute:

$ bundle

Or install it yourself as:

$ gem install skydrive

Initial steps

OAuth2 Authentication

Skydrive uses OAuth2 authentication. First you will have to initialize a Skydrive::Oauth::Client object with the client id, client secret, callback url and scopes (explained here)

oauth_client = Skydrive::Oauth::Client.new("your_client_id", "your_client_secret", "http://yourcallbackurl", "wl.skydrive_update,wl.offline_access")

Obtain the authentication url

auth_url = oauth_client.authorize_url

Redirect the user to the above obtained auth_url. After user gives access to your app, they will be redirected to the callback url with a 'code' parameter. Extract this code and get the access token by invoking the following method

access_token = oauth_client.get_access_token("the_extracted_code")

If you have already stored the access_token details somewhere, you can instantiate the access token without having to authorize again. But this might require you to store the refresh token(if scope 'wl.offline_access' has been requested) as well.

access_token = oauth_client.get_access_token_from_hash("access_token", {:refresh_token => "refresh_token", :expires_at => 1234567})

Instantiate a client

After getting the access token instantiate the Skydrive client

client = Skydrive::Client.new(access_token)

Usage

Get the user's home folder

To get the details about the acting user's home folder folder = client.my_skydrive

This returns a Skydrive::Folder object.

Please refer to the documentation for full details about the operations

Features

  1. Every thing is an object. For eg: Skydrive::Folder, Skydrive::File
  2. I have introduced a new object Skydrive::Collection when the result contains multiple type objects
  3. Downloading files have been enabled
  4. UPDATE! Uploading enabled too!!!!

Todo

  1. More specs

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request