gooddata 0.6.10 → 0.6.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +9 -0
  3. data/.travis.yml +4 -0
  4. data/CHANGELOG.md +6 -0
  5. data/README.md +1 -0
  6. data/gooddata.gemspec +38 -40
  7. data/lib/gooddata/bricks/base_downloader.rb +1 -1
  8. data/lib/gooddata/bricks/middleware/base_middleware.rb +36 -0
  9. data/lib/gooddata/bricks/middleware/bulk_salesforce_middleware.rb +8 -38
  10. data/lib/gooddata/bricks/middleware/decode_params_middleware.rb +14 -0
  11. data/lib/gooddata/bricks/middleware/fs_upload_middleware.rb +7 -6
  12. data/lib/gooddata/bricks/middleware/gooddata_middleware.rb +7 -5
  13. data/lib/gooddata/bricks/middleware/logger_middleware.rb +1 -1
  14. data/lib/gooddata/bricks/middleware/restforce_middleware.rb +20 -14
  15. data/lib/gooddata/bricks/middleware/undot_params_middleware.rb +33 -0
  16. data/lib/gooddata/cli/commands/api_cmd.rb +1 -1
  17. data/lib/gooddata/cli/commands/auth_cmd.rb +1 -1
  18. data/lib/gooddata/cli/commands/console_cmd.rb +2 -2
  19. data/lib/gooddata/cli/commands/process_cmd.rb +54 -7
  20. data/lib/gooddata/cli/commands/project_cmd.rb +9 -9
  21. data/lib/gooddata/cli/commands/projects_cmd.rb +1 -1
  22. data/lib/gooddata/cli/commands/run_ruby_cmd.rb +24 -7
  23. data/lib/gooddata/cli/commands/scaffold_cmd.rb +2 -2
  24. data/lib/gooddata/cli/commands/user_cmd.rb +1 -1
  25. data/lib/gooddata/cli/hooks.rb +3 -3
  26. data/lib/gooddata/commands/datasets.rb +1 -1
  27. data/lib/gooddata/commands/project.rb +2 -2
  28. data/lib/gooddata/commands/role.rb +1 -1
  29. data/lib/gooddata/commands/runners.rb +2 -2
  30. data/lib/gooddata/connection.rb +2 -2
  31. data/lib/gooddata/core/nil_logger.rb +1 -1
  32. data/lib/gooddata/core/rest.rb +12 -8
  33. data/lib/gooddata/data/guesser.rb +1 -1
  34. data/lib/gooddata/exceptions/attr_element_not_found.rb +1 -1
  35. data/lib/gooddata/extensions/enumerable.rb +1 -1
  36. data/lib/gooddata/extensions/hash.rb +20 -0
  37. data/lib/gooddata/helpers/csv_helper.rb +1 -1
  38. data/lib/gooddata/helpers/global_helpers.rb +59 -1
  39. data/lib/gooddata/mixins/md_lock.rb +83 -0
  40. data/lib/gooddata/mixins/md_object_indexer.rb +1 -1
  41. data/lib/gooddata/mixins/md_object_query.rb +1 -1
  42. data/lib/gooddata/mixins/md_relations.rb +0 -9
  43. data/lib/gooddata/models/dashboard_builder.rb +1 -1
  44. data/lib/gooddata/models/domain.rb +2 -2
  45. data/lib/gooddata/models/empty_result.rb +5 -5
  46. data/lib/gooddata/models/execution.rb +74 -0
  47. data/lib/gooddata/models/execution_detail.rb +74 -0
  48. data/lib/gooddata/models/membership.rb +1 -1
  49. data/lib/gooddata/models/metadata/attribute.rb +4 -6
  50. data/lib/gooddata/models/metadata/dashboard.rb +2 -0
  51. data/lib/gooddata/models/metadata/fact.rb +2 -2
  52. data/lib/gooddata/models/metadata/metric.rb +4 -1
  53. data/lib/gooddata/models/metadata/report.rb +84 -34
  54. data/lib/gooddata/models/metadata/report_definition.rb +28 -17
  55. data/lib/gooddata/models/metadata.rb +1 -1
  56. data/lib/gooddata/models/model.rb +1 -1
  57. data/lib/gooddata/models/process.rb +70 -54
  58. data/lib/gooddata/models/profile.rb +47 -10
  59. data/lib/gooddata/models/project.rb +74 -30
  60. data/lib/gooddata/models/project_blueprint.rb +9 -10
  61. data/lib/gooddata/models/project_builder.rb +2 -2
  62. data/lib/gooddata/models/project_creator.rb +4 -4
  63. data/lib/gooddata/models/report_data_result.rb +1 -1
  64. data/lib/gooddata/models/schedule.rb +39 -32
  65. data/lib/gooddata/models/to_manifest.rb +5 -5
  66. data/lib/gooddata/models/to_wire.rb +3 -3
  67. data/lib/gooddata/rest/client.rb +64 -31
  68. data/lib/gooddata/rest/connection.rb +7 -7
  69. data/lib/gooddata/rest/connections/dummy_connection.rb +5 -5
  70. data/lib/gooddata/rest/connections/rest_client_connection.rb +106 -44
  71. data/lib/gooddata/rest/object.rb +1 -1
  72. data/lib/gooddata/version.rb +1 -1
  73. data/spec/bricks/bricks_spec.rb +67 -0
  74. data/spec/bricks/default-config.json +8 -0
  75. data/spec/data/gooddata_version_process/gooddata_version.rb +3 -0
  76. data/spec/data/gooddata_version_process/gooddata_version.zip +0 -0
  77. data/spec/data/ruby_params_process/ruby_params.rb +3 -0
  78. data/spec/helpers/process_helper.rb +12 -0
  79. data/spec/helpers/schedule_helper.rb +21 -0
  80. data/spec/integration/create_project_spec.rb +19 -0
  81. data/spec/integration/full_process_schedule_spec.rb +129 -8
  82. data/spec/integration/full_project_spec.rb +52 -2
  83. data/spec/spec_helper.rb +1 -0
  84. data/spec/unit/core/rest_spec.rb +76 -3
  85. data/spec/unit/helpers_spec.rb +43 -0
  86. data/spec/unit/models/metric_spec.rb +33 -0
  87. data/spec/unit/models/params_spec.rb +96 -0
  88. data/spec/unit/models/profile_spec.rb +16 -0
  89. data/spec/unit/models/schedule_spec.rb +12 -3
  90. metadata +350 -187
  91. data/lib/gooddata/helper/class_helper.rb +0 -1
  92. data/lib/gooddata/helper/helpers.rb +0 -8
