Class: GoodDataMarketo::Loads

Inherits:
Object
  • Object
show all
Defined in:
lib/gooddata_marketo/loads.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ Loads

Returns a new instance of Loads.



13
14
15
16
17
18
19
20
21
# File 'lib/gooddata_marketo/loads.rb', line 13

def initialize config = {}

  @user = config[:user]
  @password = config[:pass] || config[:password]
  @project = config[:project] || config[:pid]
  @client = config[:marketo_client] || config[:marketo]
  @webdav = WebDAV.new :user => @user, :password => @password, :project => @project

end

Instance Attribute Details

#availableObject

Returns the value of attribute available.



11
12
13
# File 'lib/gooddata_marketo/loads.rb', line 11

def available
  @available
end

Instance Method Details

#available?Boolean

Returns:

  • (Boolean)


35
36
37
38
39
40
41
42
43
# File 'lib/gooddata_marketo/loads.rb', line 35

def available?
  loads = Dir.entries('.').select { |f| f.include? '_load.json' }
  if loads.empty?
    false
  else
    true
    self.available = loads
  end
end

#download_from_webdav(file) ⇒ Object



50
51
52
53
54
# File 'lib/gooddata_marketo/loads.rb', line 50

def download_from_webdav file
  raise 'You must specify a :user, :password; and :project from GoodData.' unless @webdav
  @webdav.download file

end

#instantiate(config = {}) ⇒ Object Also known as: create



23
24
25
26
27
# File 'lib/gooddata_marketo/loads.rb', line 23

def instantiate config = {}
  config[:webdav] = @webdav
  config[:client] = @client
  Load.new config
end

#open(file) ⇒ Object



31
32
33
# File 'lib/gooddata_marketo/loads.rb', line 31

def open file
  Load.new :file => file, :client => @client, :webdav => @webdav
end

#upload_to_webdav(file) ⇒ Object



45
46
47
48
# File 'lib/gooddata_marketo/loads.rb', line 45

def upload_to_webdav file
  raise 'You must specify a :user, :password; and :project from GoodData.' unless @webdav
  @webdav.upload file
end