GithubHelp home page GithubHelp logo

todddickerson / ruby-getresponse Goto Github PK

View Code? Open in Web Editor NEW

This project forked from seban/ruby-getresponse

1.0 1.0 0.0 314 KB

Wrapper for GetResponse JSON-RPC service

Home Page: http://dev.getresponse.com

Ruby 100.00%

ruby-getresponse's Introduction

GetResponse

<img src=“https://travis-ci.org/seban/ruby-getresponse.png?branch=master” alt=“Build Status” /> <img src=“https://codeclimate.com/github/seban/ruby-getresponse.png” /> <img src=“https://badge.fury.io/rb/getresponse.png” alt=“Gem Version” /> <img src=“https://gemnasium.com/seban/ruby-getresponse.png” alt=“Dependency Status” />

Wrapper for GetResponse API. Class interfaces from version 0.2 has changed breaking backward compatibility. Be sure to check changes before update.

Compatibility issue

Next release (0.6) of getresponse gem will not be compatible with Ruby 1.8.

Usage

Just add to you Gemfile

gem "getresponse", :require => "get_response"

GetResponse offers three API end point according which type of client you are. Standard retail clients (getresponse.com etc.) should use GetResponse::Connection class to communicate with API. If you are client of getresponse360.com class GetResponse::DedicatedUsConnection will suit for you. Client of polish getresponse360.pl should use GetResponse::DedicatedPlConnection.

Test connection to GetResponse API.

gr_connection = GetResponse::Connection.new("my_secret_api")
gr_connection.ping

Get info about account:

gr_connection.account

Get your active campaigns.

gr_connection.campaigns.all

You can operate on your contacts quite the same way as on ActiveRecord objects. Before any operation on contacts you must connect to API.

Get all contacts:

gr_connection.contacts.all

Create new contact:

# with connection
gr_connection.contacts.create("name" => "John Doe", "email" => "[email protected]",
  "campaign" => "campaignId", "customs" => { "source" => "mainpage" })

Update your contact:

# with connection
# contact - existing contact
contact.update("name" => "John Thenewname")

# or
contact.name = "John Thenewname"
contact.save

Delete contact:

# with connection
# contact - existing contact
contact.destroy

Move contact between campaigns:

# with connection
# contact - existing contact
# zXy - existing campaign
contact.move("zXy")

Get geoip location

# with connection
# contact - existing contact
contact.geoip

Set contact cycle

# with connection
# contact - existing contact
contact.set_cycle(5)

Get custom attributes

# with connection
# contact - existing contact
contact.customs
=> { "attr_name" => "attr_value" }

Get account from fields

# with account
# account - existing account
account.from_fields.all
=> [<FromField: xcv>]

Add account from field

# with account
# account = existing account
account.from_fields.create("name" => "My new name", "email" => "[email protected]")
=> #<GetResponse::FromField:0xb7727010 ... >

Get account domains

# with account
# account - existing account
account.domains.all

Get campaign domain

# with campaign
# campaign - existing campaign
campaign.domain

Set campaign domain

domain = account.domains.first
campaign.domain = domain

Get campaign messages

# with campaign
# campaign - existing campaign
messages = campaign.messages
newsletters = campaign.messages(:type => "newsletter")

Get all messages

# with connection
connection.messages.all

Get message contents

# with message
# message - existing messsage
message.contents["plain"]
message.contents["html"]

Get stats of message

# message - existing message
message.stats

Delete message

# message - existing message
message.destroy

Get/set campaign’s postal address

# campaign_one - existing campaign
# campaign_two - existing campaign
postal_address = campaign_one.postal_address
campaign_two.postal_address = postal_address

To get contact openned message list with dates

# contact - existing contact
@contact.opens

Get subscriptions statistics

# campaign - existing campaign
campaign.subscription_statistics
campaign.subscription_statistics(:created_on => {:at => Date.today})
campaign.subscription_statistics(:created_on => {:from => "2011-01-01", :to => "2011-12-30"})

Get confirmation message bodies

# connection - existing connection
connection.confirmation_bodies.all
connection.confirmation_bodies.all(:language_code => {:equals => "en"})

Get confirmation message subjects

# connection - existing connection
connection.confirmation_subjects.all
connection.confirmation_subjects.all(:language_code => {:equals => "en"})

Get deleted contacts

contact_proxy.deleted
contact_proxy.deleted(:reason => "bounce")
campaign.deleted

Get single field form by id

from_field_proxy.find("from_field_id")

Get single confirmation body by id

confirmation_body_proxy.find("confirmation_body_id")

Get single confirmation subject by id

confirmation_subject_proxy.find("confirmation_subject_id")

Create new campaign

connection.campaigns.create(new_campaign_attributes)

Fetching links embedded in messages

connection.links.all
message.links

Fetching blacklisted addresses for account

account.blacklist

Fetching blacklisted addresses for campaign

campaign.blacklist

Creating follow up message:

campaign.create_follow_up({
  "subject" => "My new followup",
  "day_of_cycle" => 1024,
  "contents" => {
    "plain" => "Hello, it is my follow up!",
    "html" => "<b>Hello</b>, it is my follow up!"
  }
})

ruby-getresponse's People

Contributors

mkuzel avatar seban avatar todddickerson avatar

Stargazers

 avatar

Watchers

 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.