Module: ZendeskAPI::Read
Instance Method Summary collapse
-
#find(client, options = {}) ⇒ Object
Finds a resource by an id and any options passed in.
Instance Method Details
#find(client, options = {}) ⇒ Object
Finds a resource by an id and any options passed in. A custom path to search at can be passed into opts. It defaults to the Data.resource_name of the class.
74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/zendesk_api/actions.rb', line 74 def find(client, = {}) @client = client # so we can use client.logger in rescue raise ArgumentError, "No :id given" unless [:id] || ["id"] || ancestors.include?(SingularResource) association = .delete(:association) || Association.new(:class => self) response = client.connection.get(association.generate_path()) do |req| req.params = end new(client, response.body[singular_resource_name]) end |