@@ -0,0 +1,96 @@
1
+ # encoding: UTF-8
2
+
3
+ require 'gooddata/models/profile'
4
+ require 'gooddata/models/domain'
5
+ require 'gooddata/models/project'
6
+
7
+ describe 'GoodData::Schedule::Params' do
8
+ before(:all) do
9
+ @deploy_dir = File.join(File.dirname(__FILE__), '..', '..', 'data/cc')
10
+ @graph_path = 'graph.grf'
11
+
12
+ @client = ConnectionHelper.create_default_connection
13
+ @project = ProjectHelper.get_default_project
14
+
15
+ @process = @project.deploy_process('./spec/data/cc/graph/graph.grf',
16
+ type: 'GRAPH',
17
+ name: 'Test ETL Process')
18
+ end
19
+
20
+ after(:all) do
21
+ @process.delete
22
+ @client.disconnect
23
+ end
24
+
25
+ describe 'params' do
26
+ it 'Works with params' do
27
+ params = {
28
+ :test => '1234'
29
+ }
30
+
31
+ res = @process.create_schedule("0 12 * * *", @graph_path, params: params)
32
+ expect(res).to be_true
33
+ res.delete
34
+ end
35
+
36
+ it 'Works with nested params' do
37
+ params = {
38
+ :test => '1234',
39
+ :nested => {
40
+ :name => 'joe'
41
+ }
42
+ }
43
+
44
+ res = @process.create_schedule("0 12 * * *", @graph_path, params: params)
45
+ expect(res).to be_true
46
+ res.delete
47
+ end
48
+
49
+ it 'Works with array in params' do
50
+ params = {
51
+ :test => '1234',
52
+ :array => [1, 2, 3, 4, 5]
53
+ }
54
+
55
+ res = @process.create_schedule("0 12 * * *", @graph_path, params: params)
56
+ expect(res).to be_true
57
+ res.delete
58
+ end
59
+ end
60
+
61
+ describe 'hiddenParams' do
62
+ it 'Works with hiddenParams' do
63
+ params = {
64
+ :test => '1234'
65
+ }
66
+
67
+ res = @process.create_schedule("0 12 * * *", @graph_path, hiddenParams: params)
68
+ expect(res).to be_true
69
+ res.delete
70
+ end
71
+
72
+ it 'Works with nested hiddenParams' do
73
+ params = {
74
+ :test => '1234',
75
+ :nested => {
76
+ :name => 'joe'
77
+ }
78
+ }
79
+
80
+ res = @process.create_schedule("0 12 * * *", @graph_path, hiddenParams: params)
81
+ expect(res).to be_true
82
+ res.delete
83
+ end
84
+
85
+ it 'Works with array in hiddenParams' do
86
+ params = {
87
+ :test => '1234',
88
+ :array => [1, 2, 3, 4, 5]
89
+ }
90
+
91
+ res = @process.create_schedule("0 12 * * *", @graph_path, hiddenParams: params)
92
+ expect(res).to be_true
93
+ res.delete
94
+ end
95
+ end
96
+ end
@@ -62,6 +62,22 @@ describe GoodData::Profile do
62
62
  Marshal.load(Marshal.dump(obj))
