Class: GoodData::DatasetMapping

Inherits:
Object
  • Object
show all
Defined in:
lib/gooddata/models/dataset_mapping.rb

Constant Summary collapse

DATASET_MAPPING_GET_URI =
'/gdc/dataload/projects/%<project_id>s/modelMapping/datasets'
DATASET_MAPPING_UPDATE_URI =
'/gdc/dataload/projects/%<project_id>s/modelMapping/datasets/bulk/upsert'

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ DatasetMapping

Returns a new instance of DatasetMapping.



24
25
26
# File 'lib/gooddata/models/dataset_mapping.rb', line 24

def initialize(data)
  @data = data
end

Class Method Details

.[](opts = { :client => GoodData.connection, :project => GoodData.project }) ⇒ Object Also known as: get



14
15
16
17
18
19
# File 'lib/gooddata/models/dataset_mapping.rb', line 14

def [](opts = { :client => GoodData.connection, :project => GoodData.project })
  client, project = GoodData.get_client_and_project(opts)
  get_uri = DATASET_MAPPING_GET_URI % { project_id: project.pid }
  res = client.get(get_uri)
  res
end

Instance Method Details

#save(opts) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/gooddata/models/dataset_mapping.rb', line 28

def save(opts)
  client, project = GoodData.get_client_and_project(opts)

  post_uri = DATASET_MAPPING_UPDATE_URI % { project_id: project.pid }
  res = client.post(post_uri, @data, opts)
  res
end