send_with_us 1.11.4 → 1.11.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -0
- data/README.md +11 -3
- data/lib/send_with_us/api.rb +4 -1
- data/lib/send_with_us/version.rb +1 -1
- data/send_with_us.gemspec +1 -1
- data/test/lib/send_with_us/api_test.rb +28 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 337d955a258aa2a223354d2a33a222681b7253dd
|
4
|
+
data.tar.gz: c44a47c3a838ded17faae63f6dcda5f87ce118df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc9eb38d2b58181466d037ec4cd1cbddd2ec7082fbbffe32b9a4b0d417958af62af7822c4ae3c39b8c43a4c4a6656fe484f7a5e75b2b4fe0fc1afec87d40cd22
|
7
|
+
data.tar.gz: c1ebf8627bf4dfd4b2b68130cb755aaf3298e15a91cd60295ca97a9f82047e51702c8feb3f4413b187e71f82fe8dd5e6181dd2579cee19ff600b4a391c86b4c9
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -23,8 +23,10 @@ bundle install
|
|
23
23
|
|
24
24
|
### Send
|
25
25
|
|
26
|
+
*NOTE* - If a customer does not exist by the specified email (recipient address), the send call will create a customer.
|
27
|
+
|
26
28
|
#### send_email arguments
|
27
|
-
- **
|
29
|
+
- **template\_id** - *string* - Template ID being sent
|
28
30
|
- **to** - *hash* - Recipients' email address
|
29
31
|
- **:data** - *hash* - Email data
|
30
32
|
- **:from** - *hash* - From name/address/reply\_to
|
@@ -38,7 +40,7 @@ bundle install
|
|
38
40
|
- **:locale** - *string* - Localization string
|
39
41
|
|
40
42
|
#### send_with arguments [DEPRECATED]
|
41
|
-
- **
|
43
|
+
- **template\_id** - *string* - Template ID being sent
|
42
44
|
- **to** - *hash* - Recipients' email address
|
43
45
|
- **data** - *hash* - Email data
|
44
46
|
- **from** - *hash* - From name/address/reply\_to
|
@@ -243,7 +245,13 @@ begin
|
|
243
245
|
puts result
|
244
246
|
|
245
247
|
# Add customer@example.com to campaign dc_asdf1234
|
246
|
-
result = obj.start_on_drip_campaign('customer@example.com', 'dc_asdf1234'
|
248
|
+
result = obj.start_on_drip_campaign('customer@example.com', 'dc_asdf1234')
|
249
|
+
puts result
|
250
|
+
|
251
|
+
OR
|
252
|
+
|
253
|
+
# Add customer@example.com to campaign dc_asdf1234, with optional: email_data, locale, tags
|
254
|
+
result = obj.start_on_drip_campaign('customer@example.com', 'dc_asdf1234', {total: '100.00'}, 'en-US', ['tag1', 'tag2'])
|
247
255
|
puts result
|
248
256
|
|
249
257
|
# Remove customer@example.com from campaign dc_asdf1234
|
data/lib/send_with_us/api.rb
CHANGED
@@ -182,12 +182,15 @@ module SendWithUs
|
|
182
182
|
SendWithUs::ApiRequest.new(@configuration).get(:drip_campaigns)
|
183
183
|
end
|
184
184
|
|
185
|
-
def start_on_drip_campaign(recipient_address, drip_campaign_id, email_data={}, locale=nil)
|
185
|
+
def start_on_drip_campaign(recipient_address, drip_campaign_id, email_data={}, locale=nil, tags=[])
|
186
186
|
payload = {recipient_address: recipient_address}
|
187
187
|
|
188
188
|
if email_data && email_data.any?
|
189
189
|
payload[:email_data] = email_data
|
190
190
|
end
|
191
|
+
if tags.any?
|
192
|
+
payload[:tags] = tags
|
193
|
+
end
|
191
194
|
if locale
|
192
195
|
payload[:locale] = locale
|
193
196
|
end
|
data/lib/send_with_us/version.rb
CHANGED
data/send_with_us.gemspec
CHANGED
@@ -7,7 +7,7 @@ require 'send_with_us/version'
|
|
7
7
|
Gem::Specification.new do |gem|
|
8
8
|
gem.name = "send_with_us"
|
9
9
|
gem.version = SendWithUs::VERSION
|
10
|
-
gem.authors = ["Matt Harris", "Chris Cummer", "Nicholas Rempel"]
|
10
|
+
gem.authors = ["Matt Harris", "Chris Cummer", "Nicholas Rempel", "Gregory Schier", "Brad Van Vugt"]
|
11
11
|
gem.email = ["us@sendwithus.com"]
|
12
12
|
gem.description = %q{SendWithUs.com Ruby Client}
|
13
13
|
gem.summary = %q{SendWithUs.com Ruby Client}
|
@@ -43,4 +43,32 @@ describe SendWithUs::Api do
|
|
43
43
|
it { -> { subject.log }.must_raise ArgumentError }
|
44
44
|
end
|
45
45
|
end
|
46
|
+
|
47
|
+
describe '#start_on_drip_campaign' do
|
48
|
+
let(:email) { 'some@email.stub' }
|
49
|
+
let(:drip_campaign_id) { 'dc_SoMeCampaIGnID' }
|
50
|
+
let(:locale) { "en-US" }
|
51
|
+
let(:tags) { ['tag1', 'tag2'] }
|
52
|
+
let(:endpoint) { "drip_campaigns/#{drip_campaign_id}/activate" }
|
53
|
+
|
54
|
+
before { SendWithUs::ApiRequest.any_instance.expects(:post).with(endpoint, payload.to_json) }
|
55
|
+
|
56
|
+
describe 'email_data' do
|
57
|
+
let(:payload) { {recipient_address: email, email_data: {foo: 'bar'}} }
|
58
|
+
|
59
|
+
it { subject.start_on_drip_campaign(email, drip_campaign_id, {foo: 'bar'}) }
|
60
|
+
end
|
61
|
+
|
62
|
+
describe 'email_data & tags' do
|
63
|
+
let(:payload) { {recipient_address: email, email_data: {foo: 'bar'}, tags: tags, locale: locale} }
|
64
|
+
|
65
|
+
it { subject.start_on_drip_campaign(email, drip_campaign_id, {foo: 'bar'}, locale, tags) }
|
66
|
+
end
|
67
|
+
|
68
|
+
describe 'tags' do
|
69
|
+
let(:payload) { {recipient_address: email, tags: tags, locale: locale} }
|
70
|
+
|
71
|
+
it { subject.start_on_drip_campaign(email, drip_campaign_id, {}, locale, tags) }
|
72
|
+
end
|
73
|
+
end
|
46
74
|
end
|
metadata
CHANGED
@@ -1,16 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: send_with_us
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.11.
|
4
|
+
version: 1.11.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Harris
|
8
8
|
- Chris Cummer
|
9
9
|
- Nicholas Rempel
|
10
|
+
- Gregory Schier
|
11
|
+
- Brad Van Vugt
|
10
12
|
autorequire:
|
11
13
|
bindir: bin
|
12
14
|
cert_chain: []
|
13
|
-
date: 2016-
|
15
|
+
date: 2016-02-23 00:00:00.000000000 Z
|
14
16
|
dependencies:
|
15
17
|
- !ruby/object:Gem::Dependency
|
16
18
|
name: rake
|