Sha256: 5829660667ac028f6ca0e0741ca13da9f022ef95b470b13d15f50cc0f7893fdb
Contents?: true
Size: 637 Bytes
Versions: 20
Compression:
Stored size: 637 Bytes
Contents
class Zendesk2::Client class Real def search(query) term = query.map{|k,v| "#{k}:#{v}"}.join(" ") request( :method => :get, :params => {query: term}, :path => "/search.json", ) end end # Real class Mock def search(query) type = query.delete("type") collection = type.nil? ? self.data.values : self.data[pluralize(type).to_sym] results = collection.select{|k,v| query.all?{|term, condition| v[term.to_s] == condition}}.values response( :path => "/search.json", :body => {"results" => results}, ) end end # Mock end
Version data entries
20 entries across 20 versions & 1 rubygems