MIME Type Lookup API - Ruby Gem

MIME Type Lookup is a tool for looking up MIME types by file extension or finding file extensions by MIME type. It covers all common file types including documents, images, video, audio, and archives.

Installation

Add this line to your application's Gemfile:

gem 'apiverve_mimetypelookup'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install apiverve_mimetypelookup

Getting Started

Get your API key at APIVerve

Basic Usage

require 'apiverve_mimetypelookup'

# Initialize the client
client = APIVerve::Mimetypelookup::Client.new(api_key: "YOUR_API_KEY")

# Make a request
response = client.execute({ extension: "pdf" })

# Print the response
puts response

Error Handling

begin
  response = client.execute({ extension: "pdf" })
  puts response["data"]
rescue APIVerve::Mimetypelookup::ValidationError => e
  puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Mimetypelookup::APIError => e
  puts "API error: #{e.message}"
  puts "Status code: #{e.status_code}"
end

Debug Mode

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

Example Response

{
  "status": "ok",
  "error": null,
  "data": {
    "extension": "pdf",
    "mime_type": "application/pdf",
    "category": "document",
    "description": "PDF document"
  }
}

Documentation

For more information, visit the API Documentation.

Support

License

This gem is available under the MIT License.