Human Name Parser API - Ruby Gem

Human Name Parser is a simple tool for parsing human names into their components. It returns the parsed components of the human name.

Installation

Add this line to your application's Gemfile:

gem 'apiverve_humannameparser'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install apiverve_humannameparser

Getting Started

Get your API key at APIVerve

Basic Usage

require 'apiverve_humannameparser'

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

# Make a request
response = client.execute({ name: "MR. MARTINO PETROS DE FLORENCE (TINO) Jr." })

# Print the response
puts response

Error Handling

begin
  response = client.execute({ name: "MR. MARTINO PETROS DE FLORENCE (TINO) Jr." })
  puts response["data"]
rescue APIVerve::Humannameparser::ValidationError => e
  puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Humannameparser::APIError => e
  puts "API error: #{e.message}"
  puts "Status code: #{e.status_code}"
end

Debug Mode

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

Example Response

{
  "status": "ok",
  "error": null,
  "data": {
    "name": "MR. MARTINO PETROS DE FLORENCE (TINO) Jr.",
    "parsed": {
      "title": "Mr.",
      "first": "Martino",
      "middle": "Petros",
      "last": "de Florence",
      "nick": "Tino",
      "suffix": "Jr."
    },
    "initials": "MPF",
    "formalName": "Mr. de Florence, Martino P. Jr."
  }
}

Documentation

For more information, visit the API Documentation.

Support

License

This gem is available under the MIT License.