Method: Kentico::Kontent::Delivery::Tests::FakeResponder.respond_filtering

Defined in:
lib/delivery/tests/fake_responder.rb

.respond_filtering(query) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/delivery/tests/fake_responder.rb', line 45

def respond_filtering(query)
  path =
    case CGI.unescape query
    when 'skip=0&limit=5'
      Pathname.new(File.dirname(__FILE__) + '/filtering/pagination_about_us.json')
    when 'elements.price[gt]=20'
      Pathname.new(File.dirname(__FILE__) + '/filtering/items_gt.json')
    when 'elements.price[gt]=20&system.type=grinder'
      Pathname.new(File.dirname(__FILE__) + '/filtering/multiple.json')
    end
  path.read unless path.nil? && !path.exist?
end