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
276 277 278 |
# File 'lib/zendesk_api/resources.rb', line 276 def model_key "results" end |
.new(client, attributes) ⇒ Object
Quack like a Resource Creates the correct resource class from the result_type passed in
258 259 260 261 262 263 264 265 266 267 |
# File 'lib/zendesk_api/resources.rb', line 258 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
270 271 272 |
# File 'lib/zendesk_api/resources.rb', line 270 def resource_name "search" end |
.search(client, options = {}) ⇒ Object
Creates a search collection
248 249 250 251 252 253 254 |
# File 'lib/zendesk_api/resources.rb', line 248 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 |