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

Implement Challenges::Base#[] #139

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

Conversation

sorah
Copy link
Contributor

@sorah sorah commented May 17, 2018

Acme::Client::Resources::Challenges.new may return a Hash instead of Challenges::* when it encountered unsupported challenge type.

When an user is iterating authz#challenges, they have to check a class of an element in prior to use.

Checking challenge#challenge_type is sometime useful than checking challenge#class when an user has a support of additional challenge_type which are uncovered in this gem.

(And I failed here... https://github.com/sorah/acmesmith/blob/5845dbadd7e9a1ad2ebd4731304d8f59b111ae68/lib/acmesmith/client.rb#L205 )

Acme::Client::Resources::Challenges.new may return a Hash instead of
Challenges::* when it encountered unsupported challenge type.

When an user is iterating authz#challenges, they have to check a class
of an element in prior to use.

Checking challenge#challenge_type is sometime useful than checking
challenge#class when an user has a support of additional challenge_type
which are uncovered in this gem.
def [](key)
to_h[key]
end

Copy link
Owner

Choose a reason for hiding this comment

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

I'm not sure why not simply calling #to_h within your app for that use case?

Also, would you prefer to keep them as a challenge object? I could implement an UnknownChallenge and this way you could call status, request_validation, etc, directly on it?

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