Skip to content

namsor/namsor-ruby-sdk2

Repository files navigation

namsor_client

NamSorClient - the Ruby gem for the NamSor API v2

NamSor API v2 : enpoints to process personal names (gender, cultural origin or ethnicity) in all alphabets or languages. Use GET methods for small tests, but prefer POST methods for higher throughput (batch processing of up to 1000 names at a time). Need something you can't find here? We have many more features coming soon. Let us know, we'll do our best to add it!

This SDK is automatically generated by the OpenAPI Generator project:

  • API version: 2.0.2-beta
  • Package version: 0.1.0
  • Build package: org.openapitools.codegen.languages.RubyClientCodegen For more information, please visit http://www.namsor.com/

Installation

Build a gem

To build the Ruby code into a gem:

gem build namsor_client.gemspec

Then either install the gem locally:

gem install ./namsor_client-0.1.0.gem

(for development, run gem install --dev ./namsor_client-0.1.0.gem to install the development dependencies)

or publish the gem to a gem hosting service, e.g. RubyGems.

Finally add this to the Gemfile:

gem 'namsor_client', '~> 0.1.0'

Install from Git

If the Ruby gem is hosted at a git repository: https://github.com/namsor/namsor-ruby-sdk2, then add the following in the Gemfile:

gem 'namsor_client', :git => 'https://github.com/namsor/namsor-ruby-sdk2.git'

Include the Ruby code directly

Include the Ruby code directly using -I as follows:

ruby -Ilib script.rb

Getting Started

Please follow the installation procedure and then run the following code:

# Load the gem
require 'namsor_client'

