Class DropboxSession
In: build/dropbox-ruby-sdk-dist/lib/dropbox_sdk.rb
Parent: Object

DropboxSession is responsible for holding OAuth information. It knows how to take your consumer key and secret and request an access token, an authorize url, and get an access token. You just need to pass it to DropboxClient after its been authorized.

Methods

Public Class methods

Takes a serialized DropboxSession YAML String and returns a new DropboxSession object

  • consumer_key - Your Dropbox application‘s "app key".
  • consumer_secret - Your Dropbox application‘s "app secret".

Public Instance methods

Returns the access token, or nil if one hasn‘t been acquired yet.

If we have an access token, then do nothing. If not, throw a RuntimeError.

Returns true if this Session has been authorized and has an access_token.

Returns the access token. If this DropboxSession doesn‘t yet have an access_token, it requests one using the request_token generate from your app‘s token and secret. This request will fail unless your user has gone to the authorize_url and approved your request

This returns a URL that your user must visit to grant permissions to this application.

This returns a request token. Requests one from the dropbox server using the provided application key and secret if nessecary.

Returns the request token, or nil if one hasn‘t been acquired yet.

serialize the DropboxSession. At DropboxSession‘s state is capture in three key/secret pairs. Consumer, request, and access. Serialize returns these in a YAML string, generated from a converted array of the form: [consumer_key, consumer_secret, request_token.token, request_token.secret, access_token.token, access_token.secret] access_token is only included if it already exists in the DropboxSesssion

Given a saved access token and secret, you set this Session to use that token and secret

  • token - this is the access token
  • secret - this is the access token secret

Given a saved request token and secret, set this location‘s token and secret

  • token - this is the request token
  • secret - this is the request token secret

[Validate]