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

Fail fast on bad URL #413

Merged
merged 4 commits into from
Jul 21, 2017
Merged

Conversation

maschwenk
Copy link
Contributor

@maschwenk maschwenk commented Jul 20, 2017

Closes #412

get_queue_url allows you to optionally specify the account_id of the queue, so this basically programmatically verifies that the queue is correct and verifies that the correct permissions are in place to use the URL in the first place.

http://docs.aws.amazon.com/sdkforruby/api/Aws/SQS/Client.html#get_queue_url

@maschwenk
Copy link
Contributor Author

Man! Reek is no joke. Let me know if you have any suggestions on these

name_or_url.start_with?('https://sqs.') ? set_url(name_or_url) : set_name(name_or_url)
queue_url_params = parse_queue_url_params(name_or_url)
self.name = queue_url_params[:queue_name]
self.url = client.get_queue_url(queue_url_params)
Copy link
Collaborator

Choose a reason for hiding this comment

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

@maschwenk WDYT about something like this for saving a request, since we need to check fifo? anyway, and we don't have to assume URL convention for queues: *_, account_id, queue_name = URI.parse(name_or_url).path.split('/')?

Do you mind also adding a test case queue_spec?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah! forgot you need to check fifo? at some point anyway. Will take a look

@maschwenk
Copy link
Contributor Author

maschwenk commented Jul 20, 2017

Basically just copy-pasted what you had there, changed the names to set_url/set_name to set_by_url/set_by_name as that's a little more informative about what it's doing. Will add a spec as well

@phstc phstc merged commit 711e607 into ruby-shoryuken:master Jul 21, 2017
@phstc
Copy link
Collaborator

phstc commented Jul 21, 2017

@maschwenk looks good. I added a test and merged into master! 🍻

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