Class: ZendeskAPI::Search
- Inherits:
-
Object
- Object
- ZendeskAPI::Search
- Defined in:
- lib/zendesk_api/resources.rb
Defined Under Namespace
Classes: Result
Class Method Summary collapse
- .model_key ⇒ Object
-
.new(client, attributes) ⇒ Object
Quack like a Resource Creates the correct resource class from the result_type passed in.
- .resource_name ⇒ Object (also: resource_path)
-
.search(client, options = {}) ⇒ Object
Creates a search collection.
Class Method Details
.model_key ⇒ Object
314 315 316 |
# File 'lib/zendesk_api/resources.rb', line 314 def model_key "results" end |
.new(client, attributes) ⇒ Object
Quack like a Resource Creates the correct resource class from the result_type passed in
296 297 298 299 300 301 302 303 304 305 |
# File 'lib/zendesk_api/resources.rb', line 296 def self.new(client, attributes) result_type = attributes["result_type"] if result_type result_type = ZendeskAPI::Helpers.modulize_string(result_type) klass = ZendeskAPI.const_get(result_type) rescue nil end (klass || Result).new(client, attributes) end |
.resource_name ⇒ Object Also known as: resource_path
308 309 310 |
# File 'lib/zendesk_api/resources.rb', line 308 def resource_name "search" end |
.search(client, options = {}) ⇒ Object
Creates a search collection
286 287 288 289 290 291 292 |
# File 'lib/zendesk_api/resources.rb', line 286 def self.search(client, = {}) unless (%w{query external_id} & .keys.map(&:to_s)).any? warn "you have not specified a query for this search" end ZendeskAPI::Collection.new(client, self, ) end |