Created
March 14, 2023 16:33
-
-
Save sephraim/79d43433634cf295dd697f49df174c1a to your computer and use it in GitHub Desktop.
[Format a URL with parameters]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ACTION_LINK_BASE_URL = URI.parse('https://example.com/service.html') | |
# Action Link URL | |
# | |
# @example Example usage | |
# action_link_url('abc-123-xyz') #=> https://example.com/service.html?id=abc-123-xyz | |
# | |
# @param account_id [String] | |
# @return [String] | |
def action_link_url(account_id) | |
action_link_url = ACTION_LINK_BASE_URL | |
action_link_url.query = URI.encode_www_form(id: account_id) | |
action_link_url.to_s | |
end | |
# Example usage | |
action_link_url('abc-123-xyz') #=> https://example.com/service.html?id=abc-123-xyz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment