Skip to content

ruby http client to interact with snov api

License

Notifications You must be signed in to change notification settings

NEXL-LTS/snov-ruby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CircleCI

Installation

Add this line to your application's Gemfile:

gem 'snov'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install snov

Usage

set SNOV_USER_ID and SNOV_SECRET environment variables

DomainSearch

see https://snov.io/api#DomainSearch2

results = Snov::DomainSearch.new(domain: "octagon.com", type: "personal", limit: 10)
results.last_id
results.each do |result|
  puts result.email
  puts result.first_name
  puts result.last_name
  puts result.position
  puts result.source_page
  puts result.company_name
  puts result.type
  puts result.status
end

GetProfileByEmail

see https://snov.io/api#GetProfileByEmail

  prospect = Snov::GetProfileByEmail.new(email: "gavin.vanrooyen@octagon.com")

  puts prospect.success
  puts prospect.id
  puts prospect.name
  puts prospect.first_name
  puts prospect.last_name
  puts prospect.industry
  puts prospect.country
  puts prospect.locality
  prospect.social.each do |social_info|
    puts social.link
    puts social.type
  end
  prospect.current_jobs.each do |social_info|
    puts social.company_name
    puts social.position
    # etc
  end
  # etc

GetProspectList

see https://snov.io/api#FindProspectbyEmail

  prospects = Snov::GetProspectsByEmail.new(email: "gavin.vanrooyen@octagon.com")
  prospects.each do |prospect|
    puts prospect.id
    puts prospect.name
    puts prospect.first_name
    puts prospect.last_name
    puts prospect.industry
    puts prospect.country
    puts prospect.locality
    prospect.social.each do |social_info|
      puts social.link
      puts social.type
    end
    # etc
  end

GetUserLists

see https://snov.io/api#UserLists

  lists = Snov::GetUserLists.new
  lists.each do |list|
    puts list.id
    puts list.name
    puts list.is_deleted
    puts list.contacts
    puts list.creation_date.date
    puts list.deletion_date.date
  end

GetProspectList

see https://snov.io/api#ViewProspectsInList

  prospects = Snov::GetProspectList.new(list_id: 1, page: 1, per_page: 100)
  prospects.each do |prospect|
    puts prospect.id
    puts prospect.name
    puts prospect.first_name
    puts prospect.last_name
    puts prospect.source
    prospect.emails.each do |email_info|
      puts email_info.email
      puts email_info.is_verified
      puts email_info.job_status
      # etc
    end
  end

GetAllProspectsFromList

convenience wrapper for GetProspectList to get all the prospects on all the pages

see https://snov.io/api#ViewProspectsInList

  prospects = Snov::GetAllProspectsFromList.new(list_id: 1)
  prospects.each do |prospect|
    puts prospect.id
    puts prospect.name
    puts prospect.first_name
    puts prospect.last_name
    puts prospect.source
    prospect.emails.each do |email_info|
      puts email_info.email
      puts email_info.is_verified
      puts email_info.job_status
      # etc
    end
  end

GetEmailsBySocialUrl

convenience wrapper for GetEmailsFromUrl to get a prospect with social url e.g. linkedin profile url

see https://snov.io/api#GetEmailsFromUrl

  prospect = Snov::GetEmailsBySocialUrl.new(url: "https://www.linkedin.com/in/john-doe-123456/").prospect
  
  prospect.data.emails.each do |value|
    puts value.email
    puts value.status
  end

  prospect.data.previous_jobs.each do |value|
    puts value.company_name
    puts value.company_type
    puts value.position
    puts value.country
    puts value.start_date
    puts value.industry
    puts value.size
  end

  prospect.data.current_jobs.each do |value|
    puts value.company_name
    puts value.company_type
    puts value.position
    puts value.country
    puts value.start_date
    puts value.industry
    puts value.size
  end

GetEmailsFromName

convenience wrapper for GetEmailsFromName to get a prospect with name

see https://snov.io/api#EmailFinder

  prospect = Snov::GetEmailsFromName.new(first_name: "gavin", last_name: "vanrooyen", domain: "octagon.com").prospect
  
  prospect.data.emails.each do |value|
    puts value.email
    puts value.email_status
  end

AddNamesToFindEmails

convenience wrapper for AddNamesToFindEmails to add a prospect with name

see https://snov.io/api#AddNamestoFindEmails

  added_name = Snov::AddNamesToFindEmails.new(first_name: "gavin", last_name: "vanrooyen", domain: "octagon.com").add

  puts added_name.sent # true added to snov queue for searching
  puts added_name.success

can setup snov to be able to reuse access tokens

Snov.token_storage = Snov::InMemoryTokenStorage.new
# or
Snov.token_storage = Snov::RedisTokenStorage.new(Redis.new)

Simple example implementation of your own token storage.

class TokenStorage
  def initialize
    @stored_token = nil
  end

  def get
    @stored_token
  end

  def set(token_hash)
    @stored_token = token_hash
  end
end

Development

After checking out the repo, run bin/setup to install dependencies. Then, run bin/rspec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/snov.

About

ruby http client to interact with snov api

Resources

License

Stars

Watchers

Forks

Packages

No packages published