63
63
  end
64
64
 
65
+ describe '#[]' do
66
+ it 'Finds the profile by URL' do
67
+ project = ProjectHelper.get_default_project
68
+ users = project.users
69
+ user = GoodData::Profile[users.first.uri, :client => @client]
70
+ expect(user).to be_kind_of(GoodData::Profile)
71
+ end
72
+
73
+ it 'Finds the profile by ID' do
74
+ project = ProjectHelper.get_default_project
75
+ users = project.users
76
+ user = GoodData::Profile[users.first.uri.split('/').last, :client => @client]
77
+ expect(user).to be_kind_of(GoodData::Profile)
78
+ end
79
+ end
80
+
65
81
  describe '#==' do
66
82
  it 'Returns true for same objects' do
67
83
  user1 = deep_dup(@user)
@@ -1,17 +1,26 @@
1
1
  require 'gooddata/models/schedule'
2
2
 
3
3
  describe GoodData::Schedule do
4
- SCHEDULE_ID = '53e029bde4b035034ad4abb6'
4
+ SCHEDULE_ID = ScheduleHelper::SCHEDULE_ID
5
5
  SCHEDULE_URL = "/gdc/projects/#{ProjectHelper::PROJECT_ID}/schedules/#{SCHEDULE_ID}"
6
6
 
7
7
  @test_cron = '0 15 27 7 *'
8
8
 
9
+ before(:all) do
10
+ @client = ConnectionHelper.create_default_connection
11
+
12
+ @project = ProjectHelper.get_default_project(:client => @client)
13
+
14
+ # ScheduleHelper.remove_old_schedules(@project)
15
+ # ProcessHelper.remove_old_processes(@project)
16
+ end
17
+
9
18
  before(:each) do
10
19
  @client = ConnectionHelper.create_default_connection
11
20
 
12
21
  @project = ProjectHelper.get_default_project(:client => @client)
13
22
 
14
- @project_executable = "./graph/graph.grf"
23
+ @project_executable = './graph/graph.grf'
15
24
 
16
25
  @test_data = {
17
26
  :timezone => 'UTC',
@@ -105,7 +114,7 @@ describe GoodData::Schedule do
105
114
  data[:cron] = nil
106
115
  expect {
107
116
  sched = @project.create_schedule(ProcessHelper::PROCESS_ID, nil, @project_executable, data)
108
- }.to raise_error 'Cron schedule has to be provided'
117
+ }.to raise_error 'trigger schedule has to be provided'
109
118
  end
110
119
 
111
120
  it 'Throws exception when no timezone specified' do