module Datapimp::Sync

Public Class Methods

amazon(options={}) click to toggle source
# File lib/datapimp/sync.rb, line 55
def self.amazon(options={})
  require 'datapimp/clients/amazon'
  Datapimp::Clients::Amazon.client(options)
end
data_source_types() click to toggle source
# File lib/datapimp/sync.rb, line 6
def self.data_source_types
  %w(dropbox amazon github google pivotal json excel nokogiri)
end
dispatch_sync_data_action(args, options) click to toggle source
# File lib/datapimp/sync.rb, line 10
def self.dispatch_sync_data_action(args, options)
  source  = Array(args).first
  type    = options[:type]

  result = case type
           when "github"
             Datapimp::Sources::GithubRepository.new(args, options)
           when "google", "google-spreadsheet"
             Datapimp::Sources::GoogleSpreadsheet.new(nil, key: source)
           when "pivotal" then
             Datapimp::Sources::Pivotal.new(args, options)
           when "keen" then
             Datapimp::Sources::Keen.new(args, options)
           end
  result
end
dispatch_sync_folder_action(local, remote, options) click to toggle source

Create any type of syncable folder and dispatch a run call to it with whatever options you want.

options:

- local: relative path to th local version of this folder
- remote: an identifier for the remote folder in the remote system
- action: push, pull, etc
# File lib/datapimp/sync.rb, line 34
def self.dispatch_sync_folder_action(local, remote, options)
  options = options.to_mash
  action = options.action

  folder = case
           when options.type == "dropbox"
             Datapimp::Sync::DropboxFolder.new(local: local, remote: remote)
           when options.type == "google"
             # Return the folders
             # collection = Datapimp::Sync.google.api.collections.first
             #
             # svg = collection.files.first
             # svg.export_as_file(/download/path, "image/svg+xml")
             Datapimp::Sync::GoogleDriveFolder.new(local: local, remote: remote)
           when options.type == "aws" || options.type == "s3"|| options.type == "amazon"
             Datapimp::Sync::S3Bucket.new(local: local, remote: remote)
           end

  folder.run(action, options)
end
dropbox(options={}) click to toggle source
# File lib/datapimp/sync.rb, line 60
def self.dropbox(options={})
  require 'datapimp/clients/dropbox'
  Datapimp::Clients::Dropbox.client(options)
end
github(options={}) click to toggle source
# File lib/datapimp/sync.rb, line 65
def self.github(options={})
  require 'datapimp/clients/github'
  Datapimp::Clients::Github.client(options)
end
google(options={}) click to toggle source
# File lib/datapimp/sync.rb, line 70
def self.google(options={})
  require 'datapimp/clients/google'
  Datapimp::Clients::Google.client(options)
end