Class: BOSDK::WebiInstance

Inherits:
Object
  • Object
show all
Defined in:
lib/bosdk/webi_instance.rb

Overview

Creates a wrapper around a DocumentInstance

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (WebiInstance) initialize(instance)

Create a new WebiInstance from the provided DocumentInstance



8
9
10
# File 'lib/bosdk/webi_instance.rb', line 8

def initialize(instance)
  @instance = instance
end

Instance Attribute Details

- (Object) instance (readonly)

The underlying DocumentInstance



5
6
7
# File 'lib/bosdk/webi_instance.rb', line 5

def instance
  @instance
end

Instance Method Details

- (Object) objects

Returns an array of hashes representing report objects.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/bosdk/webi_instance.rb', line 13

def objects
  return @objects unless @objects.nil?
  objs = []
  dict = @instance.getDictionary
  (0 ... dict.getChildCount).each do |i|
    obj = dict.getChildAt(i)
    objs << {
      :name => obj.getName,
      :qual => obj.getQualification.toString.downcase.to_sym,
      :type => obj.getType.toString.downcase.to_sym,
      :object => obj,
    }
  end
  @objects = objs
end

- (Object) variables

Returns an array of hashes representing report variables.



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/bosdk/webi_instance.rb', line 30

def variables
  return @variables unless @variables.nil?
  vars = []
  dict = @instance.getDictionary
  dict.getVariables.each do |var|
    vars << {
      :name => var.getName,
      :qual => var.getQualification.toString.downcase.to_sym,
      :type => var.getType.toString.downcase.to_sym,
      :formula => var.getFormula.getValue,
      :variable => var,
    }
  end
  @variables = vars
end