Sha256: c773b624f175aca41c3442789d3e05899ac302a30f8c97cda8fd61a95e188a41

Contents?: true

Size: 520 Bytes

Versions: 4

Compression:

Stored size: 520 Bytes

Contents

#!/usr/bin/env ruby

# I use this with OpenRefine: http://openrefine.org/

require "rubygems"
require "json"
require "sinatra"
require "nameable"

get '/*/*.*' do |raw_name, function, type|
  begin
    name = Nameable(raw_name)
  rescue Nameable::Latin::InvalidNameError
    ""
  end

  if type.to_sym == :json
    content_type 'application/json'
    name.to_hash.to_json
  else
    content_type 'text/plain'
    name.send("to_#{function}") if function =~ /^(fullname|nameable|firstname|lastname|middlename)$/
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
nameable-1.1.3 bin/nameable_web_service
nameable-1.1.1 bin/nameable_web_service
nameable-1.1.0 bin/nameable_web_service
nameable-1.0.0 bin/nameable_web_service