Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

including state of residence in subscriber attributes.

  • Loading branch information...
commit 3ad30e632adff5390b09f6fbffb18308c275b679 1 parent 4e1c8c5
Steve Mitchell authored
View
3  lib/exact-target-api-client/subscriber.rb
@@ -12,7 +12,8 @@ def create(attributes = {})
mail_attributes["First Name"] = attr.delete(:first_name)
mail_attributes["Last Name"] = attr.delete(:last_name)
mail_attributes["Zipcode"] = attr.delete(:zip_code)
- mail_attributes.merge(attr)
+ mail_attributes["State"] = attr.delete(:state)
+ mail_attributes.merge!(attr)
send_request create_body(email, mail_attributes, lists)
queue_triggered_send(:welcome, email) unless skip_welcome
View
16 spec/lib/subscriber_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
class EmailUser
- attr_accessor :email, :first_name, :last_name, :zip_code
+ attr_accessor :email, :first_name, :last_name, :zip_code, :state
end
describe ExactTarget::Subscriber do
@@ -12,6 +12,7 @@ class EmailUser
u.first_name = 'First'
u.last_name = 'Last'
u.zip_code = '12345'
+ u.state = 'IA'
u
end
@@ -20,7 +21,7 @@ class EmailUser
sub = ExactTarget::Subscriber.new
body = sub.create_body user.email, "First Name" => user.first_name, "Last Name" => user.last_name,
- "Zipcode" => user.zip_code
+ "Zipcode" => user.zip_code, "State" => user.state
body['Objects']['EmailAddress'].should == user.email
@@ -30,8 +31,11 @@ class EmailUser
body['Objects']['Attributes'][1]['Value'].should == user.last_name
body['Objects']['Attributes'][2]['Name'].should == 'Zipcode'
body['Objects']['Attributes'][2]['Value'].should == user.zip_code
+ body['Objects']['Attributes'][3]['Name'].should == 'State'
+ body['Objects']['Attributes'][3]['Value'].should == user.state
end
+
it 'should have master list from config in soap body' do
sub = ExactTarget::Subscriber.new
body = sub.create_body(user.email, "First Name" => user.first_name, "Last Name" => user.last_name,
@@ -73,20 +77,20 @@ class EmailUser
it 'should call triggered send after user is added to list' do
sub = ExactTarget::Subscriber.new
- expected = {"First Name" => user.first_name, "Last Name" => user.last_name, "Zipcode" => user.zip_code}
+ expected = {"First Name" => user.first_name, "Last Name" => user.last_name, "Zipcode" => user.zip_code, "State" => user.state}
sub.should_receive(:send_request).with(sub.create_body(user.email, expected))
sub.should_receive(:queue_triggered_send).with(:welcome, user.email)
- sub.create(:first_name => user.first_name, :last_name => user.last_name, :zip_code => user.zip_code, :email => user.email)
+ sub.create(:first_name => user.first_name, :last_name => user.last_name, :zip_code => user.zip_code, :email => user.email, :state => user.state)
end
it 'should not call triggered send after user is added if skip welcome is true' do
sub = ExactTarget::Subscriber.new
- expected = {"First Name" => user.first_name, "Last Name" => user.last_name, "Zipcode" => user.zip_code}
+ expected = {"First Name" => user.first_name, "Last Name" => user.last_name, "Zipcode" => user.zip_code, "State" => user.state}
sub.should_receive(:send_request).with(sub.create_body(user.email, expected))
sub.should_not_receive(:queue_triggered_send)
- sub.create(:first_name => user.first_name, :last_name => user.last_name, :zip_code => user.zip_code, :email => user.email,
+ sub.create(:first_name => user.first_name, :last_name => user.last_name, :zip_code => user.zip_code, :email => user.email, :state => user.state,
:options => {:skip_welcome => true})
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.