Class: MDEXClient::MData::NavigationResult

Inherits:
Node
  • Object
show all
Defined in:
lib/mdex_client/mdata/navigation_result.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#element

Instance Method Summary collapse

Methods inherited from Node

#css, #dimension_value_state_list, #initialize, #property_list, #record_list, #xpath

Constructor Details

This class inherits a constructor from MDEXClient::MData::Node

Instance Attribute Details

#analyticsObject

Returns the value of attribute analytics.



10
11
12
# File 'lib/mdex_client/mdata/navigation_result.rb', line 10

def analytics
  @analytics
end

#business_rulesObject

Returns the value of attribute business_rules.



10
11
12
# File 'lib/mdex_client/mdata/navigation_result.rb', line 10

def business_rules
  @business_rules
end

#dimension_valuesObject

Returns the value of attribute dimension_values.



10
11
12
# File 'lib/mdex_client/mdata/navigation_result.rb', line 10

def dimension_values
  @dimension_values
end

#dimensionsObject

Returns the value of attribute dimensions.



10
11
12
# File 'lib/mdex_client/mdata/navigation_result.rb', line 10

def dimensions
  @dimensions
end

#eql_expressionObject

Returns the value of attribute eql_expression.



10
11
12
# File 'lib/mdex_client/mdata/navigation_result.rb', line 10

def eql_expression
  @eql_expression
end

#keyword_redirectsObject

Returns the value of attribute keyword_redirects.



10
11
12
# File 'lib/mdex_client/mdata/navigation_result.rb', line 10

def keyword_redirects
  @keyword_redirects
end

#language_idObject

Returns the value of attribute language_id.



10
11
12
# File 'lib/mdex_client/mdata/navigation_result.rb', line 10

def language_id
  @language_id
end

#offsetObject

Returns the value of attribute offset.



10
11
12
# File 'lib/mdex_client/mdata/navigation_result.rb', line 10

def offset
  @offset
end

#range_filtersObject

Returns the value of attribute range_filters.



10
11
12
# File 'lib/mdex_client/mdata/navigation_result.rb', line 10

def range_filters
  @range_filters
end

#record_filterObject

Returns the value of attribute record_filter.



10
11
12
# File 'lib/mdex_client/mdata/navigation_result.rb', line 10

def record_filter
  @record_filter
end

#recordsObject

Returns the value of attribute records.



10
11
12
# File 'lib/mdex_client/mdata/navigation_result.rb', line 10

def records
  @records
end

#records_per_pageObject

Returns the value of attribute records_per_page.



10
11
12
# File 'lib/mdex_client/mdata/navigation_result.rb', line 10

def records_per_page
  @records_per_page
end

#refinement_configsObject

Returns the value of attribute refinement_configs.



10
11
12
# File 'lib/mdex_client/mdata/navigation_result.rb', line 10

def refinement_configs
  @refinement_configs
end

#search_reportsObject

Returns the value of attribute search_reports.



10
11
12
# File 'lib/mdex_client/mdata/navigation_result.rb', line 10

def search_reports
  @search_reports
end

#selected_dimension_value_idsObject

Returns the value of attribute selected_dimension_value_ids.



10
11
12
# File 'lib/mdex_client/mdata/navigation_result.rb', line 10

def selected_dimension_value_ids
  @selected_dimension_value_ids
end

#total_aggregate_record_countObject

Returns the value of attribute total_aggregate_record_count.



10
11
12
# File 'lib/mdex_client/mdata/navigation_result.rb', line 10

def total_aggregate_record_count
  @total_aggregate_record_count
end

#total_record_countObject

Returns the value of attribute total_record_count.



10
11
12
# File 'lib/mdex_client/mdata/navigation_result.rb', line 10

def total_record_count
  @total_record_count
end

Instance Method Details

#add_dimension_values!(values) ⇒ Object



62
63
64
65
66
67
68
# File 'lib/mdex_client/mdata/navigation_result.rb', line 62

def add_dimension_values!(values)
  values.each do |id, value|
    next if @dimension_values[id]
    @dimension_values[id] = value
    add_dimension_values!(value.values)
  end
end

#expose_all_refinements?Boolean

Returns:

  • (Boolean)


70
71
72
# File 'lib/mdex_client/mdata/navigation_result.rb', line 70

def expose_all_refinements?
  @expose_all_refinements
end

#initialize_from_element!Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/mdex_client/mdata/navigation_result.rb', line 16

def initialize_from_element!
  @dimensions = {}
  @dimension_values = {}
  xpath("mdata:Dimensions/mdata:Dimension").each do |child|
    dim = Dimension.new(child)
    @dimensions[dim.id.to_i] = dim
    add_dimension_values!(dim.values)
  end
  
  xpath("mdata:NavigationStatesResult/mdata:DimensionStates/mdata:DimensionState").each do |child|
    dim = @dimensions[child["DimensionId"].to_i]
    dim.initialize_dimension_state!(child, @dimension_values)
  end
          
  refinement_configs = xpath("mdata:NavigationStatesResult/mdata:RefinementConfigs").first
  @expose_all_refinements = (refinement_configs["ExposeAllRefinements"] == "true") if refinement_configs
  @refinement_configs = xpath("mdata:NavigationStatesResult/mdata:RefinementConfigs/mdata:RefinementConfig").collect do |child|
    RefinementConfig.new(child)
  end
  
  records_result = xpath("mdata:RecordsResult").first
  
  @offset = records_result["Offset"].to_i
  @records_per_page = records_result["RecordsPerPage"].to_i
  @total_record_count = records_result["TotalRecordCount"].to_i
  @total_aggregate_record_count = records_result["TotalAggregateRecordCount"].to_i
  @records = record_list("mdata:RecordsResult/mdata:Records")
  
  applied_filters = xpath("mdata:NavigationAppliedFilters")
  if applied_filters.count > 0
    af = Node.new(applied_filters.first)
    @eql_expression = af.xpath("mdata:EqlExpression").text
    @record_filter = af.xpath("mdata:RecordFilter").text
    #TODO: search reports
    @selected_dimension_value_ids = af.xpath("mdata:SelectedDimensionValueIds/mdata:DimensionValueId").collect(&:to_i)
    @language_id = af.xpath("mdata:LanguageId").text
  end
  @range_filters = xpath("mdata:NavigationAppliedFilters/mdata:RangeFilterList").children.collect do |filter|
    RangeFilter.from_element(filter)
  end
  
  #TODO: business rules
  #TODO: keyword redirects
  #TODO: analytics
end