endeca_on_demand 0.9.9.2 → 0.9.9.5

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.
@@ -1,9 +1,10 @@
1
1
  class EndecaOnDemand
2
2
  class BusinessRulesResult < Proxy
3
-
4
- attr_reader :properties
5
3
 
6
4
  require 'endeca_on_demand/business_rules_result/property'
5
+ require 'endeca_on_demand/record_set/record'
6
+
7
+ attr_reader :properties
7
8
 
8
9
  def initialize(business_rules_result)
9
10
  @properties = []
@@ -19,7 +20,7 @@ class EndecaOnDemand
19
20
 
20
21
  if node.name == "RecordSet"
21
22
  node.xpath("./RecordSet//Record").each do |node|
22
- @records.push(EndecaOnDemand::Record.new(node))
23
+ @records.push(EndecaOnDemand::RecordSet::Record.new(node))
23
24
  end
24
25
  end
25
26
 
@@ -0,0 +1,12 @@
1
+ class EndecaOnDemand
2
+ class KeywordRedirect < Proxy
3
+
4
+ def initialize(keyword_redirect)
5
+ keyword_redirect.children.each do |node|
6
+ self.instance_variable_set(:"@#{node.name.downcase}", node.content)
7
+ self.class_eval("attr_reader :#{node.name.downcase}")
8
+ end
9
+ end
10
+
11
+ end
12
+ end
@@ -0,0 +1,14 @@
1
+ class EndecaOnDemand
2
+ class RecordSet
3
+ class Record < Proxy
4
+
5
+ def initialize(record)
6
+ record.children.each do |node|
7
+ self.instance_variable_set(:"@#{node.name.downcase}", node.content)
8
+ self.class_eval("attr_reader :#{node.name.downcase}")
9
+ end
10
+ end
11
+
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,24 @@
1
+ class EndecaOnDemand
2
+ class Record < Proxy
3
+
4
+ require 'endeca_on_demand/record_set/record'
5
+
6
+ attr_reader :records
7
+
8
+ def initialize(record_set)
9
+ @records = []
10
+
11
+ record_set.children.each do |node|
12
+ if node.name == "Record"
13
+ node.xpath("./Record").each do |node|
14
+ @records.push(EndecaOnDemand::RecordSet::Record.new(node))
15
+ end
16
+ else
17
+ self.instance_variable_set(:"@#{node.name.downcase}", node.content)
18
+ self.class_eval("attr_reader :#{node.name.downcase}")
19
+ end
20
+ end
21
+ end
22
+
23
+ end
24
+ end
@@ -0,0 +1,14 @@
1
+ class EndecaOnDemand
2
+ class SearchReport
3
+ class Search < Proxy
4
+
5
+ def initialize(search)
6
+ search.children.each do |node|
7
+ self.instance_variable_set(:"@#{node.name.downcase}", node.content)
8
+ self.class_eval("attr_reader :#{node.name.downcase}")
9
+ end
10
+ end
11
+
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,21 @@
1
+ class EndecaOnDemand
2
+ class SearchReport < Proxy
3
+
4
+ require 'endeca_on_demand/search_report/search'
5
+
6
+ attr_reader :search
7
+
8
+ def initialize(search_report)
9
+ search_report.children.each do |node|
10
+ self.instance_variable_set(:"@#{node.name.downcase}", node.content)
11
+
12
+ node.xpath("//Search").each do |node|
13
+ @search = EndecaOnDemand::SearchReport::Search.new(node)
14
+ end if node.name == "Search"
15
+
16
+ self.class_eval("attr_reader :#{node.name.downcase}")
17
+ end
18
+ end
19
+
20
+ end
21
+ end
@@ -1,12 +1,12 @@
1
1
  class EndecaOnDemand
2
2
  class SelectedDimensionValueId < Proxy
3
3
 
4
- def initialize(id)
5
- id.each do |key, value|
6
- self.instance_variable_set(:"@#{key.downcase}", value)
7
- self.class_eval("attr_reader :#{key.downcase}")
4
+ def initialize(selected_dimension_value_id)
5
+ selected_dimension_value_id.each do |node|
6
+ self.instance_variable_set(:"@#{node.name.downcase}", node.content)
7
+ self.class_eval("attr_reader :#{node.name.downcase}")
8
8
  end
9
9
  end
10
-
10
+
11
11
  end
12
12
  end
@@ -1,3 +1,3 @@
1
1
  class EndecaOnDemand
2
- VERSION = "0.9.9.2"
2
+ VERSION = "0.9.9.5"
3
3
  end
@@ -1,6 +1,6 @@
1
1
  require 'endeca_on_demand/proxy'
2
2
 
