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
@@ -1,24 +1,26 @@
|
|
1
|
-
|
1
|
+
module EndecaOnDemand
|
2
|
+
class Client
|
2
3
|
|
3
|
-
|
4
|
+
include EndecaOnDemand::PP
|
4
5
|
|
5
|
-
|
6
|
+
def inspect_attributes; [ :api, :default_options ]; end
|
6
7
|
|
7
|
-
|
8
|
+
## fields ##
|
8
9
|
|
9
|
-
|
10
|
+
attr_reader :api, :default_options, :query
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
def initialize(api, default_options = {})
|
13
|
+
@api, @default_options = api, default_options.dup.recurse(&:symbolize_keys)
|
14
|
+
end
|
14
15
|
|
15
|
-
|
16
|
+
## associations ##
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
def query(options = {})
|
19
|
+
@query = nil if options.present?
|
20
|
+
@query ||= EndecaOnDemand::Query.new(self, options)
|
21
|
+
end
|
21
22
|
|
22
|
-
|
23
|
+
##
|
23
24
|
|
25
|
+
end
|
24
26
|
end
|
@@ -1,41 +1,43 @@
|
|
1
|
-
|
1
|
+
module EndecaOnDemand
|
2
|
+
class Collection < EndecaOnDemand::Proxy
|
2
3
|
|
3
|
-
|
4
|
+
attr_reader :klass, :target
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
def initialize(klass, target, mapping = nil)
|
7
|
+
@klass, @target = klass, target
|
8
|
+
@target = target.map { |object| @klass.new(mapping, object) } if mapping.present?
|
9
|
+
extend klass.collection_class if klass.respond_to?(:collection_class)
|
10
|
+
end
|
10
11
|
|
11
|
-
|
12
|
+
## override proxy ##
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
14
|
+
def class
|
15
|
+
EndecaOnDemand::Collection
|
16
|
+
end
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
18
|
+
def inspect
|
19
|
+
target.to_a.inspect
|
20
|
+
end
|
20
21
|
|
21
|
-
|
22
|
+
##
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
24
|
+
def where(conditions = {})
|
25
|
+
target.select do |object|
|
26
|
+
conditions.all? do |key,value|
|
27
|
+
value.is_a?(Regexp) ? object.send(key) =~ value : object.send(key) == value
|
28
|
+
end
|
27
29
|
end
|
28
30
|
end
|
29
|
-
end
|
30
31
|
|
31
|
-
|
32
|
+
protected
|
32
33
|
|
33
|
-
|
34
|
-
|
35
|
-
|
34
|
+
def wrap_collection(collection)
|
35
|
+
EndecaOnDemand::Collection.new(klass, collection)
|
36
|
+
end
|
36
37
|
|
37
|
-
|
38
|
-
|
39
|
-
|
38
|
+
def method_missing(name, *args, &block)
|
39
|
+
target.send(name, *args, &block)
|
40
|
+
end
|
40
41
|
|
42
|
+
end
|
41
43
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'endeca_on_demand/core_ext/hash'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# source: https://github.com/rubyworks/facets
|
2
|
+
class Hash
|
3
|
+
|
4
|
+
# Apply a block to hash, and recursively apply that block
|
5
|
+
# to each sub-hash or +types+.
|
6
|
+
#
|
7
|
+
# h = {:a=>1, :b=>{:b1=>1, :b2=>2}}
|
8
|
+
# g = h.recurse{|h| h.inject({}){|h,(k,v)| h[k.to_s] = v; h} }
|
9
|
+
# g #=> {"a"=>1, "b"=>{"b1"=>1, "b2"=>2}}
|
10
|
+
#
|
11
|
+
def recurse(*types, &block)
|
12
|
+
types = [self.class] if types.empty?
|
13
|
+
h = inject({}) do |hash, (key, value)|
|
14
|
+
case value
|
15
|
+
when *types
|
16
|
+
hash[key] = value.recurse(*types, &block)
|
17
|
+
else
|
18
|
+
hash[key] = value
|
19
|
+
end
|
20
|
+
hash
|
21
|
+
end
|
22
|
+
yield h
|
23
|
+
end
|
24
|
+
|
25
|
+
# In place form of #recurse.
|
26
|
+
def recurse!(&block)
|
27
|
+
replace(recurse(&block))
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
data/lib/endeca_on_demand/pp.rb
CHANGED
@@ -1,48 +1,50 @@
|
|
1
|
-
module EndecaOnDemand
|
1
|
+
module EndecaOnDemand
|
2
|
+
module PP
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
4
|
+
def inspect # :nodoc:
|
5
|
+
return super if not respond_to?(:inspect_attributes) or inspect_attributes.blank?
|
6
|
+
attributes = inspect_attributes.reject { |x|
|
7
|
+
begin
|
8
|
+
attribute = send x
|
9
|
+
attribute.blank?
|
10
|
+
rescue NoMethodError
|
11
|
+
true
|
12
|
+
end
|
13
|
+
}.map { |attribute|
|
14
|
+
"#{attribute.to_s.sub(/_\w+/, 's')}=#{send(attribute).inspect}"
|
15
|
+
}.join ' '
|
16
|
+
"#<#{self.class.name}:#{sprintf("0x%x", object_id)} #{attributes}>"
|
17
|
+
end
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
def pretty_print pp # :nodoc:
|
20
|
+
return super if not respond_to?(:inspect_attributes) or inspect_attributes.blank?
|
21
|
+
nice_name = self.class.name
|
22
|
+
pp.group(2, "#(#{nice_name}:#{sprintf("0x%x", object_id)} {", '})') do
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
pp.breakable
|
25
|
+
attrs = inspect_attributes.map { |t|
|
26
|
+
[t, send(t)] if respond_to?(t)
|
27
|
+
}.compact.find_all { |x|
|
28
|
+
x.last.present?
|
29
|
+
}
|
29
30
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
31
|
+
pp.seplist(attrs) do |v|
|
32
|
+
if v.last.class == EndecaOnDemand::Collection
|
33
|
+
pp.group(2, "#{v.first} = [", "]") do
|
34
|
+
pp.breakable
|
35
|
+
pp.seplist(v.last) do |item|
|
36
|
+
pp.pp item
|
37
|
+
end
|
36
38
|
end
|
39
|
+
else
|
40
|
+
pp.text "#{v.first} = "
|
41
|
+
pp.pp v.last
|
37
42
|
end
|
38
|
-
else
|
39
|
-
pp.text "#{v.first} = "
|
40
|
-
pp.pp v.last
|
41
43
|
end
|
42
|
-
|
43
|
-
pp.breakable
|
44
|
+
pp.breakable
|
44
45
|
|
46
|
+
end
|
45
47
|
end
|
46
|
-
end
|
47
48
|
|
49
|
+
end
|
48
50
|
end
|
@@ -1,61 +1,53 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
method
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
attribute.
|
23
|
-
|
24
|
-
|
1
|
+
module EndecaOnDemand
|
2
|
+
class Proxy
|
3
|
+
|
4
|
+
# We undefine most methods to get them sent through to the target.
|
5
|
+
instance_methods.each do |method|
|
6
|
+
undef_method(method) unless
|
7
|
+
method =~ /(^__|^send$|^object_id$|^extend$|^respond_to\?$|^tap$|^inspect$|^pretty_|^class_eval$|^method$|^instance_$)/
|
8
|
+
end
|
9
|
+
|
10
|
+
attr_accessor :xml
|
11
|
+
|
12
|
+
def inspect # :nodoc:
|
13
|
+
return super if not respond_to?(:inspect_attributes) or inspect_attributes.blank?
|
14
|
+
attributes = inspect_attributes.reject { |x|
|
15
|
+
begin
|
16
|
+
attribute = send x
|
17
|
+
attribute.blank?
|
18
|
+
rescue NoMethodError
|
19
|
+
true
|
20
|
+
end
|
21
|
+
}.map { |attribute|
|
22
|
+
"#{attribute.to_s.sub(/_\w+/, 's')}=#{send(attribute).inspect}"
|
23
|
+
}.join ' '
|
24
|
+
"#<#{self.class.name}:#{sprintf("0x%x", object_id)} #{attributes}>"
|
25
|
+
end
|
26
|
+
|
27
|
+
protected
|
28
|
+
|
29
|
+
# Default behavior of method missing should be to delegate all calls
|
30
|
+
# to the target of the proxy. This can be overridden in special cases.
|
31
|
+
#
|
32
|
+
# @param [ String, Symbol ] name The name of the method.
|
33
|
+
# @param [ Array ] *args The arguments passed to the method.
|
34
|
+
def method_missing(name, *args, &block)
|
35
|
+
xml.send(name, *args, &block)
|
36
|
+
end
|
37
|
+
|
38
|
+
def define_getters(lookup)
|
39
|
+
mod = Module.new
|
40
|
+
extend mod
|
41
|
+
send(lookup).keys.each do |key|
|
42
|
+
mod.class_eval <<-RUBY, __FILE__, __LINE__+1
|
43
|
+
|
44
|
+
def #{key}
|
45
|
+
send(#{lookup.inspect})[#{key.inspect}]
|
46
|
+
end
|
47
|
+
|
48
|
+
RUBY
|
25
49
|
end
|
26
|
-
|
27
|
-
"#{attribute.to_s.sub(/_\w+/, 's')}=#{send(attribute).inspect}"
|
28
|
-
}.join ' '
|
29
|
-
"#<#{self.class.name}:#{sprintf("0x%x", object_id)} #{attributes}>"
|
30
|
-
end
|
50
|
+
end
|
31
51
|
|
32
|
-
# def pretty_inspect
|
33
|
-
# respond_to?(:inspection) ?
|
34
|
-
# "#(#{self.class.name} {\n #{inspection.pretty_inspect}\n})" :
|
35
|
-
# super
|
36
|
-
# end
|
37
|
-
|
38
|
-
# def inspect
|
39
|
-
# inspection = []
|
40
|
-
# inspection.concat(options.dup.delete_if { |k,v| v.blank? }.sort_by(&:first).map { |k,v| "#{k}: #{v.inspect}" })
|
41
|
-
# "#<#{self.class.name} #{inspection * ', '}>"
|
42
|
-
# end
|
43
|
-
|
44
|
-
protected
|
45
|
-
|
46
|
-
# Default behavior of method missing should be to delegate all calls
|
47
|
-
# to the target of the proxy. This can be overridden in special cases.
|
48
|
-
#
|
49
|
-
# @param [ String, Symbol ] name The name of the method.
|
50
|
-
# @param [ Array ] *args The arguments passed to the method.
|
51
|
-
def method_missing(name, *args, &block)
|
52
|
-
xml.send(name, *args, &block)
|
53
52
|
end
|
54
|
-
|
55
|
-
# def method_missing(method, *args, &block)
|
56
|
-
# unless self.instance_variables.include?(:"@#{method}")
|
57
|
-
# "#{method} is unavailable."
|
58
|
-
# end
|
59
|
-
# end
|
60
|
-
|
61
53
|
end
|
@@ -1,195 +1,177 @@
|
|
1
|
-
|
1
|
+
module EndecaOnDemand
|
2
|
+
class Query
|
2
3
|
|
3
|
-
|
4
|
+
include EndecaOnDemand::PP
|
4
5
|
|
5
|
-
|
6
|
+
def inspect_attributes; [ :uri, :xml, :errors, :options ]; end
|
6
7
|
|
7
|
-
|
8
|
+
## fields ##
|
8
9
|
|
9
|
-
|
10
|
+
attr_reader :body, :client, :errors, :http, :options, :response, :uri, :xml
|
10
11
|
|
11
|
-
|
12
|
-
|
12
|
+
def initialize(client, options = {})
|
13
|
+
@client, @options = client, options.dup.recurse(&:symbolize_keys)
|
13
14
|
|
14
|
-
|
15
|
-
|
15
|
+
process_options!
|
16
|
+
end
|
16
17
|
|
17
|
-
|
18
|
+
## associations ##
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
20
|
+
def body
|
21
|
+
@body ||= to_xml
|
22
|
+
end
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
24
|
+
def http
|
25
|
+
@http ||= Net::HTTP.new(uri.host, uri.port)
|
26
|
+
end
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
28
|
+
def response
|
29
|
+
@response ||= EndecaOnDemand::Response.new(self, http.post(uri.path, body, 'Content-type' => 'application/xml'))
|
30
|
+
end
|
30
31
|
|
31
|
-
|
32
|
-
|
33
|
-
|
32
|
+
def uri
|
33
|
+
@uri ||= URI.parse(client.api)
|
34
|
+
end
|
34
35
|
|
35
|
-
|
36
|
-
|
37
|
-
|
36
|
+
def xml
|
37
|
+
@xml ||= Nokogiri::XML(body) { |config| config.strict.noblanks }
|
38
|
+
end
|
38
39
|
|
39
|
-
|
40
|
-
|
41
|
-
## xml builder ##
|
42
|
-
|
43
|
-
def to_xml
|
44
|
-
Builder::XmlMarkup.new(indent: 2).tag!(:Query) do |xml|
|
45
|
-
|
46
|
-
Flags(xml)
|
47
|
-
KeywordSearch(xml)
|
48
|
-
NavigationQuery(xml)
|
49
|
-
CategoryNavigationQuery(xml)
|
50
|
-
Sorting(xml)
|
51
|
-
Paging(xml)
|
52
|
-
AdvancedParameters(xml)
|
53
|
-
|
54
|
-
end
|
55
|
-
# @query.Query do
|
56
|
-
# @query << @body.target!
|
57
|
-
# end
|
58
|
-
|
59
|
-
# begin
|
60
|
-
# # ask Domino what this is?
|
61
|
-
# # @request, @raw_response = @http.post(@uri.path, @query.target!, 'Content-type' => 'application/xml')
|
62
|
-
|
63
|
-
# @response = Nokogiri::XML(fetch_response.body)
|
64
|
-
|
65
|
-
# build_records
|
66
|
-
# build_breadcrumbs
|
67
|
-
# build_dimensions
|
68
|
-
# build_business_rules
|
69
|
-
# build_search_reports
|
70
|
-
# build_selected_dimension_value_ids
|
71
|
-
# build_keyword_redirect
|
72
|
-
# rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, Errno::ECONNREFUSED, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => error
|
73
|
-
# @error = error
|
74
|
-
# end
|
75
|
-
end
|
40
|
+
##
|
76
41
|
|
77
|
-
|
42
|
+
## xml builder ##
|
78
43
|
|
79
|
-
|
80
|
-
|
81
|
-
hash.tap do
|
82
|
-
hash[key.to_s.underscore] = value
|
83
|
-
end
|
84
|
-
end.symbolize_keys
|
85
|
-
end
|
44
|
+
def to_xml
|
45
|
+
Builder::XmlMarkup.new(indent: 2).tag!(:Query) do |xml|
|
86
46
|
|
87
|
-
|
88
|
-
|
89
|
-
|
47
|
+
Flags(xml)
|
48
|
+
KeywordSearch(xml)
|
49
|
+
NavigationQuery(xml)
|
50
|
+
CategoryNavigationQuery(xml)
|
51
|
+
Sorting(xml)
|
52
|
+
Paging(xml)
|
53
|
+
AdvancedParameters(xml)
|
90
54
|
|
91
|
-
|
92
|
-
|
93
|
-
end
|
55
|
+
end
|
56
|
+
end
|
94
57
|
|
95
|
-
|
96
|
-
@category ||= options[:category]
|
97
|
-
end
|
58
|
+
### data ###
|
98
59
|
|
99
|
-
|
100
|
-
|
101
|
-
|
60
|
+
def flags
|
61
|
+
@flags ||= options[:flags] = (options[:flags] || {}).inject({}) do |hash,(key,value)|
|
62
|
+
hash.tap do
|
63
|
+
hash[key.to_s.underscore] = value
|
64
|
+
end
|
65
|
+
end.symbolize_keys
|
66
|
+
end
|
102
67
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
paging[:offset] = (paging[:page].to_i * paging[:per_page].to_i rescue 0)
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
68
|
+
def searches
|
69
|
+
@searches ||= options[:searches]
|
70
|
+
end
|
110
71
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
72
|
+
def dimensions
|
73
|
+
@dimensions ||= [*options[:dimensions]]
|
74
|
+
end
|
75
|
+
|
76
|
+
def category
|
77
|
+
@category ||= options[:category]
|
78
|
+
end
|
79
|
+
|
80
|
+
def sorts
|
81
|
+
@sorts ||= options[:sorts]
|
82
|
+
end
|
83
|
+
|
84
|
+
def paging
|
85
|
+
@paging ||= options[:paging] = (options[:paging] || {}).tap do |paging|
|
86
|
+
if paging.has_key?(:page) and paging.has_key?(:per_page)
|
87
|
+
paging[:offset] = (paging[:page].to_i * paging[:per_page].to_i rescue 0)
|
88
|
+
end
|
115
89
|
end
|
116
|
-
|
117
|
-
|
90
|
+
end
|
91
|
+
|
92
|
+
def advanced_parameters
|
93
|
+
@advanced_parameters ||= options[:advanced] = (options[:advanced] || {}).inject({}) do |hash,(key,value)|
|
94
|
+
hash.tap do
|
95
|
+
hash[key.to_s.underscore] = value
|
96
|
+
end
|
97
|
+
end.symbolize_keys
|
98
|
+
end
|
118
99
|
|
119
|
-
|
100
|
+
###
|
120
101
|
|
121
|
-
|
102
|
+
protected
|
122
103
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
104
|
+
def Flags(xml)
|
105
|
+
return if flags.blank?
|
106
|
+
flags.each do |flag,value|
|
107
|
+
xml.tag!(flag.to_s.camelcase, value)
|
108
|
+
end
|
127
109
|
end
|
128
|
-
end
|
129
110
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
111
|
+
def KeywordSearch(xml)
|
112
|
+
return if searches.blank?
|
113
|
+
xml.tag!(:Searches) do
|
114
|
+
searches.each do |key,term|
|
115
|
+
xml.tag!(:Search) do
|
116
|
+
xml.tag!('search-key', key.to_s)
|
117
|
+
xml.tag!('search-term', term.to_s)
|
118
|
+
end
|
137
119
|
end
|
138
120
|
end
|
139
121
|
end
|
140
|
-
end
|
141
122
|
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
123
|
+
def NavigationQuery(xml)
|
124
|
+
return if dimensions.blank?
|
125
|
+
xml.tag!(:SelectedDimensionValueIds) do
|
126
|
+
dimensions.each do |dimension|
|
127
|
+
xml.tag!(:DimensionValueId, dimension)
|
128
|
+
end
|
147
129
|
end
|
148
130
|
end
|
149
|
-
end
|
150
131
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
132
|
+
def CategoryNavigationQuery(xml)
|
133
|
+
return if category.blank?
|
134
|
+
xml.tag!(:Category) do
|
135
|
+
xml.tag!(:CategoryId, category)
|
136
|
+
end
|
155
137
|
end
|
156
|
-
end
|
157
138
|
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
139
|
+
def Sorting(xml)
|
140
|
+
return if sorts.blank?
|
141
|
+
xml.tag!(:Sorts) do
|
142
|
+
sorts.each do |key,direction|
|
143
|
+
xml.tag!(:Sort) do
|
144
|
+
xml.tag!('sort-key', key.to_s)
|
145
|
+
xml.tag!('sort-direction', direction.to_s.capitalize)
|
146
|
+
end
|
165
147
|
end
|
166
148
|
end
|
167
149
|
end
|
168
|
-
end
|
169
150
|
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
151
|
+
def Paging(xml)
|
152
|
+
return if paging.blank?
|
153
|
+
xml.tag!(:RecordOffset, paging[:offset]) if paging.has_key?(:offset)
|
154
|
+
xml.tag!(:RecordsPerPage, paging[:per_page]) if paging.has_key?(:per_page)
|
155
|
+
end
|
175
156
|
|
176
|
-
|
157
|
+
def AdvancedParameters(xml)
|
177
158
|
|
178
|
-
|
159
|
+
end
|
179
160
|
|
180
|
-
|
181
|
-
|
161
|
+
def process_options!
|
162
|
+
new_options = (client.default_options[:query] || {}).dup
|
182
163
|
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
164
|
+
(new_options[:flags] ||= {}).merge!(options[:flags] || {}).recurse(&:symbolize_keys) if options[:flags].present?
|
165
|
+
(new_options[:paging] ||= {}).merge!(options[:paging] || {}).recurse(&:symbolize_keys) if options[:paging].present?
|
166
|
+
(new_options[:searches] ||= {}).merge!(options[:searches] || {}).recurse(&:symbolize_keys) if options[:searches].present?
|
167
|
+
(new_options[:sorts] ||= {}).merge!(options[:sorts] || {}).recurse(&:symbolize_keys) if options[:sorts].present?
|
168
|
+
(new_options[:dimensions] = [*new_options[:dimensions]]).concat [*options[:dimensions]] if options[:dimensions].present?
|
169
|
+
new_options[:category] = options[:category] if options[:category].present?
|
189
170
|
|
190
|
-
|
191
|
-
|
171
|
+
@options = new_options
|
172
|
+
end
|
192
173
|
|
193
|
-
|
174
|
+
##
|
194
175
|
|
176
|
+
end
|
195
177
|
end
|