Skip to content

Instantly share code, notes, and snippets.

@tylr
Created April 19, 2012 23:04
Show Gist options
  • Save tylr/2424774 to your computer and use it in GitHub Desktop.
Save tylr/2424774 to your computer and use it in GitHub Desktop.
# A provider must inherit from Pedofile::Provider::Base
# A Provider is a source of data (e.g. Dropbox, Twitter, Facebook, Instagram, SugarSync)
provider = DropboxProvider.new(:consumer_token => Pedofile::Token.new('xxx', 'xxx'), :access_token => Pedofile::Token.new('xxx', 'xxx'))
# A Mount inherits from Pedofile::Mount::Base
# A Mount acts as a Controller that massages data from a provider into a uniform format.
# mount.entries returns a list of entries
# mount.sync! will fetch new entries from a provider
mount = DropboxMount.new(:provider => provider)
# A Fetcher inherits from Pedofile::Fetcher::Base
# A Fetcher provides an interface for automating storing
fetcher = DropboxFetcher.new({
:mount => mount,
:before => Proc.new do
# Setup code? Check to see if access token is still active?
end,
:after => Proc.new do
# Store data somewhere, entries are an array of Pedofile::Mount::Entry objects
end
})
fetcher.sync!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment