gooddata 0.6.50 → 0.6.51

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.editorconfig +12 -0
  3. data/.gitignore +1 -0
  4. data/CHANGELOG.md +3 -0
  5. data/gooddata.gemspec +2 -1
  6. data/lib/gooddata/bricks/middleware/aws_middleware.rb +4 -0
  7. data/lib/gooddata/bricks/middleware/decode_params_middleware.rb +1 -1
  8. data/lib/gooddata/bricks/middleware/dwh_middleware.rb +1 -0
  9. data/lib/gooddata/bricks/middleware/gooddata_middleware.rb +1 -0
  10. data/lib/gooddata/bricks/middleware/logger_middleware.rb +2 -1
  11. data/lib/gooddata/core/nil_logger.rb +9 -0
  12. data/lib/gooddata/goodzilla/goodzilla.rb +1 -1
  13. data/lib/gooddata/helpers/data_helper.rb +1 -0
  14. data/lib/gooddata/helpers/global_helpers_params.rb +54 -27
  15. data/lib/gooddata/lcm/actions/apply_custom_maql.rb +70 -0
  16. data/lib/gooddata/lcm/actions/associate_clients.rb +17 -4
  17. data/lib/gooddata/lcm/actions/collect_clients.rb +4 -1
  18. data/lib/gooddata/lcm/actions/collect_segment_clients.rb +1 -0
  19. data/lib/gooddata/lcm/actions/collect_segments.rb +15 -2
  20. data/lib/gooddata/lcm/actions/create_segment_masters.rb +2 -2
  21. data/lib/gooddata/lcm/actions/provision_clients.rb +2 -4
  22. data/lib/gooddata/lcm/actions/purge_clients.rb +2 -2
  23. data/lib/gooddata/lcm/actions/synchronize_etls_in_segment.rb +81 -0
  24. data/lib/gooddata/lcm/actions/synchronize_label_types.rb +2 -2
  25. data/lib/gooddata/lcm/actions/synchronize_processes.rb +3 -1
  26. data/lib/gooddata/lcm/data/create_lcm_release.sql.erb +2 -1
  27. data/lib/gooddata/lcm/helpers/check_helper.rb +1 -1
  28. data/lib/gooddata/lcm/lcm.rb +29 -11
  29. data/lib/gooddata/lcm/lcm2.rb +82 -20
  30. data/lib/gooddata/models/domain.rb +22 -1
  31. data/lib/gooddata/models/metadata.rb +13 -8
  32. data/lib/gooddata/models/metadata/attribute.rb +1 -1
  33. data/lib/gooddata/models/metadata/report_definition.rb +1 -0
  34. data/lib/gooddata/models/profile.rb +1 -1
  35. data/lib/gooddata/models/project.rb +162 -38
  36. data/lib/gooddata/models/project_creator.rb +26 -6
  37. data/lib/gooddata/models/project_log_formatter.rb +204 -0
  38. data/lib/gooddata/models/schedule.rb +2 -21
  39. data/lib/gooddata/models/segment.rb +26 -0
  40. data/lib/gooddata/models/style_setting.rb +5 -1
  41. data/lib/gooddata/models/user_filters/user_filter_builder.rb +9 -0
  42. data/lib/gooddata/rest/connection.rb +4 -1
  43. data/lib/gooddata/version.rb +1 -1
  44. data/spec/environment/development.rb +29 -0
  45. data/spec/environment/environment.rb +14 -2
  46. data/spec/environment/{hotfix.rb → testing.rb} +0 -0
  47. data/spec/integration/date_dim_switch_spec.rb +3 -5
  48. data/spec/integration/lcm_spec.rb +24 -21
  49. data/spec/integration/project_spec.rb +16 -0
  50. data/spec/integration/segments_spec.rb +1 -1
  51. data/spec/unit/helpers/global_helpers_spec.rb +26 -2
  52. data/spec/unit/helpers_spec.rb +20 -0
  53. data/spec/unit/models/project_creator_spec.rb +3 -2
  54. metadata +29 -12
  55. data/lib/gooddata/lcm/actions/ensure_titles.rb +0 -54
  56. data/spec/environment/develop.rb +0 -46
@@ -9,33 +9,36 @@ require 'gooddata'
9
9
  describe GoodData::LCM, :constraint => 'slow' do
10
10
  before(:all) do
11
11
  @client = ConnectionHelper.create_default_connection
12
+
13
+ spec = JSON.parse(File.read("./spec/data/blueprints/attribute_sort_order_blueprint.json"), :symbolize_names => true)
14
+ blueprint = GoodData::Model::ProjectBlueprint.new(spec)
15
+
16
+ @source_project = @client.create_project_from_blueprint(blueprint, token: ConnectionHelper::GD_PROJECT_TOKEN, environment: ProjectHelper::ENVIRONMENT)
17
+ @target_project = @client.create_project_from_blueprint(@source_project.blueprint, token: ConnectionHelper::GD_PROJECT_TOKEN, environment: ProjectHelper::ENVIRONMENT)
12
18
  end
13
19
 
14
20
  after(:all) do
21
+ @source_project && @source_project.delete
22
+ @target_project && @target_project.delete
15
23
  @client && @client.disconnect
16
24
  end
17
25
 
18
26
  it 'should be able to transfer attribute drill paths' do
19
- begin
20
- spec = JSON.parse(File.read("./spec/data/blueprints/attribute_sort_order_blueprint.json"), :symbolize_names => true)
21
- blueprint = GoodData::Model::ProjectBlueprint.new(spec)
22
-
23
- source_project = @client.create_project_from_blueprint(blueprint, token: ConnectionHelper::GD_PROJECT_TOKEN, environment: ProjectHelper::ENVIRONMENT)
24
- target_project = @client.create_project_from_blueprint(source_project.blueprint, token: ConnectionHelper::GD_PROJECT_TOKEN, environment: ProjectHelper::ENVIRONMENT)
25
-
26
- name_attribute_source = source_project.attributes('attr.id.name')
27
- id_attribute_source = source_project.attributes('attr.id.id')
28
- name_attribute_source.drill_down(id_attribute_source)
29
-
30
- GoodData::LCM.transfer_attribute_drillpaths(source_project, target_project)
31
-
32
- name_attribute_target = target_project.attributes('attr.id.name')
33
- id_attribute_target = target_project.attributes('attr.id.id')
34
- name_attribute_target.drill_down(id_attribute_target)
35
- expect(target_project.labels(name_attribute_target.content['drillDownStepAttributeDF']).attribute_uri).to eq id_attribute_target.meta['uri']
36
- ensure
37
- source_project && source_project.delete
38
- target_project && target_project.delete
39
- end
27
+ name_attribute_source = @source_project.attributes('attr.id.name')
28
+ id_attribute_source = @source_project.attributes('attr.id.id')
29
+ name_attribute_source.drill_down(id_attribute_source)
30
+
31
+ GoodData::LCM.transfer_attribute_drillpaths(@source_project, @target_project)
32
+
33
+ name_attribute_target = @target_project.attributes('attr.id.name')
34
+ id_attribute_target = @target_project.attributes('attr.id.id')
35
+ name_attribute_target.drill_down(id_attribute_target)
36
+ expect(@target_project.labels(name_attribute_target.content['drillDownStepAttributeDF']).attribute_uri).to eq id_attribute_target.meta['uri']
37
+ end
38
+
39
+ it 'should be able to transfer color palette' do
40
+ @source_project.create_custom_color_palette([{ r: 155, g: 255, b: 0 }])
41
+ GoodData::Project.transfer_color_palette(@source_project, @target_project)
42
+ expect(@target_project.current_color_palette.colors).to eq [{ r: 155, g: 255, b: 0 }]
40
43
  end
41
44
  end
@@ -261,6 +261,22 @@ describe GoodData::Project, :constraint => 'slow' do
261
261
  end
262
262
  end).to be_truthy
