Skip to content

Commit 42914e5

Browse files
algolia-botClaraMullerFluf22
committed
feat(specs): add sortBy trigger on Composition Rules (generated)
algolia/api-clients-automation#5707 Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com> Co-authored-by: Clara Muller <5667350+ClaraMuller@users.noreply.github.com> Co-authored-by: Thomas Raffray <Fluf22@users.noreply.github.com>
1 parent 0c5351a commit 42914e5

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

lib/algolia/models/composition/condition.rb

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,17 @@ class Condition
1919
# Filters that trigger the rule. You can add add filters using the syntax `facet:value` so that the rule is triggered, when the specific filter is selected. You can use `filters` on its own or combine it with the `pattern` parameter.
2020
attr_accessor :filters
2121

22+
# Sort criteria that trigger the rule. You can trigger composition rules based on the selected sorting strategy set by the parameter `sortBy`. The rule will trigger if the value passed to `sortBy` matches the one defined in the condition.
23+
attr_accessor :sort_by
24+
2225
# Attribute mapping from ruby-style variable name to JSON key.
2326
def self.attribute_map
2427
{
2528
:pattern => :pattern,
2629
:anchoring => :anchoring,
2730
:context => :context,
28-
:filters => :filters
31+
:filters => :filters,
32+
:sort_by => :sortBy
2933
}
3034
end
3135

@@ -35,7 +39,8 @@ def self.types_mapping
3539
:pattern => :"String",
3640
:anchoring => :"Anchoring",
3741
:context => :"String",
38-
:filters => :"String"
42+
:filters => :"String",
43+
:sort_by => :"String"
3944
}
4045
end
4146

@@ -84,6 +89,10 @@ def initialize(attributes = {})
8489
if attributes.key?(:filters)
8590
self.filters = attributes[:filters]
8691
end
92+
93+
if attributes.key?(:sort_by)
94+
self.sort_by = attributes[:sort_by]
95+
end
8796
end
8897

8998
# Checks equality by comparing each attribute.
@@ -94,7 +103,8 @@ def ==(other)
94103
pattern == other.pattern &&
95104
anchoring == other.anchoring &&
96105
context == other.context &&
97-
filters == other.filters
106+
filters == other.filters &&
107+
sort_by == other.sort_by
98108
end
99109

100110
# @see the `==` method
@@ -106,7 +116,7 @@ def eql?(other)
106116
# Calculates hash code according to all attributes.
107117
# @return [Integer] Hash code
108118
def hash
109-
[pattern, anchoring, context, filters].hash
119+
[pattern, anchoring, context, filters, sort_by].hash
110120
end
111121

112122
# Builds the object from hash

0 commit comments

Comments
 (0)