Giter Club home page Giter Club logo

constant-contact-ruby's Introduction

constant-contact-ruby

Ruby wrapper for the Constant Contact REST API

Requirements

HTTParty gem - rubygems.org/gems/httparty

Usage

require 'constant_contact'
include ConstantContact

### Setup Credentials ###
ConstantContact.setup( 'my_username', 'my_password' )

### Contacts ###

all_contacts = Contact.all 

contact_7 = Contact.get( 7 ) 
contact_7.update_attributes!( :first_name => 'John', :last_name => 'Doe' )
contact_7.add_to_list!( 3 )
contact_7.remove_from_list!( 3 )
contact_7.replace_contact_lists!( 1, 3, 9 )

new_contact = Contact.add( :email_address => '[email protected]', :first_name => 'John', :last_name => 'Doe' )

john_doe = Contact.search_by_email( '[email protected]' )

### Contact Lists ###

all_lists = ContactList.all

list_1 = ContactList.get( 1 )
list_1_members = ContactList.members( list_1.uid )
list_1.clear_contacts!    # remove all contacts from list
ContactList.delete( 1 )   # delete the list

new_list = ContactList.add( 'my new list' )

### Bulk Activities (involving multiple contacts) ###

activities = Activity.all # list all activities in the system

activity_details = Activity.get( activities.first.uid )

Activity.remove_all_contacts_from_lists( 1, 3, 4 )    # remove all contacts from lists 1, 3, and 4

new_contacts = [
  { :email_address => '[email protected]', :first_name => 'User1', :last_name => 'test' },
  { :email_address => '[email protected]', :first_name => 'User2', :last_name => 'test 2' },
  { :email_address => '[email protected]', :first_name => 'User1' },
  { :email_address => '[email protected]' }
]
Activity.add_contacts_to_lists( new_contacts, 3, 4 )    # all the users array to lists 3 and 4
Activity.remove_contacts_from_lists( new_contacts, 4 )  # remove the users from list 4

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.

Authors

Craig P Jolicoeur - craigjolicoeur.com

Copyright © 2010 BatchBlue Software, LLC. See LICENSE for details.

constant-contact-ruby's People

Contributors

cpjolicoeur avatar jrmehle avatar

Stargazers

 avatar

Watchers

 avatar  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.