3
- Dir["#{File.dirname(__FILE__)}/endeca_on_demand/*"].each { |file| require(file)}
3
+ Dir["#{File.dirname(__FILE__)}/endeca_on_demand/**/*"].each {|file| require(file)}
4
4
 
5
5
  require 'builder'
6
6
  require 'nokogiri'
@@ -18,7 +18,7 @@ class EndecaOnDemand
18
18
 
19
19
  #
20
20
  options.each do |key, value|
21
- self.send(key.to_sym, value) unless value.empty?
21
+ self.send(key.to_sym, value) unless value.blank?
22
22
  end
23
23
 
24
24
  #
@@ -34,11 +34,11 @@ class EndecaOnDemand
34
34
  end
35
35
 
36
36
  ### API
37
- attr_reader :records, :record_offset, :records_per_page, :total_record_count
37
+ attr_reader :records
38
38
  attr_reader :breadcrumbs, :filtercrumbs
39
39
  attr_reader :dimensions
40
40
  attr_reader :rules
41
- attr_reader :searches, :matchedrecordcount, :matchedmode, :applied_search_adjustments, :suggested_search_adjustments
41
+ attr_reader :search_reports, :keyword_redirect
42
42
  attr_reader :selected_dimension_value_ids
43
43
 
44
44
  ## DEBUG
@@ -87,7 +87,9 @@ class EndecaOnDemand
87
87
  build_breadcrumbs
88
88
  build_dimensions
89
89
  build_business_rules
90
- build_applied_filters
90
+ build_search_reports
91
+ build_selected_dimension_value_ids
92
+ build_keyword_redirect
91
93
  end
92
94
 
93
95
  ### XML REQUEST ###
@@ -201,7 +203,7 @@ class EndecaOnDemand
201
203
  @records_per_page = @response.xpath("//RecordsSet//recordsperpage")
202
204
  @total_record_count = @response.xpath("//RecordsSet//totalrecordcount")
203
205
 
204
- unless @response.xpath("//RecordsSet").nil?
206
+ unless @response.xpath("//RecordsSet").blank?
205
207
  @response.xpath("//RecordsSet//Record").each do |record|
206
208
  @records.push(EndecaOnDemand::Record.new(record))
207
209
  end
@@ -215,7 +217,7 @@ class EndecaOnDemand
215
217
  @filtercrumbs = []
216
218
  @breadcrumbs = []
217
219
 
218
- unless @response.xpath("//Breadcrumbs").nil?
220
+ unless @response.xpath("//Breadcrumbs").blank?
219
221
  @response.xpath("//Breadcrumbs//Breads").each do |node|
220
222
  filtercrumbs = []
221
223
  node.xpath("./Bread").each do |node|
@@ -234,7 +236,7 @@ class EndecaOnDemand
234
236
  def build_dimensions
235
237
  @dimensions = []
236
238
 
237
- unless @response.xpath("//Dimensions").nil?
239
+ unless @response.xpath("//Dimensions").blank?
238
240
  @response.xpath("//Dimensions//Dimension").each do |node|
239
241
  @dimensions.push(EndecaOnDemand::Dimension.new(node))
240
242
  end
@@ -247,7 +249,7 @@ class EndecaOnDemand
247
249
  def build_business_rules
248
250
  @business_rules_results = []
249
251
 
250
- unless @response.xpath("//BusinessRulesResult").nil?
252
+ unless @response.xpath("//BusinessRulesResult").blank?
251
253
  @response.xpath("//BusinessRulesResult//BusinessRules//BusinessRule").each do |node|
252
254
  @business_rules_results.push(EndecaOnDemand::BusinessRulesResult.new(node))
253
255
  end
@@ -255,38 +257,41 @@ class EndecaOnDemand
255
257
  puts 'There are no business rules with this response!'
256
258
  end
257
259
  end
258
-
259
- # Builds the SEARCH REPORTS and SELECTED DIMENSION VALUE IDS if included in response
260
- def build_applied_filters
261
- unless @response.xpath("//AppliedFilters").nil?
262
260
 
263
- # Builds an array of SEARCH REPORTS
264
- unless @response.xpath("//AppliedFilters//SearchReports").nil?
265
- @searches = []
266
-
267
- @matchedrecordcount = @response.xpath("//AppliedFilters//SearchReports//SearchReport//matchedrecordcount")
268
- @matchedmode = @response.xpath("//AppliedFilters//SearchReports//SearchReport//matchedmode")
269
- @matchedtermscount = @response.xpath("//AppliedFilters//SearchReports//SearchReport//matchedtermscount")
270
- @applied_search_adjustments = @response.xpath("//AppliedFilters//SearchReports//SearchReport//AppliedSearchAdjustments")
271
- @suggested_search_adjustments = @response.xpath("//AppliedFilters//SearchReports//SearchReport//SuggestedSearchAdjustments")
261
+ # Builds an array of SEARCH REPORTS includes SEARCH
262
+ def build_search_reports
263
+ @search_reports = []
272
264
 
