lib/braintree/advanced_search.rb in braintree-4.15.0 vs lib/braintree/advanced_search.rb in braintree-4.16.0

- old
+ new

@@ -1,8 +1,8 @@ module Braintree - class AdvancedSearch # :nodoc: - class SearchNode # :nodoc: + class AdvancedSearch + class SearchNode def self.operators(*operator_names) operator_names.each do |operator| define_method(operator) do |value| @parent.add_criteria(@node_name, operator => value.to_s) end @@ -12,33 +12,33 @@ def initialize(name, parent) @node_name, @parent = name, parent end end - class IsNode < SearchNode # :nodoc: + class IsNode < SearchNode operators :is end - class EqualityNode < IsNode # :nodoc: + class EqualityNode < IsNode operators :is_not end - class PartialMatchNode < EqualityNode # :nodoc: + class PartialMatchNode < EqualityNode operators :ends_with, :starts_with end - class TextNode < PartialMatchNode # :nodoc: + class TextNode < PartialMatchNode operators :contains end - class KeyValueNode < SearchNode # :nodoc: + class KeyValueNode < SearchNode def is(value) @parent.add_criteria(@node_name, value) end end - class MultipleValueNode < SearchNode # :nodoc: + class MultipleValueNode < SearchNode def in(*values) values.flatten! unless allowed_values.nil? bad_values = values - allowed_values @@ -60,11 +60,11 @@ def is(value) self.in(value) end end - class EndsWithNode < SearchNode # :nodoc: + class EndsWithNode < SearchNode operators :ends_with end class MultipleValueOrTextNode < MultipleValueNode extend Forwardable @@ -74,10 +74,10 @@ super @text_node = TextNode.new(name, parent) end end - class RangeNode < SearchNode # :nodoc: + class RangeNode < SearchNode operators :is def between(min, max) self >= min self <= max