263
263
  end
264
+
265
+ it 'can auto create groups and work with them' do
266
+ new_group = 'new_group'
267
+ u = @project.get_user(ConnectionHelper::DEFAULT_USERNAME)
268
+ uh = u.to_hash
269
+ uh[:user_group] = [new_group]
270
+
271
+ expect(@project.user_groups(new_group)).to be_nil
272
+ expect do
273
+ @project.import_users([uh], domain: @domain, whitelists: [/admin@gooddata.com/])
274
+ end.to raise_exception
275
+
276
+ @project.import_users([uh], domain: @domain, whitelists: [/admin@gooddata.com/], create_non_existing_user_groups: true)
277
+ expect(@project.user_groups(new_group)).not_to be_nil
278
+ expect(@project.user_groups(new_group).member?(u.uri)).to be_truthy
279
+ end
264
280
  end
265
281
 
266
282
  describe '#summary' do
@@ -13,7 +13,7 @@ describe GoodData::Segment do
13
13
  @domain = @client.domain(ConnectionHelper::DEFAULT_DOMAIN)
14
14
  GoodData::Segment.all(domain: @domain).each do |segment|
15
15
  begin
16
- segment.delete
16
+ segment.delete(force: true)
17
17
  rescue StandardError => e
18
18
  GoodData.logger.warn "Failed to delete segment: #{e}"
19
19
  end
@@ -95,13 +95,14 @@ describe GoodData::Helpers do
95
95
  end
96
96
 
97
97
  it 'should encode secure params' do
