Skip to content

sujithsudarsanan/closeio

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Ruby wrapper for the Close.IO API

Learn about the Closeio API at http://developer.close.io.

I ❤️ Close.io, so if you have problems using the gem or would like to see support for new endpoints, please open a GitHub issue -- I'll get it resolved as quick as I can.

Fwiw, I also run DripEmails.com -- a service for building automated email sequences using Close.io

Installation

Add this line to your application's Gemfile:

  # in your Gemfile
  gem 'closeio', '~> 2.4'

  # then...
  bundle install

Usage

  client = Closeio::Client.new("api key")

  # Find a specific lead
  client.find_lead('lead_xxxxxxxxxxxx')

  # See some data about the lead
  lead.data.addresses
  lead.data.contacts
  lead.data.opportunities

  # Update the lead
  client.update_lead(lead.id,
    name: "Bluth Company",
    addresses: [{
      "address_1": "747 Howard St",
      "city": "San Francisco"
    }]
  )

  # Delete the lead
  client.delete_lead(lead.id)

  # Merge two leads into one
  client.merge_leads(source_lead.id, destination_lead.id)

  # Find leads that match field
  client.list_leads(name: "Wayne Enterprises")

  # Find leads that match custom field
  client.list_leads('"custom.Favorite Color":"cornflower blue"')

  # Use paginate: true to fetch all the leads
  client.list_leads(name: "Wayne Enterprises", paginate: true)

  # Create a lead
  client.create_lead(
    name: "Bluth Company",
    contacts: [{
      name: "Buster Bluth",
      emails: [{type: "office", email: "[email protected]"}]
    }]
  )

  # Create a bulk edit job for leads filtered by a custom field
  client.bulk_edit(
    query: '"custom.International Database ID":12345',
    type: 'set_custom_field',
    custom_field_name: 'Local Database ID',
    custom_field_value: '123'
  )

  # Saved Search (SmartView)
  smart_view = client.list_smart_views
  smart_views.leads

Options

You can disable the logger by passing in a second argument when creating a new client:

  client = Closeio::Client.new("api key", false)

Some servers running on SSL need specific configurations for the Faraday dependency. If you're running on Heroku with SSL enabled, you need to pass in the path of the CA certificate when creating a new client:

  client = Closeio::Client.new("api key", true, '/usr/lib/ssl/certs/ca-certificates.crt')

History

View the changelog This gem follows Semantic Versioning

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help:

Copyright

Copyright (c) 2016 Taylor Brooks. See LICENSE for details.

About

A Ruby wrapper for the Close.io API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%