endeca_on_demand 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/.travis.yml +3 -0
- data/Gemfile +14 -0
- data/Guardfile +5 -0
- data/{README.rdoc → README.md} +97 -71
- data/Rakefile +4 -0
- data/endeca_on_demand.gemspec +6 -5
- data/lib/endeca_on_demand.rb +11 -299
- data/lib/endeca_on_demand/client.rb +16 -14
- data/lib/endeca_on_demand/collection.rb +29 -27
- data/lib/endeca_on_demand/core_ext.rb +1 -0
- data/lib/endeca_on_demand/core_ext/hash.rb +30 -0
- data/lib/endeca_on_demand/pp.rb +39 -37
- data/lib/endeca_on_demand/proxy.rb +49 -57
- data/lib/endeca_on_demand/query.rb +129 -147
- data/lib/endeca_on_demand/response.rb +50 -41
- data/lib/endeca_on_demand/response/applied_filters.rb +33 -25
- data/lib/endeca_on_demand/response/applied_filters/keyword_redirect.rb +28 -27
- data/lib/endeca_on_demand/response/applied_filters/search_report.rb +36 -33
- data/lib/endeca_on_demand/response/applied_filters/search_report/search.rb +30 -27
- data/lib/endeca_on_demand/response/applied_filters/selected_dimension_value_id.rb +26 -20
- data/lib/endeca_on_demand/response/breadcrumb.rb +26 -20
- data/lib/endeca_on_demand/response/breadcrumb/bread.rb +29 -28
- data/lib/endeca_on_demand/response/business_rules_result.rb +25 -19
- data/lib/endeca_on_demand/response/business_rules_result/business_rule.rb +36 -35
- data/lib/endeca_on_demand/response/dimension.rb +34 -33
- data/lib/endeca_on_demand/response/dimension/dimension_value.rb +28 -35
- data/lib/endeca_on_demand/response/property.rb +29 -22
- data/lib/endeca_on_demand/response/records_set.rb +40 -32
- data/lib/endeca_on_demand/response/records_set/record.rb +43 -36
- data/lib/endeca_on_demand/version.rb +1 -1
- data/spec/endeca_on_demand_spec.rb +11 -0
- data/spec/spec_helper.rb +21 -0
- metadata +59 -29
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/Gemfile
CHANGED
@@ -2,3 +2,17 @@ source "http://rubygems.org"
|
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in endeca_on_demand.gemspec
|
4
4
|
gemspec
|
5
|
+
|
6
|
+
require 'rbconfig'
|
7
|
+
|
8
|
+
if RbConfig::CONFIG['target_os'] =~ /darwin/i
|
9
|
+
gem 'rb-fsevent', '>= 0.4.0', require: false
|
10
|
+
gem 'growl', '~> 1.0.3', require: false
|
11
|
+
elsif RbConfig::CONFIG['target_os'] =~ /linux/i
|
12
|
+
gem 'rb-inotify', '>= 0.8.5', require: false
|
13
|
+
gem 'libnotify', '~> 0.1.3', require: false
|
14
|
+
elsif RbConfig::CONFIG['target_os'] =~ /mswin|mingw/i
|
15
|
+
gem 'win32console', require: false
|
16
|
+
gem 'rb-fchange', '>= 0.0.2', require: false
|
17
|
+
gem 'rb-notifu', '>= 0.0.4', require: false
|
18
|
+
end
|
data/Guardfile
ADDED
data/{README.rdoc → README.md}
RENAMED
@@ -1,131 +1,157 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# EndecaOnDemand
|
2
|
+
|
3
|
+
[![Build Status](https://secure.travis-ci.org/sdomino/endeca_on_demand.png)](http://travis-ci.org/sdomino/endeca_on_demand)
|
4
|
+
|
5
|
+
[![Dependency Status](https://gemnasium.com/sdomino/endeca_on_demand.png?travis)](https://gemnasium.com/sdomino/endeca_on_demand)
|
3
6
|
|
4
7
|
This Endeca On-Demand Web API gem will take a query-string and construct an XML query and send it to an hosted Endeca On-Demand Cluster. It will then parse the response and expose an API for using the response data.
|
5
8
|
|
6
|
-
|
9
|
+
## Features
|
7
10
|
* Provides an easy way for you to use the Thanx Media, Endeca On-Demand Web API
|
8
11
|
* Builds an XML query from a query-string, formatted for the Endeca On-Demand Service
|
9
12
|
* Handles the Endeca On-Demand response XML and exposes methods to use response data
|
10
13
|
|
11
14
|
NOTE: Due to the implementation specific requirements used while creating this gem, I know there are missing features. If you find issues, or can provide me with any specifics about your implementation, I can add more support.
|
12
15
|
|
13
|
-
|
16
|
+
### What I would like to see:
|
17
|
+
|
14
18
|
* Information reguarding the JSON equivelent of this implementation so I can add JSON support
|
15
19
|
* Information reguarding filters, to enhance this functionality
|
16
20
|
* Additional advanced parameters
|
17
|
-
---
|
18
21
|
|
19
|
-
|
20
|
-
|
22
|
+
## Install
|
23
|
+
### Rails
|
21
24
|
|
22
25
|
Add this line to your Gemfile:
|
23
26
|
|
24
|
-
|
27
|
+
```ruby
|
28
|
+
gem 'endeca_on_demand'
|
29
|
+
```
|
25
30
|
|
26
31
|
Then bundle install:
|
27
32
|
|
28
|
-
|
33
|
+
```bash
|
34
|
+
bundle install
|
35
|
+
```
|
29
36
|
|
30
|
-
|
37
|
+
### Non Rails
|
31
38
|
|
32
|
-
|
39
|
+
```ruby
|
40
|
+
gem install endeca_on_demand
|
41
|
+
```
|
33
42
|
|
34
|
-
|
43
|
+
## Usage
|
35
44
|
|
36
|
-
=== Usage
|
37
45
|
EndecaOnDemand constructs an XML query to send to a hosted Endeca On-Demand Cluster, via a query string:
|
38
46
|
NOTE: This is a complete example. Any unneeded option should not be included in the query-string
|
39
47
|
|
40
|
-
|
41
|
-
|
48
|
+
```html
|
49
|
+
<a href='www.example.com/example/catalog?search-key=primary&search-term=name&DimensionValueIds=1,2,3,4&sort-key=name&sort-direction=descending&RecordOffset=0&RecordsPerPage=9&AggregationKey=name&UserProfiles=1,2,3,4&filter=between'>FULL ENDECA REQUEST</a>
|
50
|
+
```
|
51
|
+
|
42
52
|
The following is an example of an empty 'options' hash that would then need to be constructed from a query-string:
|
43
53
|
NOTE: The base options and current category are set manually and not via a query-string
|
44
54
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
}
|
56
|
-
|
55
|
+
```ruby
|
56
|
+
options = {
|
57
|
+
'add_base' => {'RecordsSet' => true, 'Dimensions' => true, 'BusinessRulesResult' => true, 'AppliedFilters' => true},
|
58
|
+
'add_keyword_search' => {},
|
59
|
+
'add_dimension_value_id_navigation' => [],
|
60
|
+
'add_category_navigation_query' => "current_category_id",
|
61
|
+
'add_sorting' => {},
|
62
|
+
'add_paging' => {},
|
63
|
+
'add_advanced_parameters' => {},
|
64
|
+
'add_profiles' => [],
|
65
|
+
'add_filters' => {}
|
66
|
+
}
|
67
|
+
```
|
68
|
+
|
57
69
|
The following is what a prepared 'options' hash would look like (using the above example query-string):
|
58
70
|
NOTE: This is a complete example. It is not necessary to include anything that you don't need, or you may choose to include it and just leave it blank.
|
59
71
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
}
|
71
|
-
|
72
|
+
```ruby
|
73
|
+
options = {
|
74
|
+
'add_base' => {'RecordsSet' => true, 'Dimensions' => true, 'BusinessRulesResult' => true, 'AppliedFilters' => true},
|
75
|
+
'add_keyword_search' => {'searh-key' => 'key', 'search-term' => 'term'},
|
76
|
+
'add_dimension_value_id_navigation' => [1, 2, 3, 4],
|
77
|
+
'add_category_navigation_query' => 1,
|
78
|
+
'add_sorting' => {'sort-key' => 'key', 'sort-direction' => 'Descending'},
|
79
|
+
'add_paging' => {'RecordOffset' => 0, 'RecordsPerPage' => 9},
|
80
|
+
'add_advanced_parameters' => {'AggregationKey' => 'key'},
|
81
|
+
'add_profiles' => [1, 2, 3, 4],
|
82
|
+
'add_filters' => {}
|
83
|
+
}
|
84
|
+
```
|
85
|
+
|
72
86
|
Provide the location of your hosted Endeca On-Demand Cluster (this can be set as a variable or passed directly as a parameter)
|
73
87
|
|
74
|
-
|
88
|
+
```ruby
|
89
|
+
host = 'your/EndecaOnDemand/hosted/cluster'
|
90
|
+
```
|
75
91
|
|
76
92
|
Pass your 'host' and 'options' hash to new EndecaOnDemand
|
77
93
|
|
78
|
-
|
94
|
+
```ruby
|
95
|
+
@endeca = EndecaOnDemand.new(host, options)
|
96
|
+
```
|
79
97
|
|
80
98
|
All of the following have been exposed as part of the API, most of them will also have sub api methods available which will become visible with a .inspect on the object:
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
99
|
+
|
100
|
+
```ruby
|
101
|
+
@endeca.records
|
102
|
+
@endeca.breadcrumbs
|
103
|
+
@endeca.filtercrumbs (Filtercrumbs are breadcrumbs that have been tailored for use as left nav filterables)
|
104
|
+
@endeca.dimensions
|
105
|
+
@endeca.rules
|
106
|
+
@endeca.search_reports
|
107
|
+
@endeca.keyword_redirect
|
108
|
+
@endeca.selected_dimension_value_ids
|
109
|
+
```
|
90
110
|
|
91
111
|
I also exposed some 'debug'-ish type options to the API so you can see a little of what your request/response looks like if your not getting back the results your expecting
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
112
|
+
|
113
|
+
```ruby
|
114
|
+
@endeca.uri
|
115
|
+
@endeca.http
|
116
|
+
@endeca.base
|
117
|
+
@endeca.query
|
118
|
+
@endeca.raw_response
|
119
|
+
@endeca.response
|
120
|
+
@endeca.error
|
121
|
+
```
|
100
122
|
|
101
123
|
Below is an example of how you could access the response data:
|
102
124
|
|
103
|
-
|
104
|
-
|
125
|
+
```ruby
|
126
|
+
@endeca.records.each do |record|
|
127
|
+
puts "----- RECORD: #{record.inspect}"
|
128
|
+
end
|
129
|
+
```
|
105
130
|
|
106
131
|
Each object will then have associated instance variables exposed that will allow you directly call any value on that object:
|
107
132
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
133
|
+
```ruby
|
134
|
+
@endeca.records.each do |record|
|
135
|
+
puts "----- RECORD NAME: #{record.p_name}"
|
136
|
+
end
|
137
|
+
```
|
138
|
+
|
139
|
+
## F.A.Q
|
112
140
|
|
113
|
-
=== F.A.Q
|
114
141
|
* Q: I'm getting a response error saying something about multiple values for model Category
|
115
142
|
* A: You are most likely trying to pass a CategoryId (CID) with DimensionValueId(s) (DVID) that don't match. The DVIDs must belong to the category passed as the CID.
|
116
|
-
---
|
117
143
|
|
118
|
-
|
144
|
+
## TODO
|
145
|
+
|
119
146
|
* Add tests
|
120
147
|
* Build in support for filters
|
121
148
|
* I don't have all the possible advanced parameters, so for now it only handles the default 'AggregationKey'
|
122
149
|
* Search needs some more testing. Currently its only been setup with a basic search, so I'm not aware of what additional parameters might be coming in, and how I may need to handle them
|
123
150
|
* I would love it if this could server for both XML and JSON (and whatever additional formats they offer)
|
124
|
-
---
|
125
151
|
|
126
|
-
|
152
|
+
## CONTACT
|
153
|
+
|
127
154
|
Please contact me with any question, bugs, additions, suggestions, etc.
|
128
|
-
---
|
129
155
|
|
130
|
-
|
156
|
+
## Copyright
|
131
157
|
Copyright (c) 2011 Steve Domino. See LICENSE.txt for further details
|
data/Rakefile
CHANGED
data/endeca_on_demand.gemspec
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
require "endeca_on_demand/version"
|
2
|
+
require File.expand_path('../lib/endeca_on_demand/version.rb', __FILE__)
|
4
3
|
|
5
4
|
Gem::Specification.new do |s|
|
6
5
|
s.name = "endeca_on_demand"
|
@@ -8,7 +7,7 @@ Gem::Specification.new do |s|
|
|
8
7
|
s.platform = Gem::Platform::RUBY
|
9
8
|
s.authors = ['sdomino']
|
10
9
|
s.email = ['sdomino@pagodabox.com']
|
11
|
-
s.homepage = '
|
10
|
+
s.homepage = 'https://github.com/sdomino/endeca_on_demand'
|
12
11
|
s.summary = 'Formerly EndecaXml (endeca_xml), This gem provides an easy way for you to use the Thanx Media, Endeca On-Demand Web API'
|
13
12
|
s.description = 'EndecaOnDemand will take a query-string and construct an XML query and send it to an hosted Endeca On-Demand Cluster. It will then parse the response and expose an API for using the response data.'
|
14
13
|
|
@@ -19,12 +18,14 @@ Gem::Specification.new do |s|
|
|
19
18
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
19
|
s.require_paths = ["lib"]
|
21
20
|
|
22
|
-
s.add_development_dependency '
|
21
|
+
s.add_development_dependency 'bundler'
|
22
|
+
s.add_development_dependency 'guard-rspec'
|
23
23
|
s.add_development_dependency 'pry'
|
24
|
+
s.add_development_dependency 'rake'
|
25
|
+
s.add_development_dependency 'rspec', '~> 2.7.0'
|
24
26
|
|
25
27
|
s.add_dependency 'nokogiri'
|
26
28
|
s.add_dependency 'builder'
|
27
29
|
s.add_dependency 'activesupport', '~> 3.1'
|
28
30
|
s.add_dependency 'i18n'
|
29
|
-
s.add_dependency 'facets'
|
30
31
|
end
|
data/lib/endeca_on_demand.rb
CHANGED
@@ -1,307 +1,19 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
require 'endeca_on_demand/pp'
|
5
|
-
require 'endeca_on_demand/proxy'
|
6
|
-
require 'endeca_on_demand/query'
|
7
|
-
require 'endeca_on_demand/response'
|
1
|
+
module EndecaOnDemand
|
2
|
+
end
|
8
3
|
|
9
|
-
|
4
|
+
require 'active_support/core_ext/hash'
|
10
5
|
|
11
6
|
require 'builder'
|
12
7
|
require 'nokogiri'
|
13
8
|
require 'net/http'
|
14
9
|
require 'uri'
|
15
|
-
require 'open-uri'
|
16
|
-
|
17
|
-
module EndecaOnDemand
|
18
|
-
|
19
|
-
##
|
20
|
-
|
21
|
-
# def initialize(host, options)
|
22
|
-
# unless host.blank?
|
23
|
-
# @body = Builder::XmlMarkup.new(:indent => 2)
|
24
10
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
# #
|
29
|
-
# options.each do |key, value|
|
30
|
-
# self.send(key.to_sym, value) unless value.blank?
|
31
|
-
# end
|
32
|
-
|
33
|
-
# #
|
34
|
-
# send_request
|
35
|
-
|
36
|
-
# self.instance_variables.each do |instance_variable|
|
37
|
-
# # puts "VARS: #{instance_variable}"
|
38
|
-
# # self.class_eval("attr_reader :#{instance_variable}")
|
39
|
-
# end
|
40
|
-
# else
|
41
|
-
# puts "Unable to continue... Make sure \"#{host}\" is a valid thanxmedia host."
|
42
|
-
# end
|
43
|
-
# end
|
44
|
-
|
45
|
-
# ### API
|
46
|
-
# attr_reader :records
|
47
|
-
# attr_reader :breadcrumbs, :filtercrumbs
|
48
|
-
# attr_reader :dimensions
|
49
|
-
# attr_reader :rules
|
50
|
-
# attr_reader :search_reports, :keyword_redirect
|
51
|
-
# attr_reader :selected_dimension_value_ids
|
52
|
-
|
53
|
-
# ## DEBUG
|
54
|
-
# attr_reader :uri, :http
|
55
|
-
# attr_reader :base, :query, :request, :response, :error
|
56
|
-
# ## /DEBUG
|
57
|
-
# ### /API
|
58
|
-
|
59
|
-
# def success?
|
60
|
-
# @error.blank?
|
61
|
-
# end
|
62
|
-
|
63
|
-
# private
|
64
|
-
|
65
|
-
# def method_missing(method, *args, &block)
|
66
|
-
# unless self.instance_variables.include?(:"@#{method}")
|
67
|
-
# puts "#{method} is unavailable."
|
68
|
-
# else
|
69
|
-
# puts "Unable to retrieve #{method} because: #{@error.message}."
|
70
|
-
# end
|
71
|
-
# end
|
72
|
-
|
73
|
-
# ## SEND REQUEST
|
74
|
-
|
75
|
-
# # Completes the endeca XML reqeust by inserting the XML body into the requred 'Query' tags, and sends the request to your hosted Endeca On-Demand Web API
|
76
|
-
# def send_request
|
77
|
-
# @query = Builder::XmlMarkup.new(:indent => 2)
|
78
|
-
# @query.Query do
|
79
|
-
# @query << @body.target!
|
80
|
-
# end
|
81
|
-
|
82
|
-
# begin
|
83
|
-
# # ask Domino what this is?
|
84
|
-
# # @request, @raw_response = @http.post(@uri.path, @query.target!, 'Content-type' => 'application/xml')
|
85
|
-
|
86
|
-
# @response = Nokogiri::XML(fetch_response.body)
|
87
|
-
|
88
|
-
# build_records
|
89
|
-
# build_breadcrumbs
|
90
|
-
# build_dimensions
|
91
|
-
# build_business_rules
|
92
|
-
# build_search_reports
|
93
|
-
# build_selected_dimension_value_ids
|
94
|
-
# build_keyword_redirect
|
95
|
-
# rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, Errno::ECONNREFUSED, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => error
|
96
|
-
# @error = error
|
97
|
-
# end
|
98
|
-
# end
|
99
|
-
|
100
|
-
# ### XML REQUEST ###
|
101
|
-
|
102
|
-
# ## SET REQUEST HOST
|
103
|
-
# def set_host(host)
|
104
|
-
# @uri = URI.parse(host)
|
105
|
-
# @http = Net::HTTP.new(@uri.host, @uri.port)
|
106
|
-
# end
|
107
|
-
|
108
|
-
# ## ADD BASE OPTIONS TO REQUEST
|
109
|
-
# def add_base(options)
|
110
|
-
# options.each do |key, value|
|
111
|
-
# @body.tag!(key, value)
|
112
|
-
# end
|
113
|
-
|
114
|
-
# @base = options
|
115
|
-
# end
|
116
|
-
|
117
|
-
# def fetch_response
|
118
|
-
# @http.post(@uri.path, @query.target!, 'Content-type' => 'application/xml')
|
119
|
-
# end
|
120
|
-
|
121
|
-
# ## BUILD REQUEST BODY
|
122
|
-
|
123
|
-
# # Adds dimension_value_id_navigation to the request via one or more DimensionValueIds (DVID).
|
124
|
-
# # NOTE: If the optional CategoryId (CID) is passed, all DVIDs must belong to the category.
|
125
|
-
# def add_dimension_value_id_navigation(options)
|
126
|
-
# @body.SelectedDimensionValueIds do
|
127
|
-
# options.each do |option|
|
128
|
-
# @body.tag!('DimensionValueId', option)
|
129
|
-
# end
|
130
|
-
# end
|
131
|
-
# end
|
132
|
-
|
133
|
-
# # (OPTIONAL) Adds category_navigation_query to the request via a CID.
|
134
|
-
# # NOTE: If a CID is passed, all DVIDs must belong to the category. Passing a DVID that does not belong to this category will result in an endeca response error.
|
135
|
-
# def add_category_navigation_query(options)
|
136
|
-
# @body.Category do
|
137
|
-
# @body.tag!('CategoryId', options)
|
138
|
-
# end
|
139
|
-
# end
|
140
|
-
|
141
|
-
# # Adds search-key and search-term to the request.
|
142
|
-
# def add_keyword_search(options)
|
143
|
-
# @body.Searches do
|
144
|
-
# @body.Search do
|
145
|
-
# options.each do |key, value|
|
146
|
-
# @body.tag!(key, value)
|
147
|
-
# end
|
148
|
-
# end
|
149
|
-
# end
|
150
|
-
# end
|
151
|
-
|
152
|
-
# # Adds sort-key and sort-direction to the request.
|
153
|
-
# def add_sorting(options)
|
154
|
-
# @body.Sorts do
|
155
|
-
# @body.Sort do
|
156
|
-
# options.each do |key, value|
|
157
|
-
# @body.tag!(key, value)
|
158
|
-
# end
|
159
|
-
# end
|
160
|
-
# end
|
161
|
-
# end
|
162
|
-
|
163
|
-
# # Adds RecordOffset and RecordsPerPage to the request.
|
164
|
-
# def add_paging(options)
|
165
|
-
# options.each do |key, value|
|
166
|
-
# @body.tag!(key, value)
|
167
|
-
# end
|
168
|
-
# end
|
169
|
-
|
170
|
-
# # Adds advanced parameters to the request.
|
171
|
-
# # NOTE: For this implementation I only had the default advanced parameter (AggregationKey) to test with. This has not been tested, and most likely will not work, with any other possible advanced parameters (if any)
|
172
|
-
# def add_advanced_parameters(options)
|
173
|
-
# options.each do |key, value|
|
174
|
-
# @body.tag!(key, value)
|
175
|
-
# end
|
176
|
-
# end
|
177
|
-
|
178
|
-
# # Adds UserProfile(s) to the request.
|
179
|
-
# def add_profiles(options)
|
180
|
-
# @body.UserProfiles do
|
181
|
-
# options.each do |option|
|
182
|
-
# @body.tag!('UserProfile', option)
|
183
|
-
# end
|
184
|
-
# end
|
185
|
-
# end
|
186
|
-
|
187
|
-
# #
|
188
|
-
# def add_filters(options)
|
189
|
-
# # puts "FILTERS: #{options}"
|
190
|
-
# @body.RangeFilters do
|
191
|
-
# options.each do |key, value|
|
192
|
-
# # puts "#{key}: #{value}"
|
193
|
-
# @body.tag!(key, value) do
|
194
|
-
# value.each do |key, value|
|
195
|
-
# @body.tag!(key, value)
|
196
|
-
# end
|
197
|
-
# end unless value.empty?
|
198
|
-
# end
|
199
|
-
# end
|
200
|
-
# # puts @body.target!
|
201
|
-
# end
|
202
|
-
|
203
|
-
# ### RESPONSE XML ###
|
204
|
-
|
205
|
-
# ## BUILD RESPONSE
|
206
|
-
|
207
|
-
# # Builds an array of RECORDS
|
208
|
-
# def build_records
|
209
|
-
# @records = []
|
210
|
-
|
211
|
-
# @record_offset = @response.xpath("//RecordsSet//offset")
|
212
|
-
# @records_per_page = @response.xpath("//RecordsSet//recordsperpage")
|
213
|
-
# @total_record_count = @response.xpath("//RecordsSet//totalrecordcount")
|
214
|
-
|
215
|
-
# unless @response.xpath("//RecordsSet").blank?
|
216
|
-
# @response.xpath("//RecordsSet//Record").each do |record|
|
217
|
-
# @records.push(EndecaOnDemand::Record.new(record))
|
218
|
-
# end
|
219
|
-
# else
|
220
|
-
# puts 'There are no records with this response!'
|
221
|
-
# end
|
222
|
-
# end
|
223
|
-
|
224
|
-
# # Builds an array of BREADCRUMBS
|
225
|
-
# def build_breadcrumbs
|
226
|
-
# @filtercrumbs = []
|
227
|
-
# @breadcrumbs = []
|
228
|
-
|
229
|
-
# unless @response.xpath("//Breadcrumbs").blank?
|
230
|
-
# @response.xpath("//Breadcrumbs//Breads").each do |node|
|
231
|
-
# filtercrumbs = []
|
232
|
-
# node.xpath("./Bread").each do |node|
|
233
|
-
# breadcrumb = EndecaOnDemand::BreadCrumb.new(node)
|
234
|
-
# filtercrumbs.push(breadcrumb)
|
235
|
-
# @breadcrumbs.push(breadcrumb)
|
236
|
-
# end
|
237
|
-
# @filtercrumbs.push(filtercrumbs)
|
238
|
-
# end
|
239
|
-
# else
|
240
|
-
# puts 'There are no breadcrumbs with this response!'
|
241
|
-
# end
|
242
|
-
# end
|
243
|
-
|
244
|
-
# # Builds an array of DIMENSIONS
|
245
|
-
# def build_dimensions
|
246
|
-
# @dimensions = []
|
247
|
-
|
248
|
-
# unless @response.xpath("//Dimensions").blank?
|
249
|
-
# @response.xpath("//Dimensions//Dimension").each do |node|
|
250
|
-
# @dimensions.push(EndecaOnDemand::Dimension.new(node))
|
251
|
-
# end
|
252
|
-
# else
|
253
|
-
# puts 'There are no dimensions with this response!'
|
254
|
-
# end
|
255
|
-
# end
|
256
|
-
|
257
|
-
# # Builds an array of BUSINESS RULES
|
258
|
-
# def build_business_rules
|
259
|
-
# @business_rules_results = []
|
260
|
-
|
261
|
-
# unless @response.xpath("//BusinessRulesResult").blank?
|
262
|
-
# @response.xpath("//BusinessRulesResult//BusinessRules//BusinessRule").each do |node|
|
263
|
-
# @business_rules_results.push(EndecaOnDemand::BusinessRulesResult.new(node))
|
264
|
-
# end
|
265
|
-
# else
|
266
|
-
# puts 'There are no business rules with this response!'
|
267
|
-
# end
|
268
|
-
# end
|
269
|
-
|
270
|
-
# # Builds an array of SEARCH REPORTS includes SEARCH
|
271
|
-
# def build_search_reports
|
272
|
-
# @search_reports = []
|
273
|
-
|
274
|
-
# unless @response.xpath("//AppliedFilters").blank?
|
275
|
-
# unless @response.xpath("//AppliedFilters//SearchReports").blank?
|
276
|
-
# @search_reports.push(EndecaOnDemand::SearchReport.new(@response.xpath("//AppliedFilters//SearchReports//SearchReport")))
|
277
|
-
# else
|
278
|
-
# puts "There are no search reports with this response!"
|
279
|
-
# end
|
280
|
-
# end
|
281
|
-
# end
|
282
|
-
|
283
|
-
# # Builds an array of SELECTED DIMENSION VALUE IDS
|
284
|
-
# def build_selected_dimension_value_ids
|
285
|
-
# @selected_dimension_value_ids = []
|
286
|
-
|
287
|
-
# unless @response.xpath("//AppliedFilters").blank?
|
288
|
-
# unless @response.xpath("//AppliedFilters//SelectedDimensionValueIds").blank?
|
289
|
-
# @response.xpath("//AppliedFilters//SelectedDimnesionValueIds").each do |node|
|
290
|
-
# @selected_dimension_value_ids.push(EndecaOnDemand::SelectedDimensionValueId.new(node))
|
291
|
-
# end
|
292
|
-
# else
|
293
|
-
# puts "There are no selected dimension value ids with this response!"
|
294
|
-
# end
|
295
|
-
# end
|
296
|
-
# end
|
11
|
+
require 'endeca_on_demand/core_ext'
|
12
|
+
require 'endeca_on_demand/pp'
|
13
|
+
require 'endeca_on_demand/proxy'
|
297
14
|
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
# puts "There is no keyword redirectd with this r!"
|
304
|
-
# end
|
305
|
-
# end
|
306
|
-
|
307
|
-
end
|
15
|
+
require 'endeca_on_demand/client'
|
16
|
+
require 'endeca_on_demand/collection'
|
17
|
+
require 'endeca_on_demand/query'
|
18
|
+
require 'endeca_on_demand/response'
|
19
|
+
require 'endeca_on_demand/version'
|