twb 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
data/lib/twb.rb CHANGED
@@ -33,6 +33,6 @@ require_relative 'twb/util/xraydashboards'
33
33
  # Represents Tableau Workbooks and their contents.
34
34
  #
35
35
  module Twb
36
- VERSION = '0.3.3'
36
+ VERSION = '0.3.4'
37
37
  end
38
38
 
@@ -22,7 +22,7 @@ module Twb
22
22
 
23
23
  @@hasher = Digest::SHA256.new
24
24
 
25
- attr_reader :node, :name, :caption, :uiname, :connHash, :class, :connection, :tables, :localfields, :metadatafields
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
- @class = @connection.attribute('class').text
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: