gooddata 0.6.8 → 0.6.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/gooddata/models/metadata.rb +1 -1
- data/lib/gooddata/models/project.rb +9 -1
- data/lib/gooddata/models/project_blueprint.rb +3 -4
- data/lib/gooddata/rest/client.rb +8 -0
- data/lib/gooddata/version.rb +1 -1
- data/spec/integration/full_process_schedule_spec.rb +1 -1
- data/spec/integration/full_project_spec.rb +11 -11
- data/spec/integration/partial_md_export_import_spec.rb +11 -12
- data/spec/unit/core/project_spec.rb +4 -9
- data/spec/unit/models/project_blueprint_spec.rb +0 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7d013ba0b03cf22fd29f0ef4c266a06ecad756e
|
4
|
+
data.tar.gz: dac86a92b7e82af815df7f4900a329012d468437
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 936dba585e13b83dc3a0592bf0cf068b3d4d8e23306c3ebdf0554810b7062486407d8a3ad95beaa6d86d09ca1bd8aec160080407c96d12f79dfe690ff9f40e03
|
7
|
+
data.tar.gz: b9664e85e0558d130ac3ac5452f20220d833d321d9aa9c59a53b22c126ae27f0156bce5944974645c1bf741cf604e4cd7c14dac42bf684e8f5e5a48dde0d39c0
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# GoodData Ruby SDK Changelog
|
2
2
|
|
3
|
+
## 0.6.9
|
4
|
+
- Fixing issues with creating models.
|
5
|
+
- Adding couple more helpers for report/metric computation
|
6
|
+
- Rewriting several full_* specs to use the new syntax
|
7
|
+
|
3
8
|
## 0.6.8
|
4
9
|
|
5
10
|
- REST Factory - See [PR #224](https://github.com/gooddata/gooddata-ruby/pull/224)
|
@@ -131,7 +131,7 @@ module GoodData
|
|
131
131
|
end
|
132
132
|
|
133
133
|
def create_from_blueprint(blueprint, options = {})
|
134
|
-
GoodData::Model::ProjectCreator.migrate(:
|
134
|
+
GoodData::Model::ProjectCreator.migrate(options.merge(spec: blueprint, token: options[:auth_token], client: GoodData.connection))
|
135
135
|
end
|
136
136
|
|
137
137
|
# Takes one CSV line and creates hash from data extracted
|
@@ -255,6 +255,14 @@ module GoodData
|
|
255
255
|
new_project
|
256
256
|
end
|
257
257
|
|
258
|
+
def compute_report(spec = {})
|
259
|
+
GoodData::ReportDefinition.execute(spec.merge(:client => client, :project => self))
|
260
|
+
end
|
261
|
+
|
262
|
+
def compute_metric(expression)
|
263
|
+
GoodData::Metric.xexecute(expression, :client => client, :project => self)
|
264
|
+
end
|
265
|
+
|
258
266
|
def create_schedule(process, date, executable, options = {})
|
259
267
|
GoodData::Schedule.create(process, date, executable, options.merge(:client => client, :project => self))
|
260
268
|
end
|
@@ -339,11 +339,10 @@ module GoodData
|
|
339
339
|
# @return [Array<Hash>]
|
340
340
|
def can_break(dataset)
|
341
341
|
dataset = find_dataset(dataset) if dataset.is_a?(String)
|
342
|
-
referenced_by(dataset)
|
343
|
-
|
344
|
-
|
342
|
+
(referenced_by(dataset) + [dataset]).mapcat do |ds|
|
343
|
+
ds.attributes_and_anchors.map do |attr|
|
344
|
+
[ds, attr]
|
345
345
|
end
|
346
|
-
a
|
347
346
|
end
|
348
347
|
end
|
349
348
|
|
data/lib/gooddata/rest/client.rb
CHANGED
@@ -126,6 +126,14 @@ module GoodData
|
|
126
126
|
@factory = ObjectFactory.new(self)
|
127
127
|
end
|
128
128
|
|
129
|
+
def create_project(options = {})
|
130
|
+
GoodData::Project.create(title: 'Project for schedule testing', auth_token: ConnectionHelper::GD_PROJECT_TOKEN, client: self)
|
131
|
+
end
|
132
|
+
|
133
|
+
def create_project_from_blueprint(blueprint, options = {})
|
134
|
+
GoodData::Model::ProjectCreator.migrate(spec: blueprint, token: options[:auth_token], client: self)
|
135
|
+
end
|
136
|
+
|
129
137
|
def domain(domain_name)
|
130
138
|
GoodData::Domain[domain_name, :client => self]
|
131
139
|
end
|
data/lib/gooddata/version.rb
CHANGED
@@ -3,7 +3,7 @@ require 'gooddata'
|
|
3
3
|
describe "Full process and schedule exercise", :constraint => 'slow' do
|
4
4
|
before(:all) do
|
5
5
|
@client = ConnectionHelper::create_default_connection
|
6
|
-
@project =
|
6
|
+
@project = @client.create_project(title: 'Project for schedule testing', auth_token: ConnectionHelper::GD_PROJECT_TOKEN)
|
7
7
|
@process = @project.deploy_process('./spec/data/ruby_process',
|
8
8
|
type: 'RUBY',
|
9
9
|
name: 'Test ETL Process')
|
@@ -5,7 +5,7 @@ describe "Full project implementation", :constraint => 'slow' do
|
|
5
5
|
@spec = JSON.parse(File.read("./spec/data/test_project_model_spec.json"), :symbolize_names => true)
|
6
6
|
@invalid_spec = JSON.parse(File.read("./spec/data/blueprint_invalid.json"), :symbolize_names => true)
|
7
7
|
@client = ConnectionHelper::create_default_connection
|
8
|
-
@project =
|
8
|
+
@project = @client.create_project_from_blueprint(@spec, auth_token: ConnectionHelper::GD_PROJECT_TOKEN)
|
9
9
|
end
|
10
10
|
|
11
11
|
after(:all) do
|
@@ -16,7 +16,7 @@ describe "Full project implementation", :constraint => 'slow' do
|
|
16
16
|
|
17
17
|
it "should not build an invalid model" do
|
18
18
|
expect {
|
19
|
-
|
19
|
+
@client.create_project_from_blueprint(@invalid_spec, auth_token: ConnectionHelper::GD_PROJECT_TOKEN)
|
20
20
|
}.to raise_error(GoodData::ValidationError)
|
21
21
|
end
|
22
22
|
|
@@ -51,7 +51,7 @@ describe "Full project implementation", :constraint => 'slow' do
|
|
51
51
|
@project.delete_all_data(force: true)
|
52
52
|
f = @project.fact_by_title('Lines Changed')
|
53
53
|
metric = @project.create_metric("SELECT SUM(#\"#{f.title}\")")
|
54
|
-
res =
|
54
|
+
res = @project.compute_report(:left => [metric])
|
55
55
|
expect(res).to be_empty
|
56
56
|
end
|
57
57
|
|
@@ -99,11 +99,11 @@ describe "Full project implementation", :constraint => 'slow' do
|
|
99
99
|
# TODO: Here we create metric which is not deleted and is used by another test - "should exercise the object relations and getting them in various ways"
|
100
100
|
metric = @project.create_metric("SELECT SUM(#\"#{f.title}\")", :title => "My metric")
|
101
101
|
metric.save
|
102
|
-
result =
|
102
|
+
result = @project.compute_report(:top => [metric], :left => ['label.devs.dev_id.email'])
|
103
103
|
expect(result[1][1]).to eq 3
|
104
104
|
expect(result.include_row?(["jirka@gooddata.com", 5])).to be true
|
105
105
|
|
106
|
-
result2 =
|
106
|
+
result2 = @project.compute_report(:top => [metric], :left => ['label.devs.dev_id.email'])
|
107
107
|
expect(result2[1][1]).to eq 3
|
108
108
|
expect(result2.include_row?(["jirka@gooddata.com", 5])).to eq true
|
109
109
|
expect(result2).to eq result
|
@@ -176,10 +176,10 @@ describe "Full project implementation", :constraint => 'slow' do
|
|
176
176
|
expect(fact1).not_to eq fact3
|
177
177
|
|
178
178
|
metric.using(nil)
|
179
|
-
expect(metric.using('fact'
|
179
|
+
expect(metric.using('fact').count).to eq 1
|
180
180
|
|
181
181
|
fact1.used_by(nil)
|
182
|
-
expect(fact1.used_by('metric'
|
182
|
+
expect(fact1.used_by('metric').count).to eq 1
|
183
183
|
|
184
184
|
res = metric.using?(fact1)
|
185
185
|
expect(res).to be(true)
|
@@ -211,16 +211,16 @@ describe "Full project implementation", :constraint => 'slow' do
|
|
211
211
|
end
|
212
212
|
|
213
213
|
it "should be able to interpolate metric based on" do
|
214
|
-
res =
|
214
|
+
res = @project.compute_metric "SELECT SUM(![fact.commits.lines_changed])"
|
215
215
|
expect(res).to eq 9
|
216
216
|
|
217
|
-
res =
|
217
|
+
res = @project.compute_metric "SELECT SUM(![fact.commits.lines_changed])"
|
218
218
|
expect(res).to eq 9
|
219
219
|
|
220
|
-
res =
|
220
|
+
res = @project.compute_metric "SELECT SUM(![fact.commits.lines_changed])"
|
221
221
|
expect(res).to eq 9
|
222
222
|
|
223
|
-
res =
|
223
|
+
res = @project.compute_metric "SELECT SUM(![fact.commits.lines_changed])"
|
224
224
|
expect(res).to eq 9
|
225
225
|
|
226
226
|
fact = @project.fact_by_title('Lines Changed')
|
@@ -1,13 +1,13 @@
|
|
1
1
|
require 'gooddata'
|
2
2
|
|
3
|
-
describe "
|
3
|
+
describe "Object export between projects", :constraint => 'slow' do
|
4
4
|
before(:all) do
|
5
5
|
@client = ConnectionHelper.create_default_connection
|
6
6
|
|
7
7
|
spec = MultiJson.load(File.read("./spec/data/test_project_model_spec.json"), :symbolize_keys => true)
|
8
8
|
|
9
|
-
@source_project =
|
10
|
-
@target_project =
|
9
|
+
@source_project = @client.create_project_from_blueprint(spec, auth_token: ConnectionHelper::GD_PROJECT_TOKEN)
|
10
|
+
@target_project = @client.create_project_from_blueprint(spec, auth_token: ConnectionHelper::GD_PROJECT_TOKEN)
|
11
11
|
end
|
12
12
|
|
13
13
|
after(:all) do
|
@@ -20,18 +20,17 @@ describe "Spin a project", :constraint => 'slow' do
|
|
20
20
|
it "should transfer a metric" do
|
21
21
|
f = GoodData::Fact.find_first_by_title('Lines Changed', :client => @client, :project => @source_project)
|
22
22
|
metric_title = "Testing metric to be exported"
|
23
|
-
metric =
|
23
|
+
metric = @source_project.create_metric("SELECT SUM(#\"#{f.title}\")", :title => metric_title)
|
24
24
|
metric.save
|
25
25
|
|
26
|
-
|
26
|
+
@target_project.metrics.count.should == 0
|
27
27
|
|
28
|
-
@source_project.partial_md_export(metric, :
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
end
|
28
|
+
@source_project.partial_md_export(metric, :project => @target_project)
|
29
|
+
|
30
|
+
expect(@target_project.metrics.count).to eq 1
|
31
|
+
metric = GoodData::Metric.find_first_by_title(metric_title, :client => @client, :project => @target_project)
|
32
|
+
expect(metric).not_to be_nil
|
33
|
+
expect(metric.title).to eq metric_title
|
35
34
|
end
|
36
35
|
|
37
36
|
end
|
@@ -19,29 +19,24 @@ describe 'GoodData - project' do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'Assigns project using project ID' do
|
22
|
-
|
23
|
-
GoodData.project = ProjectHelper::PROJECT_ID
|
22
|
+
GoodData.use(ProjectHelper::PROJECT_ID, client: @client)
|
24
23
|
end
|
25
24
|
|
26
25
|
it 'Assigns project using project URL' do
|
27
|
-
|
28
|
-
GoodData.project = ProjectHelper::PROJECT_URL
|
26
|
+
GoodData.use ProjectHelper::PROJECT_URL, client: @client
|
29
27
|
end
|
30
28
|
|
31
29
|
it 'Assigns project directly' do
|
32
|
-
|
33
|
-
GoodData.project = GoodData::Project[ProjectHelper::PROJECT_ID]
|
30
|
+
GoodData.project = GoodData::Project[ProjectHelper::PROJECT_ID, client: @client]
|
34
31
|
end
|
35
32
|
end
|
36
33
|
|
37
34
|
describe '#project' do
|
38
35
|
it 'Returns project assigned' do
|
39
|
-
pending 'GoodData.project= is disabled for now'
|
40
|
-
|
41
36
|
GoodData.project = nil
|
42
37
|
GoodData.project.should == nil
|
43
38
|
|
44
|
-
GoodData.
|
39
|
+
GoodData.use ProjectHelper::PROJECT_ID, client: @client
|
45
40
|
GoodData.project.should_not == nil
|
46
41
|
end
|
47
42
|
end
|
@@ -213,7 +213,6 @@ describe GoodData::Model::ProjectBlueprint do
|
|
213
213
|
attrs = @blueprint.can_break('commits')
|
214
214
|
attrs.count.should == 3
|
215
215
|
|
216
|
-
pending("At least those from the same dataset should be able to break")
|
217
216
|
attrs = @blueprint.can_break('devs')
|
218
217
|
attrs.count.should == 1
|
219
218
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gooddata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Kolesnikov
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2014-09-
|
14
|
+
date: 2014-09-17 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: debase
|