Sha256: f3d41bcbb67d8df85d7226a937fa62a0c463aeb4abe0f1aba73c46fa0b72c1b4

Contents?: true

Size: 637 Bytes

Versions: 21

Compression:

Stored size: 637 Bytes

Contents

class Zendesk2::Client::SearchHelpCenterArticles < Zendesk2::Client::Request
  request_path { |_| "/help_center/articles/search.json" }

  attr_reader :query

  def _mock(query, params={})
    @query = query
    setup(params)
    mock
  end

  def _real(query, params={})
    @query = query
    setup(params)
    real
  end

  def mock
    terms = Hash[query.split(" ").map { |t| t.split(":") }]

    collection = self.data[:help_center_articles].values

    results = collection.select { |v| terms.all?{ |term, condition| v[term.to_s].to_s == condition.to_s } }

    page(results, params: {"query" => query}, root: "results")
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
zendesk2-1.7.5 lib/zendesk2/client/requests/search_help_center_articles.rb
zendesk2-1.7.4 lib/zendesk2/client/requests/search_help_center_articles.rb
zendesk2-1.7.2 lib/zendesk2/client/requests/search_help_center_articles.rb
zendesk2-1.7.1 lib/zendesk2/client/requests/search_help_center_articles.rb
zendesk2-1.7.0 lib/zendesk2/client/requests/search_help_center_articles.rb
zendesk2-1.6.1 lib/zendesk2/client/requests/search_help_center_articles.rb
zendesk2-1.5.17 lib/zendesk2/client/requests/search_help_center_articles.rb
zendesk2-1.5.16 lib/zendesk2/client/requests/search_help_center_articles.rb
zendesk2-1.5.15 lib/zendesk2/client/requests/search_help_center_articles.rb
zendesk2-1.5.14 lib/zendesk2/client/requests/search_help_center_articles.rb
zendesk2-1.5.13 lib/zendesk2/client/requests/search_help_center_articles.rb
zendesk2-1.5.12 lib/zendesk2/client/requests/search_help_center_articles.rb
zendesk2-1.5.11 lib/zendesk2/client/requests/search_help_center_articles.rb
zendesk2-1.5.10 lib/zendesk2/client/requests/search_help_center_articles.rb
zendesk2-1.5.9 lib/zendesk2/client/requests/search_help_center_articles.rb
zendesk2-1.5.8 lib/zendesk2/client/requests/search_help_center_articles.rb
zendesk2-1.5.7 lib/zendesk2/client/requests/search_help_center_articles.rb
zendesk2-1.5.6 lib/zendesk2/client/requests/search_help_center_articles.rb
zendesk2-1.5.5 lib/zendesk2/client/requests/search_help_center_articles.rb
zendesk2-1.5.4 lib/zendesk2/client/requests/search_help_center_articles.rb