Skip to content

Add TargetFailure #551

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/zendesk_api/resources.rb
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,14 @@ class SuspendedTicket < ReadResource
put :recover
end

class TargetFailure < ReadResource
def target
@client.targets.to_a.find do |target|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you use .all in stead of to_a you should be able to reduce the number of calls in case of pagination.

target.title == self.target_name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the match is done on title, I would suggest naming the method target_by_title. (?? not too sure).

end
end
end

class DeletedTicket < ReadResource
include Destroy
extend DestroyMany
Expand Down