GithubHelp home page GithubHelp logo

treedozer / closeio Goto Github PK

View Code? Open in Web Editor NEW

This project forked from taylorbrooks/closeio

0.0 0.0 0.0 144 KB

A Ruby wrapper for the Close.io API

Home Page: http://developer.close.io

License: MIT License

Ruby 100.00%

closeio's Introduction

A Ruby wrapper for the Close.com API

Learn about the Close API at http://developer.close.com.

I ❤️ Close, 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.

Installation

Add this line to your application's Gemfile:

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

  # 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[:data][: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')

Timezone Offsets For requests that include date filters like date_created or date_start, you can use the utc_offset named parameter to pass your timezone's UTC offset as part of your request. By default all API calls uses the UTC time.

  utc_offset = Time.zone.utc_offset.to_f / 1.hour
  client = Closeio::Client.new("api key", utc_offset: utc_offset)

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) 2019 Taylor Brooks. See LICENSE for details.

closeio's People

Contributors

alexanderschnitzler avatar alexey avatar alfie-max avatar ayb avatar cgamesplay avatar dazoakley avatar dmitrytrager avatar dpaola2 avatar eengoron avatar emaxi avatar iamademar avatar joemasilotti avatar maccman avatar mdemare avatar mful avatar migu0 avatar nimzco avatar piioupiou avatar shved avatar taylorbrooks avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.