endeca_on_demand 0.9.4 → 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/endeca_on_demand.rb +10 -5
- data/lib/endeca_on_demand/business_rule.rb +17 -0
- data/lib/endeca_on_demand/business_rule_property.rb +12 -0
- data/lib/endeca_on_demand/crumb.rb +1 -3
- data/lib/endeca_on_demand/dimension.rb +3 -3
- data/lib/endeca_on_demand/dimension_value.rb +12 -0
- data/lib/endeca_on_demand/dimension_value_id.rb +1 -3
- data/lib/endeca_on_demand/record.rb +1 -3
- data/lib/endeca_on_demand/search.rb +1 -3
- data/lib/endeca_on_demand/version.rb +1 -1
- metadata +6 -4
- data/lib/endeca_on_demand/rule.rb +0 -17
data/lib/endeca_on_demand.rb
CHANGED
@@ -20,6 +20,11 @@ class EndecaOnDemand
|
|
20
20
|
|
21
21
|
#
|
22
22
|
send_request
|
23
|
+
|
24
|
+
self.instance_variables.each do |instance_variable|
|
25
|
+
# puts "VARS: #{instance_variable}"
|
26
|
+
# self.class_eval("attr_reader :#{instance_variable}")
|
27
|
+
end
|
23
28
|
end
|
24
29
|
|
25
30
|
### API
|
@@ -292,10 +297,10 @@ class EndecaOnDemand
|
|
292
297
|
def add_dimension_values(dimension)
|
293
298
|
unless dimension['DimensionValues'].nil?
|
294
299
|
if dimension['DimensionValues']['DimensionValue'].instance_of?(Hash)
|
295
|
-
@dimension.dimension_values.push(EndecaOnDemand::
|
300
|
+
@dimension.dimension_values.push(EndecaOnDemand::DimensionValue.new(dimension['DimensionValues']['DimensionValue']))
|
296
301
|
elsif dimension['DimensionValues']['DimensionValue'].instance_of?(Array)
|
297
302
|
dimension['DimensionValues']['DimensionValue'].each do |dimension_value|
|
298
|
-
@dimension.dimension_values.push(EndecaOnDemand::
|
303
|
+
@dimension.dimension_values.push(EndecaOnDemand::DimensionValue.new(dimension_value))
|
299
304
|
end
|
300
305
|
end
|
301
306
|
@dimensions.push(@dimension)
|
@@ -312,14 +317,14 @@ class EndecaOnDemand
|
|
312
317
|
unless business_rules_result.nil?
|
313
318
|
business_rules = @response['BusinessRulesResult']['BusinessRules']
|
314
319
|
if business_rules.instance_of?(Hash)
|
315
|
-
business_rule = EndecaOnDemand::
|
320
|
+
business_rule = EndecaOnDemand::BusinessRule.new(business_rules)
|
316
321
|
business_rules.each do |key, value|
|
317
322
|
add_business_rule_properties(value) if key == 'properties'
|
318
323
|
add_business_rule_records(value) if key == 'RecordSet'
|
319
324
|
end
|
320
325
|
elsif business_rules.instance_of?(Array)
|
321
326
|
@response['BusinessRulesResult']['BusinessRules']['BusinessRule'].each do |rule|
|
322
|
-
business_rule = EndecaOnDemand::
|
327
|
+
business_rule = EndecaOnDemand::BusinessRule.new(rule)
|
323
328
|
rule.each do |key, value|
|
324
329
|
add_business_rule_properties(key) if key == 'properties'
|
325
330
|
add_business_rule_records(key) if key == 'RecordSet'
|
@@ -334,7 +339,7 @@ class EndecaOnDemand
|
|
334
339
|
|
335
340
|
# Adds an array of PROPERTIES to each BUSINESS RULE
|
336
341
|
def add_business_rule_properties(value)
|
337
|
-
@business_rule.properties_array.push(EndecaOnDemand::
|
342
|
+
@business_rule.properties_array.push(EndecaOnDemand::BusinessRuleProperty.new(value)) unless value.nil?
|
338
343
|
end
|
339
344
|
|
340
345
|
# Adds an array of RECORDS to each BUSINESS RULE
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class EndecaOnDemand
|
2
|
+
class BusinessRule
|
3
|
+
|
4
|
+
def initialize(business_rule)
|
5
|
+
@properties_array = []
|
6
|
+
@records = []
|
7
|
+
|
8
|
+
business_rule.each do |key, value|
|
9
|
+
self.instance_variable_set(:"@#{key.downcase}", value)
|
10
|
+
self.class_eval("attr_reader :#{key.downcase}")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
attr_reader :properties_array
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -4,11 +4,9 @@ class EndecaOnDemand
|
|
4
4
|
def initialize(crumb)
|
5
5
|
crumb.each do |key, value|
|
6
6
|
self.instance_variable_set(:"@#{key.downcase}", value)
|
7
|
+
self.class_eval("attr_reader :#{key.downcase}")
|
7
8
|
end
|
8
9
|
end
|
9
10
|
|
10
|
-
# is there anyway to do this dynamically?
|
11
|
-
attr_reader :name, :original_id, :id
|
12
|
-
|
13
11
|
end
|
14
12
|
end
|
@@ -6,11 +6,11 @@ class EndecaOnDemand
|
|
6
6
|
|
7
7
|
dimension.each do |key, value|
|
8
8
|
self.instance_variable_set(:"@#{key.downcase}", value)
|
9
|
+
self.class_eval("attr_reader :#{key.downcase}")
|
9
10
|
end
|
10
11
|
end
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
13
|
+
attr_reader :dimension_values
|
14
|
+
|
15
15
|
end
|
16
16
|
end
|
@@ -4,11 +4,9 @@ class EndecaOnDemand
|
|
4
4
|
def initialize(id)
|
5
5
|
id.each do |key, value|
|
6
6
|
self.instance_variable_set(:"@#{key.downcase}", value)
|
7
|
+
self.class_eval("attr_reader :#{key.downcase}")
|
7
8
|
end
|
8
9
|
end
|
9
10
|
|
10
|
-
# is there anyway to do this dynamically?
|
11
|
-
attr_reader :dimensionvalueid
|
12
|
-
|
13
11
|
end
|
14
12
|
end
|
@@ -4,11 +4,9 @@ class EndecaOnDemand
|
|
4
4
|
def initialize(record)
|
5
5
|
record.each do |key, value|
|
6
6
|
self.instance_variable_set(:"@#{key.downcase}", value)
|
7
|
+
self.class_eval("attr_reader :#{key.downcase}")
|
7
8
|
end
|
8
9
|
end
|
9
10
|
|
10
|
-
# is there anyway to do this dynamically?
|
11
|
-
attr_reader :p_name, :p_category_id, :p_dax_item_number, :p_image, :p_price_retail, :p_price_sale, :p_price_sort, :p_url_detail
|
12
|
-
|
13
11
|
end
|
14
12
|
end
|
@@ -4,11 +4,9 @@ class EndecaOnDemand
|
|
4
4
|
def initialize(report)
|
5
5
|
report.each do |key, value|
|
6
6
|
self.instance_variable_set(:"@#{key.downcase}", value)
|
7
|
+
self.class_eval("attr_reader :#{key.downcase}")
|
7
8
|
end
|
8
9
|
end
|
9
10
|
|
10
|
-
# is there anyway to do this dynamically?
|
11
|
-
attr_reader :key, :mode, :relevancerankingsstrategy, :terms
|
12
|
-
|
13
11
|
end
|
14
12
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: endeca_on_demand
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.9.
|
5
|
+
version: 0.9.5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- sdomino
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-08-11 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: crackoid
|
@@ -51,11 +51,13 @@ files:
|
|
51
51
|
- Rakefile
|
52
52
|
- endeca_on_demand.gemspec
|
53
53
|
- lib/endeca_on_demand.rb
|
54
|
+
- lib/endeca_on_demand/business_rule.rb
|
55
|
+
- lib/endeca_on_demand/business_rule_property.rb
|
54
56
|
- lib/endeca_on_demand/crumb.rb
|
55
57
|
- lib/endeca_on_demand/dimension.rb
|
58
|
+
- lib/endeca_on_demand/dimension_value.rb
|
56
59
|
- lib/endeca_on_demand/dimension_value_id.rb
|
57
60
|
- lib/endeca_on_demand/record.rb
|
58
|
-
- lib/endeca_on_demand/rule.rb
|
59
61
|
- lib/endeca_on_demand/search.rb
|
60
62
|
- lib/endeca_on_demand/version.rb
|
61
63
|
homepage: http://github.com/sdomino/endeca_on-demand
|
@@ -81,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
83
|
requirements: []
|
82
84
|
|
83
85
|
rubyforge_project: endeca_on_demand
|
84
|
-
rubygems_version: 1.
|
86
|
+
rubygems_version: 1.8.6
|
85
87
|
signing_key:
|
86
88
|
specification_version: 3
|
87
89
|
summary: Formerly EndecaXml (endeca_xml), This gem provides an easy way for you to use the Thanx Media, Endeca On-Demand Web API
|
@@ -1,17 +0,0 @@
|
|
1
|
-
class EndecaOnDemand
|
2
|
-
class Rule
|
3
|
-
|
4
|
-
def initialize(rule)
|
5
|
-
@properties_array = []
|
6
|
-
@records = []
|
7
|
-
|
8
|
-
rule.each do |key, value|
|
9
|
-
self.instance_variable_set(:"@#{key.downcase}", value)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
# is there anyway to do this dynamically?
|
14
|
-
attr_reader :title, :id, :style, :zone, :recordcount, :recordset, :properties, :properties_array, :records
|
15
|
-
|
16
|
-
end
|
17
|
-
end
|