gooddata 0.6.24 → 0.6.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +54 -0
- data/CHANGELOG.md +3 -0
- data/DEPENDENCIES.md +155 -154
- data/README.md +15 -6
- data/Rakefile +5 -3
- data/dependency_decisions.yml +2 -0
- data/gooddata.gemspec +2 -3
- data/lib/gooddata/cli/cli.rb +1 -3
- data/lib/gooddata/cli/commands/auth_cmd.rb +16 -7
- data/lib/gooddata/cli/commands/project_cmd.rb +16 -178
- data/lib/gooddata/cli/shared.rb +46 -44
- data/lib/gooddata/commands/auth.rb +4 -0
- data/lib/gooddata/commands/project.rb +7 -24
- data/lib/gooddata/exceptions/object_migration.rb +4 -0
- data/lib/gooddata/exceptions/segment_not_empty.rb +18 -0
- data/lib/gooddata/extensions/object.rb +12 -0
- data/lib/gooddata/goodzilla/goodzilla.rb +56 -9
- data/lib/gooddata/helpers/global_helpers.rb +92 -0
- data/lib/gooddata/mixins/md_finders.rb +2 -8
- data/lib/gooddata/mixins/md_grantees.rb +42 -0
- data/lib/gooddata/mixins/md_id_to_uri.rb +1 -8
- data/lib/gooddata/mixins/md_object_id.rb +1 -1
- data/lib/gooddata/mixins/md_object_indexer.rb +5 -8
- data/lib/gooddata/mixins/md_object_query.rb +2 -2
- data/lib/gooddata/mixins/not_group.rb +17 -0
- data/lib/gooddata/mixins/rest_getters.rb +2 -2
- data/lib/gooddata/mixins/rest_resource.rb +1 -0
- data/lib/gooddata/mixins/to_json.rb +11 -0
- data/lib/gooddata/mixins/uri_getter.rb +9 -0
- data/lib/gooddata/models/blueprint/anchor_field.rb +14 -0
- data/lib/gooddata/models/blueprint/project_blueprint.rb +15 -1
- data/lib/gooddata/models/blueprint/to_wire.rb +10 -0
- data/lib/gooddata/models/client.rb +178 -0
- data/lib/gooddata/models/client_synchronization_result.rb +31 -0
- data/lib/gooddata/models/client_synchronization_result_details.rb +41 -0
- data/lib/gooddata/models/datawarehouse.rb +1 -5
- data/lib/gooddata/models/domain.rb +85 -1
- data/lib/gooddata/models/execution.rb +0 -2
- data/lib/gooddata/models/execution_detail.rb +0 -2
- data/lib/gooddata/models/from_wire.rb +10 -0
- data/lib/gooddata/models/invitation.rb +1 -1
- data/lib/gooddata/models/links.rb +1 -1
- data/lib/gooddata/models/membership.rb +10 -6
- data/lib/gooddata/models/metadata.rb +98 -11
- data/lib/gooddata/models/metadata/attribute.rb +6 -7
- data/lib/gooddata/models/metadata/dashboard.rb +41 -75
- data/lib/gooddata/models/metadata/dashboard/dashboard_item.rb +20 -4
- data/lib/gooddata/models/metadata/dashboard/filter_apply_item.rb +37 -0
- data/lib/gooddata/models/metadata/dashboard/filter_item.rb +49 -0
- data/lib/gooddata/models/metadata/dashboard/geo_chart_item.rb +56 -0
- data/lib/gooddata/models/metadata/dashboard/headline_item.rb +56 -0
- data/lib/gooddata/models/metadata/dashboard/iframe_item.rb +46 -0
- data/lib/gooddata/models/metadata/dashboard/report_item.rb +49 -8
- data/lib/gooddata/models/metadata/dashboard/text_item.rb +55 -0
- data/lib/gooddata/models/metadata/dashboard_tab.rb +83 -30
- data/lib/gooddata/models/metadata/dataset.rb +0 -2
- data/lib/gooddata/models/metadata/dimension.rb +1 -3
- data/lib/gooddata/models/metadata/fact.rb +1 -3
- data/lib/gooddata/models/metadata/label.rb +1 -3
- data/lib/gooddata/models/metadata/metric.rb +11 -42
- data/lib/gooddata/models/metadata/report.rb +7 -18
- data/lib/gooddata/models/metadata/report_definition.rb +21 -113
- data/lib/gooddata/models/metadata/scheduled_mail.rb +274 -0
- data/lib/gooddata/models/metadata/scheduled_mail/dashboard_attachment.rb +62 -0
- data/lib/gooddata/models/metadata/scheduled_mail/report_attachment.rb +64 -0
- data/lib/gooddata/models/metadata/variable.rb +8 -2
- data/lib/gooddata/models/model.rb +2 -9
- data/lib/gooddata/models/process.rb +7 -29
- data/lib/gooddata/models/profile.rb +1 -1
- data/lib/gooddata/models/project.rb +131 -167
- data/lib/gooddata/models/project_creator.rb +2 -7
- data/lib/gooddata/models/project_metadata.rb +2 -10
- data/lib/gooddata/models/project_role.rb +4 -10
- data/lib/gooddata/models/report_data_result.rb +3 -5
- data/lib/gooddata/models/schedule.rb +4 -31
- data/lib/gooddata/models/segment.rb +192 -0
- data/lib/gooddata/models/user_filters/mandatory_user_filter.rb +2 -2
- data/lib/gooddata/models/user_filters/user_filter_builder.rb +1 -1
- data/lib/gooddata/models/user_filters/variable_user_filter.rb +11 -0
- data/lib/gooddata/models/user_group.rb +241 -0
- data/lib/gooddata/rest/connection.rb +81 -16
- data/lib/gooddata/rest/object.rb +29 -0
- data/lib/gooddata/rest/object_factory.rb +6 -1
- data/lib/gooddata/rest/resource.rb +7 -1
- data/lib/gooddata/version.rb +1 -1
- data/spec/environment/default.rb +19 -16
- data/spec/environment/develop.rb +10 -10
- data/spec/environment/hotfix.rb +6 -6
- data/spec/environment/production.rb +14 -14
- data/spec/environment/release.rb +6 -6
- data/spec/environment/staging.rb +9 -9
- data/spec/environment/staging_3.rb +14 -15
- data/spec/integration/blueprint_with_grain_spec.rb +72 -0
- data/spec/integration/clients_spec.rb +135 -0
- data/spec/integration/date_dim_switch_spec.rb +142 -0
- data/spec/integration/full_project_spec.rb +3 -3
- data/spec/integration/project_spec.rb +20 -0
- data/spec/integration/segments_spec.rb +141 -0
- data/spec/integration/user_group_spec.rb +127 -0
- data/spec/spec_helper.rb +4 -0
- data/spec/unit/models/domain_spec.rb +7 -1
- data/spec/unit/models/metric_spec.rb +0 -8
- data/spec/unit/models/profile_spec.rb +1 -1
- data/spec/unit/models/report_result_data_spec.rb +6 -0
- metadata +38 -38
- data/lib/gooddata/cli/commands/api_cmd.rb +0 -34
- data/lib/gooddata/cli/commands/console_cmd.rb +0 -40
- data/lib/gooddata/cli/commands/domain_cmd.rb +0 -46
- data/lib/gooddata/cli/commands/process_cmd.rb +0 -145
- data/lib/gooddata/cli/commands/projects_cmd.rb +0 -23
- data/lib/gooddata/cli/commands/run_ruby_cmd.rb +0 -77
- data/lib/gooddata/cli/commands/scaffold_cmd.rb +0 -35
- data/lib/gooddata/cli/commands/user_cmd.rb +0 -24
@@ -1,4 +1,8 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2010-2015 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.
|
2
6
|
|
3
7
|
module GoodData
|
4
8
|
# Project Not Found
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2010-2015 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 'restclient/exceptions'
|
8
|
+
|
9
|
+
module GoodData
|
10
|
+
# Project Not Found
|
11
|
+
class SegmentNotEmpty < RuntimeError
|
12
|
+
DEFAULT_MSG = 'Segment you are trying to delete is not empty. Either clean it up or use force: true to force cleanup of clients.'
|
13
|
+
|
14
|
+
def initialize(msg = DEFAULT_MSG)
|
15
|
+
super(msg)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -5,6 +5,13 @@
|
|
5
5
|
# LICENSE file in the root directory of this source tree.
|
6
6
|
|
7
7
|
class Object
|
8
|
+
class << self
|
9
|
+
def set_const(name, val)
|
10
|
+
send(:remove_const, name) if const_defined?(name)
|
11
|
+
send(:const_set, name, val)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
8
15
|
def blank?
|
9
16
|
respond_to?(:empty?) ? empty? : !self
|
10
17
|
end
|
@@ -12,4 +19,9 @@ class Object
|
|
12
19
|
def duplicable?
|
13
20
|
true
|
14
21
|
end
|
22
|
+
|
23
|
+
def set_const(name, val)
|
24
|
+
send(:remove_const, name) if const_defined?(name)
|
25
|
+
send(:const_set, name, val)
|
26
|
+
end
|
15
27
|
end
|
@@ -6,31 +6,46 @@
|
|
6
6
|
|
7
7
|
module GoodData
|
8
8
|
module SmallGoodZilla
|
9
|
-
PARSE_MAQL_OBJECT_REGEXP = /\[([^\]]+)\]/
|
10
|
-
|
11
9
|
class << self
|
12
|
-
#
|
10
|
+
# Scans the provided MAQL and returns Array pairs of [attribute, element] pairs for each element that is found in the definition
|
11
|
+
# @param maql Input MAQL string
|
12
|
+
# @return [Array<Array>] Pairs [attribute, attribute_element]
|
13
|
+
def extract_element_uri_pairs(maql)
|
14
|
+
arr = maql.scan(%r{\[([^\[\]]*)\/elements\?id=(\d+)\]}).flatten
|
15
|
+
evens = arr.select.each_with_index { |_, i| i.even? }
|
16
|
+
odds = arr.select.each_with_index { |_, i| i.odd? }.map(&:to_i)
|
17
|
+
evens.zip(odds)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Scans the provided MAQL and returns Array of all the URIs included in the MAQL. This basically return anything that is enclosed in aquare brackets []
|
21
|
+
# @param maql Input MAQL string
|
22
|
+
# @return [Array<String>] Pairs of URIs
|
23
|
+
def get_uris(a_maql_string)
|
24
|
+
a_maql_string.scan(/\[([^\"\]]+)\]/).flatten.uniq
|
25
|
+
end
|
26
|
+
|
27
|
+
# Get IDs from extendedMAQL string
|
13
28
|
# @param a_maql_string Input MAQL string
|
14
29
|
# @return [Array<String>] List of IDS
|
15
30
|
def get_ids(a_maql_string)
|
16
31
|
a_maql_string.scan(/!\[([^\"\]]+)\]/).flatten.uniq
|
17
32
|
end
|
18
33
|
|
19
|
-
# Get Facts from
|
34
|
+
# Get Facts from extendedMAQL string
|
20
35
|
# @param a_maql_string Input MAQL string
|
21
36
|
# @return [Array<String>] List of Facts
|
22
37
|
def get_facts(a_maql_string)
|
23
38
|
a_maql_string.scan(/#\"([^\"]+)\"/).flatten
|
24
39
|
end
|
25
40
|
|
26
|
-
# Get Attributes from
|
41
|
+
# Get Attributes from extendedMAQL string
|
27
42
|
# @param a_maql_string Input MAQL string
|
28
43
|
# @return [Array<String>] List of Attributes
|
29
44
|
def get_attributes(a_maql_string)
|
30
45
|
a_maql_string.scan(/@\"([^\"]+)\"/).flatten
|
31
46
|
end
|
32
47
|
|
33
|
-
# Get Metrics from
|
48
|
+
# Get Metrics from extendedMAQL string
|
34
49
|
# @param a_maql_string Input MAQL string
|
35
50
|
# @return [Array<String>] List of Metrics
|
36
51
|
def get_metrics(a_maql_string)
|
@@ -39,13 +54,46 @@ module GoodData
|
|
39
54
|
|
40
55
|
alias_method :get_measures, :get_metrics
|
41
56
|
|
57
|
+
# Method takes a specification of the attribute filter (category filter) and returns it representation that is
|
58
|
+
# suitable for posting on the API. The spec is expected to be an array. First object can be an attribute (id, obj_id or
|
59
|
+
# directly an object). Alternativel it can be an attribute (again any representation should work). In case of attribute
|
60
|
+
# primary label is taken. The rest of the array are expected to be String represenation of values of particular label.
|
61
|
+
#
|
62
|
+
# For example it could look like
|
63
|
+
# ['label.states.name', 'California', 'New Jersey', 'Kansas']
|
64
|
+
#
|
65
|
+
# @param spec [Array<Object>] Input MAQL string
|
66
|
+
# @return [Array<Hash>] List of Metrics
|
67
|
+
def create_category_filter(spec, project)
|
68
|
+
item = project.objects(spec.first)
|
69
|
+
label = item.is_a?(GoodData::Attribute) ? item.primary_label : item
|
70
|
+
col = spec[1..-1].flat_map do |v|
|
71
|
+
case v
|
72
|
+
when Range
|
73
|
+
v.to_a
|
74
|
+
when Symbol
|
75
|
+
[v]
|
76
|
+
else
|
77
|
+
[v.to_s]
|
78
|
+
end
|
79
|
+
end
|
80
|
+
if col.first == :not
|
81
|
+
values = col[1..-1].map { |v| label.find_value_uri(v) }
|
82
|
+
elements = values.map { |v| "[#{v}]" }.join(', ')
|
83
|
+
{ expression: "[#{label.attribute.uri}] NOT IN (#{elements})" }
|
84
|
+
else
|
85
|
+
values = col.map { |v| label.find_value_uri(v) }
|
86
|
+
elements = values.map { |v| "[#{v}]" }.join(', ')
|
87
|
+
{ expression: "[#{label.attribute.uri}] IN (#{elements})" }
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
42
91
|
# Pretty prints the MAQL expression. This basically means it finds out names of objects and elements and print their values instead of URIs
|
43
92
|
# @param expression [String] Expression to be beautified
|
44
93
|
# @return [String] Pretty printed MAQL expression
|
45
94
|
def pretty_print(expression, opts = { client: GoodData.connection, project: GoodData.project })
|
46
95
|
temp = expression.dup
|
47
|
-
pairs = expression
|
48
|
-
uri = uri.first
|
96
|
+
pairs = get_uris(expression).pmap do |uri|
|
49
97
|
if uri =~ /elements/
|
50
98
|
begin
|
51
99
|
[uri, Attribute.find_element_value(uri, opts)]
|
@@ -56,7 +104,6 @@ module GoodData
|
|
56
104
|
[uri, GoodData::MdObject[uri, opts].title]
|
57
105
|
end
|
58
106
|
end
|
59
|
-
|
60
107
|
pairs.each do |el|
|
61
108
|
uri = el[0]
|
62
109
|
obj = el[1]
|
@@ -4,8 +4,10 @@
|
|
4
4
|
# This source code is licensed under the BSD-style license found in the
|
5
5
|
# LICENSE file in the root directory of this source tree.
|
6
6
|
|
7
|
+
require 'base64'
|
7
8
|
require 'pathname'
|
8
9
|
require 'hashie'
|
10
|
+
require 'openssl'
|
9
11
|
|
10
12
|
require_relative 'global_helpers_params'
|
11
13
|
|
@@ -34,6 +36,33 @@ module GoodData
|
|
34
36
|
nil
|
35
37
|
end
|
36
38
|
|
39
|
+
# It takes what should be mapped to what and creates a mapping that is suitable for other internal methods.
|
40
|
+
# This means looking up the objects and returning it as array of pairs.
|
41
|
+
# The input can be given in several ways
|
42
|
+
#
|
43
|
+
# 1. Hash. For example it could look like
|
44
|
+
# {'label.states.name' => 'label.state.id'}
|
45
|
+
#
|
46
|
+
# 2 Arrays. In such case the arrays are zipped together. First item will be swapped for the first item in the second array etc.
|
47
|
+
# ['label.states.name'], ['label.state.id']
|
48
|
+
#
|
49
|
+
# @param what [Hash | Array] List/Hash of objects to be swapped
|
50
|
+
# @param for_what [Array] List of objects to be swapped
|
51
|
+
# @return [Array<GoodData::MdObject>] List of pairs of objects
|
52
|
+
def prepare_mapping(what, for_what = nil, options = {})
|
53
|
+
project = options[:project] || (for_what.is_a?(Hash) && for_what[:project]) || fail('Project has to be provided')
|
54
|
+
mapping = if what.is_a?(Hash)
|
55
|
+
whats = what.keys
|
56
|
+
to_whats = what.values
|
57
|
+
whats.zip(to_whats)
|
58
|
+
elsif what.is_a?(Array) && for_what.is_a?(Array)
|
59
|
+
whats.zip(to_whats)
|
60
|
+
else
|
61
|
+
[[what, for_what]]
|
62
|
+
end
|
63
|
+
mapping.pmap { |f, t| [project.objects(f), project.objects(t)] }
|
64
|
+
end
|
65
|
+
|
37
66
|
def get_path(an_object, path = [])
|
38
67
|
return an_object if path.empty?
|
39
68
|
path.reduce(an_object) do |a, e|
|
@@ -215,6 +244,10 @@ module GoodData
|
|
215
244
|
end
|
216
245
|
end
|
217
246
|
|
247
|
+
def parse_http_exception(e)
|
248
|
+
JSON.parse(e.response)
|
249
|
+
end
|
250
|
+
|
218
251
|
# Creates a matrix with zeroes in all places. It is implemented as an Array of Arrays. First rows then columns.
|
219
252
|
#
|
220
253
|
# @param [Integer] m Number of rows
|
@@ -224,6 +257,65 @@ module GoodData
|
|
224
257
|
def zeroes(m, n, val = 0)
|
225
258
|
m.times.map { n.times.map { val } }
|
226
259
|
end
|
260
|
+
|
261
|
+
# encrypts data with the given key. returns a binary data with the
|
262
|
+
# unhashed random iv in the first 16 bytes
|
263
|
+
def encrypt(data, key)
|
264
|
+
cipher = OpenSSL::Cipher::Cipher.new('aes-256-cbc')
|
265
|
+
cipher.encrypt
|
266
|
+
cipher.key = key = Digest::SHA256.digest(key)
|
267
|
+
random_iv = cipher.random_iv
|
268
|
+
cipher.iv = Digest::SHA256.digest(random_iv + key)[0..15]
|
269
|
+
encrypted = cipher.update(data)
|
270
|
+
encrypted << cipher.final
|
271
|
+
# add unhashed iv to front of encrypted data
|
272
|
+
|
273
|
+
Base64.encode64(random_iv + encrypted)
|
274
|
+
end
|
275
|
+
|
276
|
+
def decrypt(data_base_64, key)
|
277
|
+
return '' if key.nil? || key.empty?
|
278
|
+
|
279
|
+
data = Base64.decode64(data_base_64)
|
280
|
+
|
281
|
+
cipher = OpenSSL::Cipher::Cipher.new('aes-256-cbc')
|
282
|
+
cipher.decrypt
|
283
|
+
cipher.key = cipher_key = Digest::SHA256.digest(key)
|
284
|
+
random_iv = data[0..15] # extract iv from first 16 bytes
|
285
|
+
data = data[16..data.size - 1]
|
286
|
+
cipher.iv = Digest::SHA256.digest(random_iv + cipher_key)[0..15]
|
287
|
+
begin
|
288
|
+
decrypted = cipher.update(data)
|
289
|
+
decrypted << cipher.final
|
290
|
+
rescue
|
291
|
+
puts 'Error'
|
292
|
+
return nil
|
293
|
+
end
|
294
|
+
|
295
|
+
decrypted
|
296
|
+
end
|
297
|
+
end
|
298
|
+
end
|
299
|
+
|
300
|
+
class << self
|
301
|
+
def get_client(opts)
|
302
|
+
client = opts[:client]
|
303
|
+
fail ArgumentError, 'No :client specified' if client.nil?
|
304
|
+
|
305
|
+
client
|
306
|
+
end
|
307
|
+
|
308
|
+
def get_client_and_project(opts)
|
309
|
+
client = opts[:client]
|
310
|
+
fail ArgumentError, 'No :client specified' if client.nil?
|
311
|
+
|
312
|
+
p = opts[:project]
|
313
|
+
fail ArgumentError, 'No :project specified' if p.nil?
|
314
|
+
|
315
|
+
project = GoodData::Project[p, opts]
|
316
|
+
fail ArgumentError, 'Wrong :project specified' if project.nil?
|
317
|
+
|
318
|
+
[client, project]
|
227
319
|
end
|
228
320
|
end
|
229
321
|
end
|
@@ -38,15 +38,9 @@ module GoodData
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def find_by_tag(tag, opts = { :client => GoodData.connection, :project => GoodData.project })
|
41
|
-
|
41
|
+
client, project = GoodData.get_client_and_project(opts)
|
42
42
|
|
43
|
-
|
44
|
-
fail ArgumentError, 'No :project specified' if p.nil?
|
45
|
-
|
46
|
-
project = GoodData::Project[p, opts]
|
47
|
-
fail ArgumentError 'Wrong :project specified' if project.nil?
|
48
|
-
|
49
|
-
self[:all, client: c, project: project].select { |r| r.tags.split(',').include?(tag) }
|
43
|
+
self[:all, client: client, project: project].select { |r| r.tag_set.include?(tag) }
|
50
44
|
end
|
51
45
|
|
52
46
|
# Finds a specific type of the object by title. Returns first match. Returns full object.
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2010-2015 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 Mixin
|
9
|
+
module MdGrantees
|
10
|
+
def grantees(opts = {})
|
11
|
+
permission = opts[:permission]
|
12
|
+
params = permission ? { permission: permission } : {}
|
13
|
+
client.get(uri + '/grantees', params: params)
|
14
|
+
end
|
15
|
+
|
16
|
+
def grant(opts = {})
|
17
|
+
change_permission(opts.merge(operation: :add))
|
18
|
+
end
|
19
|
+
|
20
|
+
def revoke(opts = {})
|
21
|
+
change_permission(opts.merge(operation: :remove))
|
22
|
+
end
|
23
|
+
|
24
|
+
def change_permission(opts)
|
25
|
+
permission = opts[:permission]
|
26
|
+
member = opts[:member]
|
27
|
+
op = opts[:operation]
|
28
|
+
klasses = [GoodData::Profile, GoodData::UserGroup, GoodData::Membership]
|
29
|
+
fail "Permission has to be set. Current value '#{permission}'" unless permission
|
30
|
+
fail 'Member has to be either user or group' unless klasses.any? { |c| member.is_a?(c) }
|
31
|
+
payload = {
|
32
|
+
granteeURIs: {
|
33
|
+
items: [
|
34
|
+
{ aclEntryURI: { permission: permission, grantee: member.uri } }
|
35
|
+
]
|
36
|
+
}
|
37
|
+
}
|
38
|
+
client.post(uri + '/grantees/' + op.to_s, payload)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -11,14 +11,7 @@ module GoodData
|
|
11
11
|
|
12
12
|
# TODO: Add test
|
13
13
|
def identifier_to_uri(opts = { :client => GoodData.connection, :project => GoodData.project }, *ids)
|
14
|
-
client = opts
|
15
|
-
fail ArgumentError, 'No :client specified' if client.nil?
|
16
|
-
|
17
|
-
p = opts[:project]
|
18
|
-
fail ArgumentError, 'No :project specified' if p.nil?
|
19
|
-
|
20
|
-
project = GoodData::Project[p, opts]
|
21
|
-
fail ArgumentError, 'Wrong :project specified' if project.nil?
|
14
|
+
client, project = GoodData.get_client_and_project(opts)
|
22
15
|
|
23
16
|
uri = project.md[IDENTIFIERS_CFG]
|
24
17
|
response = client.post uri, 'identifierToUri' => ids
|
@@ -16,14 +16,7 @@ module GoodData
|
|
16
16
|
# @return [MdObject] if id is a String or number single object is returned
|
17
17
|
# @return [Array] if :all was provided as an id, list of objects should be returned. Note that this is implemented only in the subclasses. MdObject does not support this since API has no means to return list of all types of objects
|
18
18
|
def [](id, options = { :client => GoodData.connection, :project => GoodData.project })
|
19
|
-
client = options
|
20
|
-
fail ArgumentError, 'No :client specified' if client.nil?
|
21
|
-
|
22
|
-
p = options[:project]
|
23
|
-
fail ArgumentError, 'No :project specified' if p.nil?
|
24
|
-
|
25
|
-
project = GoodData::Project[p, :client => client]
|
26
|
-
fail ArgumentError, 'Wrong :project specified' if project.nil?
|
19
|
+
client, project = GoodData.get_client_and_project(options)
|
27
20
|
|
28
21
|
fail "You have to provide an \"id\" to be searched for." unless id
|
29
22
|
fail(NoProjectError, 'Connect to a project before searching for an object') unless project
|
@@ -51,8 +44,12 @@ module GoodData
|
|
51
44
|
md_class = GoodData::Dashboard
|
52
45
|
when 'report'
|
53
46
|
md_class = GoodData::Report
|
47
|
+
when 'attributeDisplayForm'
|
48
|
+
md_class = GoodData::Label
|
54
49
|
when 'reportDefinition'
|
55
50
|
md_class = GoodData::ReportDefinition
|
51
|
+
when 'dataSet'
|
52
|
+
md_class = GoodData::Dataset
|
56
53
|
else
|
57
54
|
md_class = self
|
58
55
|
end
|
@@ -97,7 +97,7 @@ module GoodData
|
|
97
97
|
project = GoodData::Project[p, opts]
|
98
98
|
fail ArgumentError, 'No :project specified' if project.nil?
|
99
99
|
|
100
|
-
dependency("#{project.md['usedby2']}/#{
|
100
|
+
dependency("#{project.md['usedby2']}/#{uri_obj_id(uri)}", key, opts)
|
101
101
|
end
|
102
102
|
|
103
103
|
alias_method :used_by, :usedby
|
@@ -110,7 +110,7 @@ module GoodData
|
|
110
110
|
project = GoodData::Project[p, opts]
|
111
111
|
fail ArgumentError, 'No :project specified' if project.nil?
|
112
112
|
|
113
|
-
dependency("#{project.md['using2']}/#{
|
113
|
+
dependency("#{project.md['using2']}/#{uri_obj_id(uri)}", key, opts)
|
114
114
|
end
|
115
115
|
|
116
116
|
def usedby?(uri, target_uri, opts = { :client => GoodData.connection, :project => GoodData.project })
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2010-2015 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 Mixin
|
9
|
+
module NotUserGroup
|
10
|
+
# Returns true if the object is a fact false otherwise
|
11
|
+
# @return [Boolean]
|
12
|
+
def user_group?
|
13
|
+
false
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|