Home

Awesome

Truemail web API client library for Crystal

CircleCI Shard Version Gitter GitHub Contributor Covenant

truemail-crystal-client shard - Truemail web API client library for Crystal.

Actual and maintainable documentation :books: for developers is living here.

Table of Contents

Requirements

Crystal 1.3.2+

Installation

  1. Add the dependency to your shard.yml:
dependencies:
  truemail-client:
    github: truemail-rb/truemail-crystal-client
    branch: master
  1. Run shards install

Usage

require "truemail-client"

To have an access for Truemail::Client you must create configuration instance first as in the example below:

Creating configuration instance

configuration = Truemail::Client::Configuration.new do |config|
  # Optional parameter (Boolean). By default it is equal false
  config.secure_connection = false

  # Required parameter (String). It should be a hostname or an ip address where Truemail server runs
  config.host = "example.com"

  # Optional parameter (Int32). By default it is equal 9292
  config.port = 80

  # Required parameter (String). It should be valid Truemail server access token
  config.token = "token"
end

Establishing connection with Truemail API

After successful configuration, you can establish connection with Truemail server.

Truemail::Client.validate("admin@bestweb.com.ua", configuration)

=>

{
  "date": "2020-05-05 19:30:42 +0200",
  "email": "admin@bestweb.com.ua",
  "validation_type": "smtp",
  "success": true,
  "errors": null,
  "smtp_debug": null,
  "configuration": {
    "validation_type_by_domain": null,
    "whitelist_validation": false,
    "whitelisted_domains": null,
    "blacklisted_domains": null,
    "smtp_safe_check": false,
    "email_pattern": "default gem value",
    "smtp_error_body_pattern": "default gem value"
  }
}

Truemail::Client.validate always returns JSON data. If something goes wrong you will receive JSON with error details:

{
  "truemail_client_error": "error details"
}

Truemail family

All Truemail solutions: https://truemail-rb.org

NameTypeDescription
truemailruby gemConfigurable framework agnostic plain Ruby email validator, main core
truemail serverruby appLightweight rack based web API wrapper for Truemail
truemail-rack-dockerdocker imageLightweight rack based web API dockerized image :whale: of Truemail server
truemail-ruby-clientruby gemTruemail web API client library for Ruby
truemail-java-clientjava libTruemail web API client library for Java
truemail-rspecruby gemTruemail configuration and validator RSpec helpers

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/truemail-rb/truemail-crystal-client. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct. Please check the open tickets. Be sure to follow Contributor Code of Conduct below and our Contributing Guidelines.

License

The shard is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the truemail-crystal-client project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

Credits

Versioning

truemail-crystal-client uses Semantic Versioning 2.0.0