Module: Datapimp::Sync

Defined in:
lib/datapimp/sync.rb,
lib/datapimp/sync/s3_bucket.rb,
lib/datapimp/sync/dropbox_delta.rb,
lib/datapimp/sync/cloudfront_distribution.rb

Defined Under Namespace

Classes: CloudfrontDistribution, DropboxDelta, DropboxFolder, GoogleDriveFolder, S3Bucket

Class Method Summary collapse

Class Method Details

.amazon(options = {}) ⇒ Object



38
39
40
41
# File 'lib/datapimp/sync.rb', line 38

def self.amazon(options={})
  require 'datapimp/clients/amazon'
  Datapimp::Clients::Amazon.client(options)
end

.data_source_typesObject



6
7
8
# File 'lib/datapimp/sync.rb', line 6

def self.data_source_types
  %w(dropbox amazon github google json excel nokogiri)
end

.dispatch_sync_folder_action(local, remote, options) ⇒ Object

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


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/datapimp/sync.rb', line 17

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 = {}) ⇒ Object



43
44
45
46
# File 'lib/datapimp/sync.rb', line 43

def self.dropbox(options={})
  require 'datapimp/clients/dropbox'
  Datapimp::Clients::Dropbox.client(options)
end

.github(options = {}) ⇒ Object



48
49
50
51
# File 'lib/datapimp/sync.rb', line 48

def self.github(options={})
  require 'datapimp/clients/github'
  Datapimp::Clients::Github.client(options)
end

.google(options = {}) ⇒ Object



53
54
55
56
# File 'lib/datapimp/sync.rb', line 53

def self.google(options={})
  require 'datapimp/clients/google'
  Datapimp::Clients::Google.client(options)
end