URL Encoder/Decoder API - Ruby Gem

URL Encoder/Decoder is a tool for encoding and decoding URL strings. It converts special characters to percent-encoded format and decodes them back for safe URL transmission.

Installation

Add this line to your application's Gemfile:

gem 'apiverve_urlencode'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install apiverve_urlencode

Getting Started

Get your API key at APIVerve

Basic Usage

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 response

Error Handling

begin
  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

Debug Mode

# Enable debug logging
client = APIVerve::Urlencode::Client.new(
  api_key: "YOUR_API_KEY",
  debug: true
)

Example Response

{
  "status": "ok",
  "error": null,
  "data": {
    "action": "encode",
    "original": "Hello World & Goodbye",
    "encoded": "Hello%20World%20%26%20Goodbye",
    "length": 29
  }
}

Documentation

For more information, visit the API Documentation.

Support

License

This gem is available under the MIT License.