Country Flags API - Ruby Gem
Country Flag is a simple tool for getting the country's national flags. It returns the country's national flags.
Installation
Add this line to your application's Gemfile:
gem 'apiverve_countryflags'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install apiverve_countryflags
Getting Started
Get your API key at APIVerve
Basic Usage
require 'apiverve_countryflags'
# Initialize the client
client = APIVerve::Countryflags::Client.new(api_key: "YOUR_API_KEY")
# Make a request
response = client.execute({
country: "ZW",
format: "png",
shape: "circle"
})
# Print the response
puts response
Error Handling
begin
response = client.execute({ country: "ZW", format: "png", shape: "circle" })
puts response["data"]
rescue APIVerve::Countryflags::ValidationError => e
puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Countryflags::APIError => e
puts "API error: #{e.}"
puts "Status code: #{e.status_code}"
end
Debug Mode
# Enable debug logging
client = APIVerve::Countryflags::Client.new(
api_key: "YOUR_API_KEY",
debug: true
)
Example Response
{
"status": "ok",
"error": null,
"data": {
"country": "Zimbabwe",
"countryCode": "ZW",
"shape": "circle",
"format": "png",
"downloadUrl": "https://storage.googleapis.com/apiverve/APIResources/countryflags/circle/png/zw.png?GoogleAccessId=635500398038-compute%40developer.gserviceaccount.com&Expires=1766096512&Signature=EfbtYmSr82YpFvV%2FYWRrlA66wKW4j2%2F2n6EDLGnpwhxd9pXvzBQm4xhNVnwRy3tHCvDTWNQTQUaP9kndqcqm5NBlsfzgJlHpBLPLNt3xRBgXwAm5vmPMfoQY%2B%2BHwmYkxBH1H%2BnIkoWeXEsDLoh1MdwUfvTKKP9PDlCyc2FQUJyZoqXxdshHE9l%2Fv019N9z3AipL7jpmeJQnMTDtos8aCa2I9dm%2FzgpMvi2fdMiRfMCNsjlbyug0h0w6wO1W3FLc3K477psnT4BcXARBmn3dYq4hSSLdmhPnKMpCrYXFnhdxZq0VHXNHid1FwLYuMcp%2FPHIJ1%2Fj2OvqMUPEpip%2Fq%2FpA%3D%3D"
}
}
Documentation
For more information, visit the API Documentation.
Support
- Website: https://apiverve.com/marketplace/countryflags?utm_source=ruby&utm_medium=readme
- Email: hello@apiverve.com
License
This gem is available under the MIT License.