Coder Social home page Coder Social logo

contactually-rb's Introduction

contactually-rb

Build Status Code Climate Test Coverage

A simple ruby wrapper around Contactually v2 Api.

NOTE: This is a heavily work in progress codebase, and will most definitely have breaking changes as things progress.

Installation

Gemfile

gem 'contactually-rb', '~> 0.1.1'

System

gem install contactually-rb

Usage

Simple list contacts example

Create a client instance

require 'contactually'

client = Contactually::Client.new(auth_token: '<auth_token>')
#   or
client = Contactually::Client.new(api_key: '<api_key>')
# List contacts
contacts = client.contacts.list
# => #<Contactually::Collection>

# Access to response wrapper
client.contacts.response
# => #<Contactually::Response>

# Raw farday response
client.contacts.response.raw_response
# => #<Faraday::Response>

contacts.total # => 73 Total contact count
contacts.size # => 50 Total contacts in current list

contact = contacts.first # => #<Contactually::Models::Contact>
contact.first_name # => "Nic"

Looping through all contacts (it will yield contact and transparently loop through all contacts in batches of 50 using Contacutally pagination),

client = Contactually::Client.new(auth_token: '<auth_token>')

client.contacts.list_each do |contact|
  # do something with contact, 50 per batch as specified by Contactually API
end

Searching

collection = client.contacts.list({q: 'Nic'})
collection.first.name # => Nic

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec 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.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/RealScout/contactually-api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

Todos

  • Support update endpoints
  • Support Contact convenience endpoints (eg: /contacts/:id/notes)
  • Support Create, Destroy endpoints
  • Support other endpoints
  • Better client testing support (Contactually.configuration.test_mode = true)
  • Documentation

contactually-rb's People

Contributors

mlogix avatar ncavig avatar nickblumenthal avatar ryandoherty avatar yegoroff avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

isunrise

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.