# Ruby Quick Start

## 1.  Get an API Key and Secret

If you haven’t already, [sign up for a free trial](https://www.enzoic.com/free-trial).

## 2.  Install the Enzoic Library in Your Project

Use Nuget to install the Enzoic package in your project:

```bash
gem install enzoic
```

## 3.  Try Out Our Example Code

We’ve made calling the API dead simple. This sample code snippet shows you examples of calling the four supported APIs:

```ruby
require 'enzoic'

# Create a new Enzoic instance - this is our primary interface for making API calls
enzoic = Enzoic::Enzoic.new(apiKey: YOUR_API_KEY, secret: YOUR_API_SECRET)

# Check whether a password has been compromised
# see https://www.enzoic.com/docs-passwords-api/ for more information
if enzoic.check_password("password-to-test")
    puts("Password is compromised")
else
    puts("Password is not compromised")
end

# Check whether a specific set of credentials are compromised
# see https://www.enzoic.com/docs-credentials-api/ for more information
if enzoic.check_credentials("test@enzoic.com", "password-to-test")
    puts("Credentials are compromised")
else
    puts("Credentials are not compromised")
end

# Check whether a specific set of credentials are compromised, using the optional 
# lastCheckData parameter.
# lastCheckDate is the timestamp for the last check you performed for this user.
# If the DateTime you provide for the last check is greater than the timestamp 
# Enzoic has for the last breach affecting this user, the check will not be 
# performed. This can be used to substantially increase performance.
if enzoic.check_credentials("test@enzoic.com", "password-to-test", 
    DateTime.parse("2019-07-15T19:57:43.000Z"))
    puts("Credentials are compromised")
else
    puts("Credentials are not compromised")
end

# get all exposures for a given user
# see https://www.enzoic.com/docs-exposures-api/#get-exposures for more information
exposures = enzoic.get_exposures_for_user("test@enzoic.com")
puts(exposures.count.to_s + " exposures found for test@enzoic.com")

# now get the full details for the first exposure found
# see https://www.enzoic.com/docs-exposures-api/#get-exposure-details for more 
# information
details = enzoic.get_exposure_details(exposures.exposures[0])
puts("First exposure for test@enzoic.com was " + details.title)

# get all passwords for a given user - requires special approval, contact Enzoic 
# sales, see https://www.enzoic.com/docs-raw-passwords-api/ for more information
user_passwords = enzoic.get_passwords_for_user("eicar_0@enzoic.com")
puts("First password for eicar_0@enzoic.com was " + 
    user_passwords.passwords[0].password)

```

## 4.  Learn More

That should get you started. Check out the [GitHub project page](https://github.com/Enzoic/enzoic-ruby-client) for more details.  Make sure you also review the [Using the Enzoic API](/enzoic-api-developer-documentation/using-the-enzoic-api.md) page.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.enzoic.com/enzoic-api-developer-documentation/getting-started/ruby-quick-start.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
