Trustpilot Business Links generator gem Build Status Gem Version

Generate the Trustpilot Business Generated Links in ruby.

Requirements

Ruby 2.1.0 or newer. It probably works on lower versions but has not been tested and is not supported.

Installation

gem install trustpilot-business-links

Usage

require 'json'
require 'trustpilot-business-links'

# Keys generated on https://businessapp.b2b.trustpilot.com/#/invitations/business-generated-links
encryption_key = 'gn96sJwFRQuQl3bjNIPM0xp+TnK4iBaW0I4DpR0o+cs='
authentication_key = 'eE4zdEfGNlxjGVjtWpOLAYAM0gKeF5j6Db7ZXd1Bixo='
trustpilot_bgl = TrustpilotBusinessLinks.new(encryption_key, authentication_key)

review_payload = {
  email: "[email protected]",
  name: "John Smith",
  ref: "1234",
}

encrypted_payload = trustpilot_bgl.encrypt(review_payload.to_json)

puts "https://www.trustpilot.com/evaluate-bgl/www.example.com?p=#{encrypted_payload}"

Test

make test

100% of the source code should be covered by tests.

Contributing

You are warmly welcome to contribute to the project!

Documentation

License

The projected is licensed under the MIT license. See LICENSE.md.