Skip to content
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

Add TargetFailure #551

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

@fulcanelly fulcanelly requested a review from a team as a code owner August 3, 2023 16:46
Copy link
Contributor

@ecoologic ecoologic left a comment

Choose a reason for hiding this comment

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

Hi @fulcanelly. Thank you for your contribution.

A couple of comments, but mainly, we can't approve any work that doesn't come with tests.

Could you write some unit tests for this?

Thanks again

@@ -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.

class TargetFailure < ReadResource
def target
@client.targets.to_a.find do |target|
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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants