Class: Mode::Connector::Uploader

Inherits:
Object
  • Object
show all
Defined in:
lib/mode/connector/uploader.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, dataset) ⇒ Uploader

Returns a new instance of Uploader.



7
8
9
10
# File 'lib/mode/connector/uploader.rb', line 7

def initialize(path, dataset)
  @path = path
  @dataset = dataset
end

Instance Attribute Details

#datasetObject (readonly)

Returns the value of attribute dataset.



5
6
7
# File 'lib/mode/connector/uploader.rb', line 5

def dataset
  @dataset
end

#pathObject (readonly)

Returns the value of attribute path.



4
5
6
# File 'lib/mode/connector/uploader.rb', line 4

def path
  @path
end

Class Method Details

.error!(path, message, detail = nil) ⇒ Object



25
26
27
28
29
30
31
32
33
34
# File 'lib/mode/connector/uploader.rb', line 25

def error!(path, message, detail = nil)
  Mode::API::Request.put(path,
    :execution => {
      :error => {
        :detail => detail,
        :message => message
      }
    }
  )
end

Instance Method Details

#perform!Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/mode/connector/uploader.rb', line 12

def perform!
  Mode::API::Request.put(
    path,
    :execution => {
      :dataset => {
        :content => content,
        :columns => JSON.generate(columns)
      }
    }
  )
end