gooddata 0.6.4 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.markdown +4 -0
- data/README.md +1 -0
- data/lib/gooddata/cli/commands/project_cmd.rb +2 -7
- data/lib/gooddata/client.rb +0 -2
- data/lib/gooddata/commands/project.rb +10 -0
- data/lib/gooddata/core/rest.rb +12 -2
- data/lib/gooddata/exceptions/attr_element_not_found.rb +12 -0
- data/lib/gooddata/extensions/enumerable.rb +12 -0
- data/lib/gooddata/helpers/global_helpers.rb +20 -0
- data/lib/gooddata/mixins/author.rb +16 -0
- data/lib/gooddata/mixins/content_getter.rb +11 -0
- data/lib/gooddata/mixins/content_property_reader.rb +13 -0
- data/lib/gooddata/mixins/content_property_writer.rb +13 -0
- data/lib/gooddata/mixins/contributor.rb +16 -0
- data/lib/gooddata/mixins/data_getter.rb +11 -0
- data/lib/gooddata/mixins/data_property_reader.rb +13 -0
- data/lib/gooddata/mixins/data_property_writer.rb +13 -0
- data/lib/gooddata/mixins/is_attribute.rb +13 -0
- data/lib/gooddata/mixins/is_fact.rb +13 -0
- data/lib/gooddata/mixins/is_label.rb +15 -0
- data/lib/gooddata/mixins/links.rb +11 -0
- data/lib/gooddata/mixins/md_finders.rb +36 -0
- data/lib/gooddata/mixins/md_id_to_uri.rb +29 -0
- data/lib/gooddata/mixins/md_json.rb +11 -0
- data/lib/gooddata/mixins/md_object_id.rb +11 -0
- data/lib/gooddata/mixins/md_object_indexer.rb +36 -0
- data/lib/gooddata/mixins/md_object_query.rb +83 -0
- data/lib/gooddata/mixins/md_relations.rb +39 -0
- data/lib/gooddata/mixins/meta_getter.rb +11 -0
- data/lib/gooddata/mixins/meta_property_reader.rb +13 -0
- data/lib/gooddata/mixins/meta_property_writer.rb +13 -0
- data/lib/gooddata/mixins/mixins.rb +15 -0
- data/lib/gooddata/mixins/not_attribute.rb +13 -0
- data/lib/gooddata/mixins/not_exportable.rb +11 -0
- data/lib/gooddata/mixins/not_fact.rb +13 -0
- data/lib/gooddata/mixins/not_label.rb +15 -0
- data/lib/gooddata/mixins/not_metric.rb +13 -0
- data/lib/gooddata/mixins/obj_id.rb +11 -0
- data/lib/gooddata/mixins/rest_getters.rb +13 -0
- data/lib/gooddata/mixins/rest_resource.rb +19 -0
- data/lib/gooddata/mixins/root_key_getter.rb +11 -0
- data/lib/gooddata/mixins/root_key_setter.rb +11 -0
- data/lib/gooddata/mixins/timestamps.rb +15 -0
- data/lib/gooddata/models/from_wire.rb +153 -0
- data/lib/gooddata/models/metadata.rb +28 -230
- data/lib/gooddata/models/metadata/attribute.rb +4 -6
- data/lib/gooddata/models/metadata/fact.rb +4 -6
- data/lib/gooddata/models/metadata/{display_form.rb → label.rb} +17 -11
- data/lib/gooddata/models/metadata/metric.rb +1 -1
- data/lib/gooddata/models/metadata/report_definition.rb +2 -2
- data/lib/gooddata/models/model.rb +55 -23
- data/lib/gooddata/models/models.rb +0 -2
- data/lib/gooddata/models/module_constants.rb +0 -2
- data/lib/gooddata/models/process.rb +1 -1
- data/lib/gooddata/models/project.rb +117 -76
- data/lib/gooddata/models/project_blueprint.rb +322 -42
- data/lib/gooddata/models/project_creator.rb +5 -4
- data/lib/gooddata/models/project_role.rb +20 -55
- data/lib/gooddata/models/schema_blueprint.rb +287 -84
- data/lib/gooddata/models/schema_builder.rb +0 -4
- data/lib/gooddata/models/to_manifest.rb +160 -0
- data/lib/gooddata/models/to_wire.rb +150 -0
- data/lib/gooddata/version.rb +1 -1
- data/spec/data/blueprint_invalid.json +3 -1
- data/spec/data/gd_gse_data_blueprint.json +1370 -0
- data/spec/data/gd_gse_data_manifest.json +1424 -0
- data/spec/data/gd_gse_data_model.json +1772 -0
- data/spec/data/manifest_test_project.json +116 -0
- data/spec/data/model_view.json +1772 -0
- data/spec/data/superfluous_titles_view.json +81 -0
- data/spec/data/test_project_model_spec.json +7 -4
- data/spec/data/wire_test_project.json +143 -0
- data/spec/helpers/crypto_helper.rb +9 -0
- data/spec/helpers/project_helper.rb +2 -0
- data/spec/integration/command_projects_spec.rb +4 -2
- data/spec/integration/full_project_spec.rb +51 -18
- data/spec/integration/partial_md_export_import_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -1
- data/spec/unit/models/attribute_column_spec.rb +7 -7
- data/spec/unit/models/domain_spec.rb +2 -2
- data/spec/unit/models/from_wire_spec.rb +119 -0
- data/spec/unit/models/metadata_spec.rb +4 -2
- data/spec/unit/models/project_blueprint_spec.rb +32 -16
- data/spec/unit/models/project_role_spec.rb +6 -4
- data/spec/unit/models/project_spec.rb +26 -3
- data/spec/unit/models/schema_builder_spec.rb +5 -6
- data/spec/unit/models/to_manifest_spec.rb +24 -0
- data/spec/unit/models/to_wire_spec.rb +63 -0
- metadata +53 -29
- data/lib/gooddata/models/attributes/anchor.rb +0 -37
- data/lib/gooddata/models/attributes/attributes.rb +0 -8
- data/lib/gooddata/models/attributes/date_attribute.rb +0 -25
- data/lib/gooddata/models/attributes/time_attribute.rb +0 -24
- data/lib/gooddata/models/columns/attribute.rb +0 -71
- data/lib/gooddata/models/columns/columns.rb +0 -8
- data/lib/gooddata/models/columns/date_column.rb +0 -63
- data/lib/gooddata/models/columns/fact_model.rb +0 -54
- data/lib/gooddata/models/columns/label.rb +0 -55
- data/lib/gooddata/models/columns/reference.rb +0 -57
- data/lib/gooddata/models/facts/facts.rb +0 -8
- data/lib/gooddata/models/facts/time_fact.rb +0 -20
- data/lib/gooddata/models/folders/attribute_folder.rb +0 -20
- data/lib/gooddata/models/folders/fact_folder.rb +0 -20
- data/lib/gooddata/models/folders/folders.rb +0 -8
- data/lib/gooddata/models/metadata/column.rb +0 -61
- data/lib/gooddata/models/metadata/data_set.rb +0 -32
- data/lib/gooddata/models/metadata/date_dimension.rb +0 -26
- data/lib/gooddata/models/metadata/schema.rb +0 -227
- data/lib/gooddata/models/references/date_reference.rb +0 -44
- data/lib/gooddata/models/references/references.rb +0 -8
- data/lib/gooddata/models/references/time_reference.rb +0 -13
- data/spec/helpers/schema_helper.rb +0 -16
- data/spec/unit/models/anchor_spec.rb +0 -32
- data/spec/unit/models/tools_spec.rb +0 -95
- data/test/test_upload.rb +0 -79
@@ -148,11 +148,11 @@ module GoodData
|
|
148
148
|
data_result_uri = result['execResult']['dataResult']
|
149
149
|
result = GoodData.get data_result_uri
|
150
150
|
|
151
|
-
while result['taskState'] && result['taskState']['status'] == 'WAIT'
|
151
|
+
while result && result['taskState'] && result['taskState']['status'] == 'WAIT'
|
152
152
|
sleep 10
|
153
153
|
result = GoodData.get data_result_uri
|
154
154
|
end
|
155
|
-
|
155
|
+
return nil unless result
|
156
156
|
ReportDataResult.new(GoodData.get data_result_uri)
|
157
157
|
end
|
158
158
|
|
@@ -3,16 +3,10 @@
|
|
3
3
|
require_relative '../core/connection'
|
4
4
|
require_relative '../core/rest'
|
5
5
|
|
6
|
-
require_relative 'attributes/attributes'
|
7
|
-
require_relative 'columns/columns'
|
8
|
-
require_relative 'facts/facts'
|
9
|
-
require_relative 'folders/folders'
|
10
6
|
require_relative 'metadata/metadata'
|
11
|
-
require_relative 'references/references'
|
12
7
|
|
13
8
|
require_relative 'links'
|
14
9
|
require_relative 'module_constants'
|
15
|
-
require_relative 'metadata/schema'
|
16
10
|
|
17
11
|
require 'fileutils'
|
18
12
|
require 'multi_json'
|
@@ -25,27 +19,65 @@ require 'zip'
|
|
25
19
|
#
|
26
20
|
module GoodData
|
27
21
|
module Model
|
22
|
+
GD_TYPES = %w(GDC.link GDC.text GDC.geo GDC.time)
|
23
|
+
GD_DATA_TYPES = %w(INT VARCHAR DECIMAL)
|
24
|
+
|
25
|
+
DEFAULT_FACT_DATATYPE = 'INT'
|
26
|
+
|
28
27
|
class << self
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
28
|
+
def title(item)
|
29
|
+
item[:title] || item[:name].titleize
|
30
|
+
end
|
31
|
+
|
32
|
+
def identifier_for(dataset, column = nil, column2 = nil)
|
33
|
+
return "dataset.#{dataset[:name]}" if column.nil?
|
34
|
+
column = DatasetBlueprint.find_column_by_name(dataset, column) if column.is_a?(String)
|
35
|
+
case column[:type].to_sym
|
36
|
+
when :anchor_no_label
|
37
|
+
"attr.#{dataset[:name]}.factsof"
|
38
|
+
when :attribute
|
39
|
+
"attr.#{dataset[:name]}.#{column[:name]}"
|
40
|
+
when :anchor
|
41
|
+
"attr.#{dataset[:name]}.#{column[:name]}"
|
42
|
+
when :date_fact
|
43
|
+
"dt.#{dataset[:name]}.#{column[:name]}"
|
44
|
+
when :fact
|
45
|
+
"fact.#{dataset[:name]}.#{column[:name]}"
|
46
|
+
when :primary_label
|
47
|
+
"label.#{dataset[:name]}.#{column[:name]}"
|
48
|
+
when :label
|
49
|
+
"label.#{dataset[:name]}.#{column2[:name]}.#{column[:name]}"
|
50
|
+
when :date_ref
|
51
|
+
"#{dataset[:name]}.date.mdyy"
|
52
|
+
when :dataset
|
53
|
+
"dataset.#{dataset[:name]}"
|
54
|
+
else
|
55
|
+
fail "Unknown type #{column[:type].to_sym}"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def check_gd_datatype(value)
|
60
|
+
GD_TYPES.any? { |v| v == value }
|
61
|
+
end
|
44
62
|
|
45
63
|
# Load given file into a data set described by the given schema
|
46
|
-
def upload_data(path,
|
64
|
+
def upload_data(path, project_blueprint, dataset, options = {})
|
65
|
+
# path = if path =~ URI.regexp
|
66
|
+
# Tempfile.open('remote_file') do |temp|
|
67
|
+
# temp << open(path).read
|
68
|
+
# temp.flush
|
69
|
+
# # GoodData::Model.upload_data(path, to_manifest(mode))
|
70
|
+
# end
|
71
|
+
#
|
72
|
+
# else
|
73
|
+
# # GoodData::Model.upload_data(path, to_manifest(mode))
|
74
|
+
# # upload_data(path, mode)
|
75
|
+
# end
|
76
|
+
|
77
|
+
mode = options[:mode] || 'FULL'
|
78
|
+
manifest = GoodData::Model::ToManifest.dataset_to_manifest(project_blueprint, dataset, mode)
|
47
79
|
project = options[:project] || GoodData.project
|
48
|
-
|
80
|
+
|
49
81
|
path = path.path if path.respond_to? :path
|
50
82
|
inline_data = path.is_a?(String) ? false : true
|
51
83
|
|
@@ -6,6 +6,9 @@ require 'fileutils'
|
|
6
6
|
|
7
7
|
require_relative 'process'
|
8
8
|
require_relative '../exceptions/no_project_error'
|
9
|
+
|
10
|
+
require_relative '../mixins/mixins'
|
11
|
+
|
9
12
|
require_relative 'project_role'
|
10
13
|
|
11
14
|
module GoodData
|
@@ -18,7 +21,19 @@ module GoodData
|
|
18
21
|
|
19
22
|
attr_accessor :connection, :json
|
20
23
|
|
24
|
+
alias_method :to_json, :json
|
25
|
+
alias_method :raw_data, :json
|
26
|
+
|
27
|
+
include GoodData::Mixin::MetaGetter
|
28
|
+
include GoodData::Mixin::DataGetter
|
29
|
+
|
21
30
|
class << self
|
31
|
+
include GoodData::Mixin::RootKeySetter
|
32
|
+
|
33
|
+
include GoodData::Mixin::MetaPropertyReader
|
34
|
+
|
35
|
+
include GoodData::Mixin::MetaPropertyWriter
|
36
|
+
|
22
37
|
# Returns an array of all projects accessible by
|
23
38
|
# current user
|
24
39
|
def all
|
@@ -47,6 +62,14 @@ module GoodData
|
|
47
62
|
end
|
48
63
|
end
|
49
64
|
|
65
|
+
Project.root_key :project
|
66
|
+
|
67
|
+
include GoodData::Mixin::RootKeyGetter
|
68
|
+
include GoodData::Mixin::DataGetter
|
69
|
+
include GoodData::Mixin::Author
|
70
|
+
include GoodData::Mixin::Contributor
|
71
|
+
include GoodData::Mixin::Timestamps
|
72
|
+
|
50
73
|
# Create a project from a given attributes
|
51
74
|
# Expected keys:
|
52
75
|
# - :title (mandatory)
|
@@ -77,7 +100,6 @@ module GoodData
|
|
77
100
|
json['project']['meta']['projectTemplate'] = attributes[:template] if attributes[:template] && !attributes[:template].empty?
|
78
101
|
project = Project.new json
|
79
102
|
project.save
|
80
|
-
|
81
103
|
# until it is enabled or deleted, recur. This should still end if there is a exception thrown out from RESTClient. This sometimes happens from WebApp when request is too long
|
82
104
|
while project.state.to_s != 'enabled'
|
83
105
|
if project.state.to_s == 'deleted'
|
@@ -115,26 +137,6 @@ module GoodData
|
|
115
137
|
end
|
116
138
|
end
|
117
139
|
|
118
|
-
# Creates a data set within the project
|
119
|
-
#
|
120
|
-
# == Usage
|
121
|
-
# p.add_dataset 'Test', [ { 'name' => 'a1', 'type' => 'ATTRIBUTE' ... } ... ]
|
122
|
-
# p.add_dataset 'title' => 'Test', 'columns' => [ { 'name' => 'a1', 'type' => 'ATTRIBUTE' ... } ... ]
|
123
|
-
#
|
124
|
-
def add_dataset(schema_def, columns = nil, &block)
|
125
|
-
schema = if block
|
126
|
-
builder = block.call(Model::SchemaBuilder.new(schema_def))
|
127
|
-
builder.to_schema
|
128
|
-
else
|
129
|
-
sch = { :title => schema_def, :columns => columns } if columns
|
130
|
-
sch = Model::Schema.new schema_def if schema_def.is_a? Hash
|
131
|
-
sch = schema_def if schema_def.is_a?(Model::Schema)
|
132
|
-
fail(ArgumentError, 'Required either schema object or title plus columns array') unless schema_def.is_a? Model::Schema
|
133
|
-
sch
|
134
|
-
end
|
135
|
-
Model.add_schema(schema, self)
|
136
|
-
end
|
137
|
-
|
138
140
|
def add_metric(options = {})
|
139
141
|
options[:expression] || fail('Metric has to have its expression defined')
|
140
142
|
m1 = GoodData::Metric.create(options)
|
@@ -146,12 +148,20 @@ module GoodData
|
|
146
148
|
rep.save
|
147
149
|
end
|
148
150
|
|
149
|
-
#
|
151
|
+
# Returns an indication whether current user is admin in this project
|
150
152
|
#
|
151
|
-
# @return [
|
152
|
-
def
|
153
|
-
|
154
|
-
|
153
|
+
# @return [Boolean] True if user has admin role in the project, false otherwise.
|
154
|
+
def am_i_admin?
|
155
|
+
user_has_role?(GoodData.user, 'admin')
|
156
|
+
end
|
157
|
+
|
158
|
+
# Gets project blueprint from the server
|
159
|
+
#
|
160
|
+
# @return [GoodData::ProjectRole] Project role if found
|
161
|
+
def blueprint
|
162
|
+
result = GoodData.get("/gdc/projects/#{pid}/model/view")
|
163
|
+
model = GoodData.poll_on_root(result, 'asyncTask') { |r| r['asyncTask']['link']['poll'] }
|
164
|
+
GoodData::Model::FromWire.from_wire(model)
|
155
165
|
end
|
156
166
|
|
157
167
|
# Returns web interface URI of project
|
@@ -173,10 +183,10 @@ module GoodData
|
|
173
183
|
# TODO: Refactor so if export or import fails the new_project will be cleaned
|
174
184
|
with_data = options[:data] || true
|
175
185
|
with_users = options[:users] || false
|
176
|
-
|
186
|
+
a_title = options[:title] || "Clone of #{title}"
|
177
187
|
|
178
188
|
# Create the project first so we know that it is passing. What most likely is wrong is the tokena and the export actaully takes majoiryt of the time
|
179
|
-
new_project = GoodData::Project.create(options.merge(:title =>
|
189
|
+
new_project = GoodData::Project.create(options.merge(:title => a_title))
|
180
190
|
|
181
191
|
export = {
|
182
192
|
:exportProject => {
|
@@ -213,28 +223,8 @@ module GoodData
|
|
213
223
|
new_project
|
214
224
|
end
|
215
225
|
|
216
|
-
# Project contributor
|
217
|
-
#
|
218
|
-
# @return [String] Project contributor
|
219
|
-
# TODO: Return as object
|
220
|
-
def contributor
|
221
|
-
# TODO: Return object instead
|
222
|
-
@json['project']['meta']['contributor']
|
223
|
-
end
|
224
|
-
|
225
|
-
# Gets the date when created
|
226
|
-
#
|
227
|
-
# @return [DateTime] Date time when created
|
228
|
-
def created
|
229
|
-
DateTime.parse(@json['project']['meta']['created'])
|
230
|
-
end
|
231
|
-
|
232
|
-
# Gets ruby wrapped raw project JSON data
|
233
|
-
def data
|
234
|
-
raw_data['project']
|
235
|
-
end
|
236
|
-
|
237
226
|
def datasets
|
227
|
+
blueprint.datasets
|
238
228
|
datasets_uri = "#{md['data']}/sets"
|
239
229
|
response = GoodData.get datasets_uri
|
240
230
|
response['dataSetsInfo']['sets'].map do |ds|
|
@@ -260,6 +250,24 @@ module GoodData
|
|
260
250
|
Dashboard.all.map { |data| Dashboard[data['link']] }.each { |d| d.delete }
|
261
251
|
end
|
262
252
|
|
253
|
+
# Executes DML expression. See (https://developer.gooddata.com/article/deleting-records-from-datasets)
|
254
|
+
# for some examples and explanations
|
255
|
+
#
|
256
|
+
# @param dml [String] DML expression
|
257
|
+
def execute_dml(dml)
|
258
|
+
uri = "/gdc/md/#{pid}/dml/manage"
|
259
|
+
result = GoodData.post(uri,
|
260
|
+
manage: {
|
261
|
+
maql: dml
|
262
|
+
})
|
263
|
+
polling_uri = result['uri']
|
264
|
+
result = GoodData.get(polling_uri)
|
265
|
+
while result['taskState'] && result['taskState']['status'] == 'WAIT'
|
266
|
+
sleep 10
|
267
|
+
result = GoodData.get polling_uri
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
263
271
|
# Gets project role by its identifier
|
264
272
|
#
|
265
273
|
# @param [String] role_name Title of role to look for
|
@@ -320,6 +328,7 @@ module GoodData
|
|
320
328
|
# @return [GoodDta::Membership] User
|
321
329
|
def get_user(name, user_list = users)
|
322
330
|
return name if name.instance_of?(GoodData::Membership)
|
331
|
+
return member(name) if name.instance_of?(GoodData::Profile)
|
323
332
|
name.downcase!
|
324
333
|
user_list.each do |user|
|
325
334
|
return user if user.uri.downcase == name ||
|
@@ -329,6 +338,19 @@ module GoodData
|
|
329
338
|
nil
|
330
339
|
end
|
331
340
|
|
341
|
+
# Checks whether user has particular role in given proejct
|
342
|
+
#
|
343
|
+
# @param user [GoodData::Profile | GoodData::Membership | String] User in question. Can be passed by login (String), profile or membershi objects
|
344
|
+
# @param role_name [String || GoodData::ProjectRole] Project role cna be given by either string or GoodData::ProjectRole object
|
345
|
+
# @return [Boolean] Tru if user has role_name
|
346
|
+
def user_has_role?(user, role_name)
|
347
|
+
member = get_user(user)
|
348
|
+
role = get_role(role_name)
|
349
|
+
member.roles.include?(role)
|
350
|
+
rescue
|
351
|
+
false
|
352
|
+
end
|
353
|
+
|
332
354
|
# Initializes object instance from raw wire JSON
|
333
355
|
#
|
334
356
|
# @param json Json used for initialization
|
@@ -395,6 +417,10 @@ module GoodData
|
|
395
417
|
data['links']
|
396
418
|
end
|
397
419
|
|
420
|
+
def lint
|
421
|
+
blueprint.lint
|
422
|
+
end
|
423
|
+
|
398
424
|
def md
|
399
425
|
@md ||= Links.new GoodData.get(data['links']['metadata'])
|
400
426
|
end
|
@@ -478,6 +504,28 @@ module GoodData
|
|
478
504
|
true
|
479
505
|
end
|
480
506
|
|
507
|
+
def info
|
508
|
+
results = blueprint.datasets.map do |ds|
|
509
|
+
[ds, ds.count]
|
510
|
+
end
|
511
|
+
puts title
|
512
|
+
puts GoodData::Helpers.underline(title)
|
513
|
+
puts
|
514
|
+
puts "Datasets - #{results.count}"
|
515
|
+
puts
|
516
|
+
results.each do |x|
|
517
|
+
dataset, count = x
|
518
|
+
dataset.title.tap do |t|
|
519
|
+
puts t
|
520
|
+
puts GoodData::Helpers.underline(t)
|
521
|
+
puts "Size - #{count} rows"
|
522
|
+
puts "#{dataset.attributes_and_anchors.count} attributes, #{dataset.facts.count} facts, #{dataset.references.count} references"
|
523
|
+
puts
|
524
|
+
end
|
525
|
+
end
|
526
|
+
nil
|
527
|
+
end
|
528
|
+
|
481
529
|
# Forces project to reload
|
482
530
|
def reload!
|
483
531
|
if saved?
|
@@ -501,11 +549,19 @@ module GoodData
|
|
501
549
|
|
502
550
|
# Saves project
|
503
551
|
def save
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
552
|
+
data_to_send = raw_data.deep_dup
|
553
|
+
data_to_send['project']['content'].delete('cluster')
|
554
|
+
data_to_send['project']['content'].delete('isPublic')
|
555
|
+
data_to_send['project']['content'].delete('state')
|
556
|
+
response = if uri
|
557
|
+
GoodData.post(PROJECT_PATH % pid, data_to_send)
|
558
|
+
GoodData.get uri
|
559
|
+
else
|
560
|
+
result = GoodData.post(PROJECTS_PATH, data_to_send)
|
561
|
+
GoodData.get result['uri']
|
562
|
+
end
|
563
|
+
@json = response
|
564
|
+
self
|
509
565
|
end
|
510
566
|
|
511
567
|
# Checks if is project saved
|
@@ -534,7 +590,7 @@ module GoodData
|
|
534
590
|
def slis
|
535
591
|
link = "#{data['links']['metadata']}#{SLIS_PATH}"
|
536
592
|
|
537
|
-
#
|
593
|
+
# FIXME: Review what to do with passed extra argument
|
538
594
|
Metadata.new GoodData.get(link)
|
539
595
|
end
|
540
596
|
|
@@ -545,33 +601,21 @@ module GoodData
|
|
545
601
|
data['content']['state'].downcase.to_sym if data['content'] && data['content']['state']
|
546
602
|
end
|
547
603
|
|
548
|
-
|
549
|
-
#
|
550
|
-
# @return [String] Project summary
|
551
|
-
def summary
|
552
|
-
data['meta']['summary'] if data['meta']
|
553
|
-
end
|
604
|
+
Project.metadata_property_reader :summary, :title
|
554
605
|
|
555
606
|
# Gets project title
|
556
607
|
#
|
557
608
|
# @return [String] Project title
|
558
|
-
def title
|
559
|
-
data['meta']['title'] if data['meta']
|
560
|
-
end
|
561
|
-
|
562
|
-
# Gets project update date
|
563
|
-
#
|
564
|
-
# @return [DateTime] Date time of last update
|
565
|
-
def updated
|
566
|
-
DateTime.parse(@json['project']['meta']['updated'])
|
609
|
+
def title=(a_title)
|
610
|
+
data['meta']['title'] = a_title if data['meta']
|
567
611
|
end
|
568
612
|
|
569
613
|
# Uploads file to project
|
570
614
|
#
|
571
615
|
# @param file File to be uploaded
|
572
616
|
# @param schema Schema to be used
|
573
|
-
def upload(file,
|
574
|
-
|
617
|
+
def upload(file, dataset_blueprint, mode = 'FULL')
|
618
|
+
dataset_blueprint.upload file, self, mode
|
575
619
|
end
|
576
620
|
|
577
621
|
def uri
|
@@ -744,7 +788,7 @@ module GoodData
|
|
744
788
|
# metric_filter - Checks metadata for inconsistent metric filters.
|
745
789
|
# invalid_objects - Checks metadata for invalid/corrupted objects.
|
746
790
|
# asyncTask response
|
747
|
-
def validate(filters = %w(ldm
|
791
|
+
def validate(filters = %w(ldm pdm metric_filter invalid_objects))
|
748
792
|
response = GoodData.post "#{GoodData.project.md['validate-project']}", 'validateProject' => filters
|
749
793
|
polling_link = response['asyncTask']['link']['poll']
|
750
794
|
polling_result = GoodData.get(polling_link)
|
@@ -754,8 +798,5 @@ module GoodData
|
|
754
798
|
end
|
755
799
|
polling_result
|
756
800
|
end
|
757
|
-
|
758
|
-
alias_method :to_json, :json
|
759
|
-
alias_method :raw_data, :json
|
760
801
|
end
|
761
802
|
end
|