0.02
No commit activity in last 3 years
No release in over 3 years
With this gem you can manage your subscribers, campaigns, messages etc.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.0

Runtime

~> 1.4
~> 1.4
 Project Readme

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" => "john.d@somewhere.com",
  "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" => "my_new_email@foo.bar")
=> #<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!"
  }
})