98
- x = GoodData::Helpers.decode_params(
98
+ params = {
99
99
  "x" => "y",
100
100
  "d|b|foo" => "bar",
101
101
  "d|b|e|w" => "z",
102
102
  GoodData::Helpers::ENCODED_PARAMS_KEY.to_s => '{"d":{"b":{"c": "a"}}}',
103
103
  GoodData::Helpers::ENCODED_HIDDEN_PARAMS_KEY.to_s => '{"d":{"b":{"e":{"f": "g"}}}}'
104
- )
104
+ }
105
+ x = GoodData::Helpers.decode_params(params, convert_pipe_delimited_params: true)
105
106
  expect(x).to eq(
106
107
  "x" => "y",
107
108
  "d" => { "b" => { "c" => "a", "e" => { "f" => "g", "w" => "z" }, "foo" => "bar" } },
@@ -165,6 +166,29 @@ describe GoodData::Helpers do
165
166
  result = GoodData::Helpers.decode_params(params, :resolve_reference_params => true)
166
167
  expect(result).to eq(expected_result)
167
168
  end
169
+
170
+ it 'should convert all values into String' do
171
+ params = {
172
+ x: true,
173
+ y: ['hello', false],
174
+ z: {
175
+ z1: false,
176
+ z2: [true],
177
+ z3: [[[false]]]
178
+ }
179
+ }
180
+ expected_result = {
181
+ x: 'true',
182
+ y: %w(hello false),
183
+ z: {
184
+ z1: 'false',
185
+ z2: ['true'],
186
+ z3: [[['false']]]
187
+ }
188
+ }
189
+ result = GoodData::Helpers.stringify_values(params)
190
+ expect(result).to eq(expected_result)
191
+ end
168
192
  end
169
193
 
170
194
  describe '.interpolate_error_message' do
@@ -61,6 +61,26 @@ describe GoodData::Helpers do
61
61
  result = GoodData::Helpers.decode_params(params)
62
62
  expect(result).to eq(expected_result)
63
63
  end
64
+
65
+ it 'ignore value of encoded params if its value is not collection or String when resolve reference params' do
66
+ params = {
67
+ 'param' => 'value',
68
+ 'number_param' => 5,
69
+ 'gd_encoded_params' => { "deep" => { "deeper" => "deep value" }, "bool" => true, "int" => 1 }
70
+ }
71
+ expected_result = {
72
+ 'param' => 'value',
73
+ 'number_param' => 5,
74
+ 'deep' => {
75
+ 'deeper' => 'deep value'
76
+ },
77
+ "bool" => true,
78
+ "int" => 1
79
+ }
80
+ result = GoodData::Helpers.decode_params(params, resolve_reference_params: true)
81
+ expect(result).to eq(expected_result)
82
+ end
83
+
64
84
  it 'decodes the hidden_data in hidden params' do
65
85
  params = {
66
86
  'param' => 'value',
@@ -67,7 +67,8 @@ describe GoodData::Model::ProjectCreator do
67
67
  end
68
68
 
69
69
  it 'should not pick a chunk if it is not possible to satisfy it based on your preference' do
70
- chunk = GoodData::Model::ProjectCreator.pick_correct_chunks(@data, update_preference: { cascade_drops: true, preserve_data: false, unmeetable_condition: true })
71
- expect(chunk).to eq []
70
+ expect do
71
+ GoodData::Model::ProjectCreator.pick_correct_chunks(@data, update_preference: { cascade_drops: true, preserve_data: false, unmeetable_condition: true })
72
+ end.to raise_error
72
73
  end
73
74
  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.50
4
+ version: 0.6.51
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: 2017-03-15 00:00:00.000000000 Z
14
+ date: 2017-04-13 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler
@@ -115,16 +115,16 @@ dependencies:
115
115
  name: rubocop
116
116
  requirement: !ruby/object:Gem::Requirement
117
117
  requirements:
118
- - - "~>"
118
+ - - "<"
119
119
  - !ruby/object:Gem::Version
120
- version: '0.47'
120
+ version: '0.48'
121
121
  type: :development
122
122
  prerelease: false
123
123
  version_requirements: !ruby/object:Gem::Requirement
124
124
  requirements:
125
- - - "~>"
125
+ - - "<"
126
126
  - !ruby/object:Gem::Version
127
- version: '0.47'
127
+ version: '0.48'
128
128
  - !ruby/object:Gem::Dependency
129
129
  name: simplecov
130
130
  requirement: !ruby/object:Gem::Requirement
@@ -195,6 +195,20 @@ dependencies:
195
195
  - - "~>"
196
196
  - !ruby/object:Gem::Version
197
197
  version: '4.11'
198
+ - !ruby/object:Gem::Dependency
199
+ name: pry
200
+ requirement: !ruby/object:Gem::Requirement
201
+ requirements:
202
+ - - ">="
203
+ - !ruby/object:Gem::Version
204
+ version: '0'
205
+ type: :development
206
+ prerelease: false
207
+ version_requirements: !ruby/object:Gem::Requirement
208
+ requirements:
209
+ - - ">="
210
+ - !ruby/object:Gem::Version
211
+ version: '0'
198
212
  - !ruby/object:Gem::Dependency
199
213
  name: aws-sdk
200
214
  requirement: !ruby/object:Gem::Requirement
@@ -444,6 +458,7 @@ extra_rdoc_files:
444
458
  - README.md
445
459
  files:
446
460
  - ".document"
461
+ - ".editorconfig"
447
462
  - ".gitignore"
448
463
  - ".rspec"
449
464
  - ".rubocop.yml"
@@ -558,6 +573,7 @@ files:
558
573
  - lib/gooddata/helpers/global_helpers_params.rb
559
574
  - lib/gooddata/helpers/helpers.rb
560
575
  - lib/gooddata/lcm/actions/actions.rb
576
+ - lib/gooddata/lcm/actions/apply_custom_maql.rb
561
577
  - lib/gooddata/lcm/actions/associate_clients.rb
562
578
  - lib/gooddata/lcm/actions/base_action.rb
563
579
  - lib/gooddata/lcm/actions/collect_clients.rb
@@ -568,7 +584,6 @@ files:
568
584
  - lib/gooddata/lcm/actions/ensure_segments.rb
569
585
  - lib/gooddata/lcm/actions/ensure_technical_users_domain.rb
570
586
  - lib/gooddata/lcm/actions/ensure_technical_users_project.rb
571
- - lib/gooddata/lcm/actions/ensure_titles.rb
572
587
  - lib/gooddata/lcm/actions/hello_world.rb
573
588
  - lib/gooddata/lcm/actions/print_actions.rb
574
589
  - lib/gooddata/lcm/actions/print_modes.rb
@@ -579,6 +594,7 @@ files:
579
594
  - lib/gooddata/lcm/actions/synchronize_attribute_drillpaths.rb
580
595
  - lib/gooddata/lcm/actions/synchronize_clients.rb
581
596
  - lib/gooddata/lcm/actions/synchronize_color_palette.rb
597
+ - lib/gooddata/lcm/actions/synchronize_etls_in_segment.rb
582
598
  - lib/gooddata/lcm/actions/synchronize_label_types.rb
583
599
  - lib/gooddata/lcm/actions/synchronize_ldm.rb
584
600
  - lib/gooddata/lcm/actions/synchronize_meta.rb
@@ -725,6 +741,7 @@ files:
725
741
  - lib/gooddata/models/profile.rb
726
742
  - lib/gooddata/models/project.rb
727
743
  - lib/gooddata/models/project_creator.rb
744
+ - lib/gooddata/models/project_log_formatter.rb
728
745
  - lib/gooddata/models/project_metadata.rb
729
746
  - lib/gooddata/models/project_role.rb
730
747
  - lib/gooddata/models/report_data_result.rb
@@ -801,11 +818,11 @@ files:
801
818
  - spec/data/wire_models/test_blueprint.json
802
819
  - spec/data/wire_test_project.json
803
820
  - spec/environment/default.rb
804
- - spec/environment/develop.rb
821
+ - spec/environment/development.rb
805
822
  - spec/environment/environment.rb
806
- - spec/environment/hotfix.rb
807
823
  - spec/environment/production.rb
808
824
  - spec/environment/staging.rb
825
+ - spec/environment/testing.rb
809
826
  - spec/helpers/blueprint_helper.rb
810
827
  - spec/helpers/cli_helper.rb
811
828
  - spec/helpers/connection_helper.rb
@@ -914,7 +931,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
914
931
  version: '0'
915
932
  requirements: []
916
933
  rubyforge_project:
917
- rubygems_version: 2.6.10
934
+ rubygems_version: 2.6.11
918
935
  signing_key:
919
936
  specification_version: 4
920
937
  summary: A convenient Ruby wrapper around the GoodData RESTful API
@@ -965,11 +982,11 @@ test_files:
965
982
  - spec/data/wire_models/test_blueprint.json
966
983
  - spec/data/wire_test_project.json
967
984
  - spec/environment/default.rb
968
- - spec/environment/develop.rb
985
+ - spec/environment/development.rb
969
986
  - spec/environment/environment.rb
970
- - spec/environment/hotfix.rb
971
987
  - spec/environment/production.rb
972
988
  - spec/environment/staging.rb
989
+ - spec/environment/testing.rb
973
990
  - spec/helpers/blueprint_helper.rb
974
991
  - spec/helpers/cli_helper.rb
975
992
  - spec/helpers/connection_helper.rb
@@ -1,54 +0,0 @@
1
- # encoding: UTF-8
2
- #
3
- # Copyright (c) 2010-2016 GoodData Corporation. All rights reserved.
4
- # This source code is licensed under the BSD-style license found in the
5
- # LICENSE file in the root directory of this source tree.
6
-
7
- require_relative 'base_action'
8
-
9
- module GoodData
10
- module LCM2
11
- class EnsureTitles < BaseAction
12
- DESCRIPTION = 'Ensure Project Titles - Based On Input Source Data'
13
-
14
- PARAMS = define_params(self) do
15
- description 'Client Used for Connecting to GD'
16
- param :gdc_gd_client, instance_of(Type::GdClientType), required: true
17
- end
18
-
19
- class << self
20
- def call(params)
21
- # Check if all required parameters were passed
22
- BaseAction.check_params(PARAMS, params)
23
-
24
- client = params.gdc_gd_client
25
-
26
- domain_name = params.organization || params.domain
27
- domain = client.domain(domain_name) || fail("Invalid domain name specified - #{domain_name}")
28
-
29
- domain_segments = {}
30
- domain.segments.each do |segment|
31
- domain_segments[segment.segment_id] = {}
32
- segment.clients.each do |segment_client|
33
- domain_segments[segment.segment_id][segment_client.client_id] = segment_client.project
34
- end
35
- end
36
-
37
- params.clients.map do |segment_client|
38
- segment_id = segment_client.segment
39
- client_id = segment_client.id
40
- project = domain_segments[segment_id][client_id]
41
- project.title = segment_client[:project_title]
42
- project.save
43
-
44
- {
45
- segment: segment_id,
46
- client: client_id,
47
- title: project.title
48
- }
49
- end
50
- end
51
- end
52
- end
53
- end
54
- end
@@ -1,46 +0,0 @@
1
- # encoding: UTF-8
2
- #
3
- # Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
4
- # This source code is licensed under the BSD-style license found in the
5
- # LICENSE file in the root directory of this source tree.
6
-
7
- module GoodData
8
- module Environment
9
- module ConnectionHelper
10
- # These info is for staging3
11
-
12
- # set_const :GD_PROJECT_TOKEN, GoodData::Helpers.decrypt("cfO9ifFYQVJw3q6Kf8/pVf/uLPLGnUJ/9nfvBxeGf/ILoj8N4ymWGgvryWEK\nHDMu\n", ENV['GD_SPEC_PASSWORD'] || ENV['BIA_ENCRYPTION_KEY'])
13
- # set_const :DEFAULT_DOMAIN, 'staging3-lcm-prod'
14
- # set_const :DEFAULT_SERVER, 'https://staging3-lcm-prod.intgdc.com'
15
- # set_const :DEFAULT_USER_URL, '/gdc/account/profile/a4c644d7b42b65c34e5a0f46809f7164'
16
- # set_const :STAGING_URI, 'https://staging3-lcm-prod.intgdc.com/gdc/uploads/'
17
-
18
- set_const :GD_PROJECT_TOKEN, GoodData::Helpers.decrypt("DIRchLbHH1fovLSVEfo3f5aQwHHQ432+PxF3uR5IuNn+iYWz+HZrLtaZ3LVE\n0ZNc\n", ENV['GD_SPEC_PASSWORD'] || ENV['BIA_ENCRYPTION_KEY'])
19
- set_const :DEFAULT_DOMAIN, 'staging2-lcm-prod'
20
- set_const :DEFAULT_SERVER, 'https://staging2-lcm-prod.intgdc.com'
21
- set_const :DEFAULT_USER_URL, '/gdc/account/profile/5ad80b895edcc438e5a4418e222733fa'
22
- set_const :STAGING_URI, 'https://na1-staging2-di.intgdc.com/uploads/'
23
- end
24
-
25
- module ProcessHelper
26
- # These info is for staging3
27
- # set_const :PROCESS_ID, 'b671fcfe-f6fd-4379-92c1-3db9eceb1c54'
28
-
29
- set_const :PROCESS_ID, '3dddcd0d-1b56-4508-a94b-abea70c7154d'
30
- end
31
-
32
- module ProjectHelper
33
- # These info is for staging3
34
- # set_const :PROJECT_ID, 'rd87oh5rnbf1qhh9vjq5lkgq5v6okei5'
35
-
36
- set_const :PROJECT_ID, 'fbhs09oddsgezqtn3um5rp08midmbpg5'
37
- end
38
-
39
- module ScheduleHelper
40
- # These info is for staging3
41
- # set_const :SCHEDULE_ID, '58ad6260e4b0ee87af79b0b8'
42
-
43
- set_const :SCHEDULE_ID, '58ad4fbbe4b02e90f6422677'
44
- end
45
- end
46
- end