# Setup authorization
NamSorClient.configure do |config|
  # Configure API key authorization: api_key
  config.api_key['X-API-KEY'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['X-API-KEY'] = 'Bearer'
end

api_instance = NamSorClient::AdminApi.new

begin
  #Print current API usage.
  result = api_instance.api_usage
  p result
rescue NamSorClient::ApiError => e
  puts "Exception when calling AdminApi->api_usage: #{e}"
end

Documentation for API Endpoints

All URIs are relative to https://v2.namsor.com/NamSorAPIv2

Class Method HTTP request Description
NamSorClient::AdminApi api_usage GET /api2/json/apiUsage Print current API usage.
NamSorClient::AdminApi api_usage_history GET /api2/json/apiUsageHistory Print historical API usage.
NamSorClient::AdminApi api_usage_history_aggregate GET /api2/json/apiUsageHistoryAggregate Print historical API usage (in an aggregated view, by service, by day/hour/min).
NamSorClient::AdminApi available_plans GET /api2/json/availablePlans List all available plans in the default currency (usd).
NamSorClient::AdminApi available_plans1 GET /api2/json/availablePlans/{token} List all available plans in the user's preferred currency.
NamSorClient::AdminApi available_services GET /api2/json/apiServices List of API services and usage cost in Units (default is 1=ONE Unit).
NamSorClient::AdminApi billing_currencies GET /api2/json/billingCurrencies List possible currency options for billing (USD, EUR, GBP, ...)
NamSorClient::AdminApi billing_history GET /api2/json/billingHistory/{token} Read the history billing information (invoices paid via Stripe or manually).
NamSorClient::AdminApi billing_info GET /api2/json/billingInfo/{token} Read the billing information (company name, address, phone, vat ID)
NamSorClient::AdminApi charge POST /api2/json/charge Create a Stripe Customer, based on a payment card token (from secure StripeJS) and email.
NamSorClient::AdminApi corporate_key GET /api2/json/corporateKey/{apiKey}/{corporate} Setting an API Key to a corporate status.
NamSorClient::AdminApi debug_level GET /api2/json/debugLevel/{logger}/{level} Update debug level for a classifier
NamSorClient::AdminApi invalidate_cache GET /api2/json/invalidateCache Invalidate system caches.
NamSorClient::AdminApi learnable GET /api2/json/learnable/{source}/{learnable} Activate/deactivate learning from a source.
NamSorClient::AdminApi namsor_counter GET /api2/json/namsorCounter Get the overall API counter
NamSorClient::AdminApi payment_info GET /api2/json/paymentInfo/{token} Get the Stripe payment information associated with the current google auth session token.
NamSorClient::AdminApi procure_key GET /api2/json/procureKey/{token} Procure an API Key (sent via Email), based on an auth token. Keep your API Key secret.
NamSorClient::AdminApi redeploy_ui GET /api2/json/redeployUI Redeploy UI from current dev branch.
NamSorClient::AdminApi redeploy_ui1 GET /api2/json/redeployUI/{live} Redeploy UI from current dev branch.
NamSorClient::AdminApi remove_user_account GET /api2/json/removeUserAccount/{token} Subscribe to a give API plan, using the user's preferred or default currency.
NamSorClient::AdminApi shutdown GET /api2/json/shutdown Stop learning and shutdown system.
NamSorClient::AdminApi software_version GET /api2/json/softwareVersion Get the current software version
NamSorClient::AdminApi source_stats GET /api2/json/sourceStats/{source} Print basic source statistics.
NamSorClient::AdminApi stats GET /api2/json/stats Print basic system statistics.
NamSorClient::AdminApi stripe_connect GET /api2/json/stripeConnect Connects a Stripe Account.
NamSorClient::AdminApi subscribe_plan GET /api2/json/subscribePlan/{planName}/{token} Subscribe to a give API plan, using the user's preferred or default currency.
NamSorClient::AdminApi update_billing_info POST /api2/json/updateBillingInfo/{token} Sets or update the billing information (company name, address, phone, vat ID)
NamSorClient::AdminApi update_limit GET /api2/json/updateLimit/{usageLimit}/{hardOrSoft}/{token} Modifies the hard/soft limit on the API plan's overages (default is 0$ soft limit).
NamSorClient::AdminApi update_payment_default GET /api2/json/updatePaymentDefault/{defautSourceId}/{token} Update the default Stripe card associated with the current google auth session token.
NamSorClient::AdminApi user_info GET /api2/json/userInfo/{token} Get the user profile associated with the current google auth session token.
NamSorClient::AdminApi verify_email GET /api2/json/verifyEmail/{emailToken} Verifies an email, based on token sent to that email
NamSorClient::AdminApi verify_remove_email GET /api2/json/verifyRemoveEmail/{emailToken} Verifies an email, based on token sent to that email
NamSorClient::AdminApi vet GET /api2/json/vetting/{source}/{vetted} Vetting of a source.
NamSorClient::ChineseApi chinese_name_candidates GET /api2/json/chineseNameCandidates/{chineseSurnameLatin}/{chineseGivenNameLatin} Identify Chinese name candidates, based on the romanized name.
NamSorClient::ChineseApi chinese_name_candidates_batch POST /api2/json/chineseNameCandidatesBatch Identify Chinese name candidates, based on the romanized name (firstName = chineseGivenName; lastName=chineseSurname).
NamSorClient::ChineseApi chinese_name_candidates_gender_batch POST /api2/json/chineseNameCandidatesGenderBatch Identify Chinese name candidates, based on the romanized name (firstName = chineseGivenName; lastName=chineseSurname).
NamSorClient::ChineseApi chinese_name_gender_candidates GET /api2/json/chineseNameGenderCandidates/{chineseSurnameLatin}/{chineseGivenNameLatin}/{knownGender} Identify Chinese name candidates, based on the romanized name - having a known gender ('male' or 'female')
NamSorClient::PersonalApi country GET /api2/json/country/{personalNameFull} [USES 10 UNITS] Infer the likely country of residence of a personal full name, or one surname. Assumes names as they are in the country of residence OR the country of origin.
NamSorClient::PersonalApi country_batch POST /api2/json/countryBatch [USES 10 UNITS] Infer the likely country of residence of up to 1000 personal full names, or surnames. Assumes names as they are in the country of residence OR the country of origin.
NamSorClient::PersonalApi diaspora GET /api2/json/diaspora/{countryIso2}/{firstName}/{lastName} [USES 20 UNITS] Infer the likely ethnicity/diaspora of a personal name, given a country of residence ISO2 code (ex. US, CA, AU, NZ etc.)
NamSorClient::PersonalApi diaspora_batch POST /api2/json/diasporaBatch [USES 20 UNITS] Infer the likely ethnicity/diaspora of up to 1000 personal names, given a country of residence ISO2 code (ex. US, CA, AU, NZ etc.)
NamSorClient::PersonalApi gender GET /api2/json/gender/{firstName}/{lastName} Infer the likely gender of a name.
NamSorClient::PersonalApi gender_batch POST /api2/json/genderBatch Infer the likely gender of up to 1000 names, detecting automatically the cultural context.
NamSorClient::PersonalApi gender_full GET /api2/json/genderFull/{fullName} Infer the likely gender of a full name, ex. John H. Smith
NamSorClient::PersonalApi gender_full_batch POST /api2/json/genderFullBatch Infer the likely gender of up to 1000 full names, detecting automatically the cultural context.
NamSorClient::PersonalApi gender_full_geo GET /api2/json/genderFullGeo/{fullName}/{countryIso2} Infer the likely gender of a full name, given a local context (ISO2 country code).
NamSorClient::PersonalApi gender_full_geo_batch POST /api2/json/genderFullGeoBatch Infer the likely gender of up to 1000 full names, with a given cultural context (country ISO2 code).
NamSorClient::PersonalApi gender_geo GET /api2/json/genderGeo/{firstName}/{lastName}/{countryIso2} Infer the likely gender of a name, given a local context (ISO2 country code).
NamSorClient::PersonalApi gender_geo_batch POST /api2/json/genderGeoBatch Infer the likely gender of up to 1000 names, each given a local context (ISO2 country code).
NamSorClient::PersonalApi origin GET /api2/json/origin/{firstName}/{lastName} [USES 10 UNITS] Infer the likely country of origin of a personal name. Assumes names as they are in the country of origin. For US, CA, AU, NZ and other melting-pots : use 'diaspora' instead.
NamSorClient::PersonalApi origin_batch POST /api2/json/originBatch [USES 10 UNITS] Infer the likely country of origin of up to 1000 names, detecting automatically the cultural context.
NamSorClient::PersonalApi parse_name GET /api2/json/parseName/{nameFull} Infer the likely first/last name structure of a name, ex. John Smith or SMITH, John or SMITH; John.
NamSorClient::PersonalApi parse_name_batch POST /api2/json/parseNameBatch Infer the likely first/last name structure of a name, ex. John Smith or SMITH, John or SMITH; John.
NamSorClient::PersonalApi parse_name_geo GET /api2/json/parseName/{nameFull}/{countryIso2} Infer the likely first/last name structure of a name, ex. John Smith or SMITH, John or SMITH; John. For better accuracy, provide a geographic context.
NamSorClient::PersonalApi parse_name_geo_batch POST /api2/json/parseNameGeoBatch Infer the likely first/last name structure of a name, ex. John Smith or SMITH, John or SMITH; John. Giving a local context improves precision.
NamSorClient::PersonalApi parsed_gender_batch POST /api2/json/parsedGenderBatch Infer the likely gender of up to 1000 fully parsed names, detecting automatically the cultural context.
NamSorClient::PersonalApi parsed_gender_geo_batch POST /api2/json/parsedGenderGeoBatch Infer the likely gender of up to 1000 fully parsed names, detecting automatically the cultural context.
NamSorClient::PersonalApi us_race_ethnicity GET /api2/json/usRaceEthnicity/{firstName}/{lastName} [USES 10 UNITS] Infer a US resident's likely race/ethnicity according to US Census taxonomy W_NL (white, non latino), HL (hispano latino), A (asian, non latino), B_NL (black, non latino).
NamSorClient::PersonalApi us_race_ethnicity_batch POST /api2/json/usRaceEthnicityBatch [USES 10 UNITS] Infer up-to 1000 US resident's likely race/ethnicity according to US Census taxonomy.
NamSorClient::PersonalApi us_race_ethnicity_zip5 GET /api2/json/usRaceEthnicityZIP5/{firstName}/{lastName}/{zip5Code} [USES 10 UNITS] Infer a US resident's likely race/ethnicity according to US Census taxonomy, using (optional) ZIP5 code info. Output is W_NL (white, non latino), HL (hispano latino), A (asian, non latino), B_NL (black, non latino).
NamSorClient::PersonalApi us_zip_race_ethnicity_batch POST /api2/json/usZipRaceEthnicityBatch [USES 10 UNITS] Infer up-to 1000 US resident's likely race/ethnicity according to US Census taxonomy, with (optional) ZIP code.
NamSorClient::SocialApi phone_code GET /api2/json/phoneCode/{firstName}/{lastName}/{phoneNumber} [USES 11 UNITS] Infer the likely country and phone prefix, given a personal name and formatted / unformatted phone number.
NamSorClient::SocialApi phone_code_batch POST /api2/json/phoneCodeBatch [USES 11 UNITS] Infer the likely country and phone prefix, of up to 1000 personal names, detecting automatically the local context given a name and formatted / unformatted phone number.
NamSorClient::SocialApi phone_code_geo GET /api2/json/phoneCodeGeo/{firstName}/{lastName}/{phoneNumber}/{countryIso2} [USES 11 UNITS] Infer the likely phone prefix, given a personal name and formatted / unformatted phone number, with a local context (ISO2 country of residence).
NamSorClient::SocialApi phone_code_geo_batch POST /api2/json/phoneCodeGeoBatch [USES 11 UNITS] Infer the likely country and phone prefix, of up to 1000 personal names, with a local context (ISO2 country of residence).

Documentation for Models

Documentation for Authorization

api_key

  • Type: API key
  • API key parameter name: X-API-KEY
  • Location: HTTP header