273
- @searches.push(EndecaOnDemand::Search.new(@response.xpath("//AppliedFilters//SearchReports//SearchReport//Search")))
265
+ unless @response.xpath("//AppliedFilters").blank?
266
+ unless @response.xpath("//AppliedFilters//SearchReports").blank?
267
+ @search_reports.push(EndecaOnDemand::SearchReport.new(@response.xpath("//AppliedFilters//SearchReports//SearchReport")))
274
268
  else
275
- puts 'There are no search reports with this response!'
269
+ puts "There are no search reports with this response!"
276
270
  end
271
+ end
272
+ end
277
273
 
278
- # Builds an array of SELECTED DIMENSION VALUE IDS
279
- unless @response.xpath("//AppliedFilters//SelectedDimensionValueIds").nil?
280
- @selected_dimension_value_ids = []
281
-
274
+ # Builds an array of SELECTED DIMENSION VALUE IDS
275
+ def build_selected_dimension_value_ids
276
+ @selected_dimension_value_ids = []
277
+
278
+ unless @response.xpath("//AppliedFilters").blank?
279
+ unless @response.xpath("//AppliedFilters//SelectedDimensionValueIds").blank?
282
280
  @response.xpath("//AppliedFilters//SelectedDimnesionValueIds").each do |node|
283
281
  @selected_dimension_value_ids.push(EndecaOnDemand::SelectedDimensionValueId.new(node))
284
282
  end
285
283
  else
286
284
  puts "There are no selected dimension value ids with this response!"
287
285
  end
286
+ end
287
+ end
288
+
289
+ # Builds a KEYWORD REDIRECT for a given search term
290
+ def build_keyword_redirect
291
+ unless @response.xpath("//KeywordRedirects").blank?
292
+ @keyword_redirect = EndecaOnDemand::KeywordRedirect.new(@response.xpath("//KeywordRedirects"))
288
293
  else
289
- puts 'There were not applied filters with this response!'
294
+ puts "There is no keyword redirectd with this r!"
290
295
  end
291
296
  end
292
297
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: endeca_on_demand
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.9.2
4
+ version: 0.9.9.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-09-08 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70323819948660 !ruby/object:Gem::Requirement
16
+ requirement: &70328031715700 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70323819948660
24
+ version_requirements: *70328031715700
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: nokogiri
27
- requirement: &70323819948140 !ruby/object:Gem::Requirement
27
+ requirement: &70328031713880 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70323819948140
35
+ version_requirements: *70328031713880
36
36
  description: EndecaOnDemand will take a query-string and construct an XML query and
37
37
  send it to an hosted Endeca On-Demand Cluster. It will then parse the response and
38
38
  expose an API for using the response data.
@@ -54,9 +54,12 @@ files:
54
54
  - lib/endeca_on_demand/bread_crumb.rb
55
55
  - lib/endeca_on_demand/business_rules_result.rb
56
56
  - lib/endeca_on_demand/dimension.rb
57
+ - lib/endeca_on_demand/keyword_redirect.rb
57
58
  - lib/endeca_on_demand/proxy.rb
58
- - lib/endeca_on_demand/record.rb
59
- - lib/endeca_on_demand/search.rb
59
+ - lib/endeca_on_demand/record_set.rb
60
+ - lib/endeca_on_demand/record_set/record.rb
61
+ - lib/endeca_on_demand/search_report.rb
62
+ - lib/endeca_on_demand/search_report/search.rb
60
63
  - lib/endeca_on_demand/selected_dimension_value_id.rb
61
64
  - lib/endeca_on_demand/version.rb
62
65
  homepage: http://github.com/sdomino/endeca_on-demand
@@ -1,12 +0,0 @@
1
- class EndecaOnDemand
2
- class Record < Proxy
3
-
4
- def initialize(record)
5
- record.children.each do |node|
6
- self.instance_variable_set(:"@#{node.name.downcase}", node.content)
7
- self.class_eval("attr_reader :#{node.name.downcase}")
8
- end
9
- end
10
-
11
- end
12
- end
@@ -1,12 +0,0 @@
1
- class EndecaOnDemand
2
- class Search < Proxy
3
-
4
- def initialize(report)
5
- report.children.each do |node|
6
- self.instance_variable_set(:"@#{node.name.downcase}", node.content)
7
- self.class_eval("attr_reader :#{node.name.downcase}")
8
- end
9
- end
10
-
11
- end
12
- end