Query String Builder API - Ruby Gem
Query String Builder converts JSON objects into properly formatted URL query strings with optional encoding.
Installation
Add this line to your application's Gemfile:
gem 'apiverve_querystringbuilder'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install apiverve_querystringbuilder
Getting Started
Get your API key at APIVerve
Basic Usage
require 'apiverve_querystringbuilder'
# Initialize the client
client = APIVerve::Querystringbuilder::Client.new(api_key: "YOUR_API_KEY")
# Make a request
response = client.execute({
params: [object Object],
encode: true
})
# Print the response
puts response
Error Handling
begin
response = client.execute({ params: [object Object], encode: true })
puts response["data"]
rescue APIVerve::Querystringbuilder::ValidationError => e
puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Querystringbuilder::APIError => e
puts "API error: #{e.message}"
puts "Status code: #{e.status_code}"
end
Debug Mode
# Enable debug logging
client = APIVerve::Querystringbuilder::Client.new(
api_key: "YOUR_API_KEY",
debug: true
)
Example Response
{
"status": "ok",
"error": null,
"data": {
"queryString": "name=John%20Doe&age=30&city=New%20York&interests=coding&interests=music&interests=travel",
"fullURL": "?name=John%20Doe&age=30&city=New%20York&interests=coding&interests=music&interests=travel",
"encoded": true,
"paramCount": 4
}
}
Documentation
For more information, visit the API Documentation.
Support
- Website: https://apiverve.com/marketplace/querystringbuilder?utm_source=ruby&utm_medium=readme
- Email: hello@apiverve.com
License
This gem is available under the MIT License.