URL Encoder/Decoder converts text into percent-encoded strings or decodes existing URL components back into plain text. Pass any string with an encode or decode action to receive the processed output and your original text.
Add this line to your application's Gemfile:
gem 'apiverve_urlencode'And then execute:
$ bundle installOr install it yourself as:
$ gem install apiverve_urlencodeGet your API key at APIVerve
require 'apiverve_urlencode'
# Initialize the client
client = APIVerve::Urlencode::Client.new(api_key: "YOUR_API_KEY")
# Make a request
response = client.execute({
text: "Hello World & Goodbye",
action: "encode"
})
# Print the response
puts responsebegin
response = client.execute({ text: "Hello World & Goodbye", action: "encode" })
puts response["data"]
rescue APIVerve::Urlencode::ValidationError => e
puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Urlencode::APIError => e
puts "API error: #{e.message}"
puts "Status code: #{e.status_code}"
end# Enable debug logging
client = APIVerve::Urlencode::Client.new(
api_key: "YOUR_API_KEY",
debug: true
){
"status": "ok",
"error": null,
"data": {
"action": "encode",
"original": "Hello World & Goodbye",
"encoded": "Hello%20World%20%26%20Goodbye",
"length": 29
}
}For more information, visit the API Documentation.
- Website: https://apiverve.com/marketplace/urlencode?utm_source=ruby&utm_medium=referral&utm_content=readme
- Email: hello@apiverve.com
This gem is available under the MIT License.