twb 0.3.3 → 0.3.4
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.
- data/lib/twb.rb +1 -1
- data/lib/twb/datasource.rb +7 -4
- data/lib/twb/workbook.rb +2 -2
- metadata +1 -1
data/lib/twb.rb
CHANGED
data/lib/twb/datasource.rb
CHANGED
@@ -22,7 +22,7 @@ module Twb
|
|
22
22
|
|
23
23
|
@@hasher = Digest::SHA256.new
|
24
24
|
|
25
|
-
attr_reader :node, :name, :caption, :uiname, :connHash, :
|
25
|
+
attr_reader :node, :name, :caption, :uiname, :connHash, :dsclass, :connection, :tables, :localfields, :metadatafields
|
26
26
|
|
27
27
|
def initialize dataSourceNode
|
28
28
|
@node = dataSourceNode
|
@@ -37,7 +37,8 @@ module Twb
|
|
37
37
|
def processConnection
|
38
38
|
@connection = @node.at_xpath('./connection')
|
39
39
|
unless @connection.nil?
|
40
|
-
@
|
40
|
+
@dsclass = @connection.attribute('class').text
|
41
|
+
# note: must use "dsclass" as "class" would override Rubys ".class" Kernel method
|
41
42
|
setConnectionHash
|
42
43
|
loadTables @connection
|
43
44
|
end
|
@@ -72,14 +73,16 @@ module Twb
|
|
72
73
|
def processFields
|
73
74
|
# --
|
74
75
|
@localfields = {}
|
75
|
-
nodes = @node.xpath("./relation/columns/column")
|
76
|
+
nodes = @node.xpath("./connection/relation/columns/column")
|
76
77
|
nodes.each do |node|
|
77
78
|
field = Twb::LocalField.new(node)
|
78
79
|
@localfields[field.name] = field
|
79
80
|
end
|
80
81
|
# --
|
81
82
|
@metadatafields = {}
|
82
|
-
nodes = @node.xpath("./connection/metadata-records/metadata-record")
|
83
|
+
nodes = @node.xpath("./connection/metadata-records/metadata-record[@class='column']")
|
84
|
+
# note: there are other nodes "<metadata-record class='capability'>" whose nature is unclear
|
85
|
+
# these nodes have no value for their <name node, so we're not loading them
|
83
86
|
nodes.each do |node|
|
84
87
|
field = Twb::MetadataField.new(node)
|
85
88
|
@metadatafields[field.name] = field
|
data/lib/twb/workbook.rb
CHANGED
@@ -157,14 +157,14 @@ module Twb
|
|
157
157
|
def ensureDashboardsNodeExists
|
158
158
|
if @dashesNode.nil?
|
159
159
|
@dashesNode = Nokogiri::XML::Node.new "dashboards", @ndoc
|
160
|
-
@dataSourcesNode.add_next_sibling(@dashesNode)
|
160
|
+
# TODO fix this @dataSourcesNode.add_next_sibling(@dashesNode)
|
161
161
|
end
|
162
162
|
end
|
163
163
|
|
164
164
|
def ensureWindowsNodeExists
|
165
165
|
if @windowsnode.nil?
|
166
166
|
@windowsnode = Nokogiri::XML::Node.new "windows", @ndoc
|
167
|
-
@dataSourcesNode.add_next_sibling(@windowsnode)
|
167
|
+
# TODO fix this @dataSourcesNode.add_next_sibling(@windowsnode)
|
168
168
|
end
|
169
169
|
end
|
170
170
|
|