Skip to content

Latest commit

 

History

History

ruby

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

URL Encoder/Decoder API - Ruby Gem

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.

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.