Sha256: 64692b73fdeb00ba8b2501d49c24d7cadda1a1f2b5bf7998e559f89b747c18a0
Contents?: true
Size: 646 Bytes
Versions: 16
Compression:
Stored size: 646 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
16 entries across 16 versions & 1 rubygems