Class: GoodDataMarketo::Loads
- Inherits:
-
Object
- Object
- GoodDataMarketo::Loads
- Defined in:
- lib/gooddata_marketo/loads.rb
Instance Attribute Summary collapse
-
#available ⇒ Object
Returns the value of attribute available.
Instance Method Summary collapse
- #available? ⇒ Boolean
- #download_from_webdav(file) ⇒ Object
-
#initialize(config = {}) ⇒ Loads
constructor
A new instance of Loads.
- #instantiate(config = {}) ⇒ Object (also: #create)
- #open(file) ⇒ Object
- #upload_to_webdav(file) ⇒ Object
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
#available ⇒ Object
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
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 |