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
312 313 314 |
# File 'lib/zendesk_api/resources.rb', line 312 def model_key "results" end |
.new(client, attributes) ⇒ Object
Quack like a Resource Creates the correct resource class from the result_type passed in
294 295 296 297 298 299 300 301 302 303 |
# File 'lib/zendesk_api/resources.rb', line 294 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
306 307 308 |
# File 'lib/zendesk_api/resources.rb', line 306 def resource_name "search" end |
.search(client, options = {}) ⇒ Object
Creates a search collection
284 285 286 287 288 289 290 |
# File 'lib/zendesk_api/resources.rb', line 284 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 |