express_pigeon 2.0.2 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/.hound.yml +3 -0
- data/CHANGELOG.md +15 -0
- data/CONTRIBUTING.md +9 -0
- data/Gemfile +1 -0
- data/Guardfile +2 -36
- data/README.md +57 -0
- data/lib/express_pigeon/auto_responders.rb +70 -0
- data/lib/express_pigeon/campaigns.rb +120 -0
- data/lib/express_pigeon/contacts.rb +15 -4
- data/lib/express_pigeon/messages.rb +83 -0
- data/lib/express_pigeon/templates.rb +24 -0
- data/lib/express_pigeon/version.rb +1 -1
- data/lib/express_pigeon.rb +4 -11
- data/spec/lib/express_pigeon/auto_responders_spec.rb +2 -0
- data/spec/lib/express_pigeon/campaigns_spec.rb +2 -0
- data/spec/{express_pigeon → lib/express_pigeon}/contacts_spec.rb +0 -0
- data/spec/{express_pigeon → lib/express_pigeon}/lists_spec.rb +0 -0
- data/spec/lib/express_pigeon/messages_spec.rb +37 -0
- data/spec/lib/express_pigeon/templates_spec.rb +43 -0
- data/spec/spec_helper.rb +3 -18
- data.tar.gz.sig +2 -2
- metadata +19 -22
- metadata.gz.sig +0 -0
- data/lib/express_pigeon/api/campaigns.rb +0 -62
- data/lib/express_pigeon/api/contacts.rb +0 -42
- data/lib/express_pigeon/api/lists.rb +0 -49
- data/lib/express_pigeon/api/messages.rb +0 -56
- data/lib/express_pigeon/api.rb +0 -66
- data/lib/express_pigeon/autoresponders.rb +0 -0
- data/lib/express_pigeon/meta_hash.rb +0 -20
- data/lib/express_pigeon/transactional_emails.rb +0 -4
- data/spec/express_pigeon/api/campaigns_spec.rb +0 -100
- data/spec/express_pigeon/api/contacts_spec.rb +0 -146
- data/spec/express_pigeon/api/lists_spec.rb +0 -23
- data/spec/express_pigeon/api/messages_spec.rb +0 -36
@@ -1,146 +0,0 @@
|
|
1
|
-
# RSpec.describe 'contacts integration test', skip: true do
|
2
|
-
# include PigeonSpecHelper
|
3
|
-
#
|
4
|
-
# it 'should not create contact without contact data' do
|
5
|
-
# resp = PIGEON.contacts.upsert(-1, {})
|
6
|
-
# validate_response resp, 400, 'error', /contact and contact.email are required/
|
7
|
-
# end
|
8
|
-
# it 'should not create contact without email' do
|
9
|
-
# resp = PIGEON.contacts.upsert -1, email: '', first_name: 'Marylin', last_name: 'Monroe'
|
10
|
-
# validate_response resp, 400, 'error', /contact and contact.email are required/
|
11
|
-
# end
|
12
|
-
#
|
13
|
-
# it 'should not add contact with too many custom fields' do
|
14
|
-
# custom_fields = {}
|
15
|
-
# (1..25).each { |n| custom_fields["custom_field_#{n}"] = n }
|
16
|
-
# resp = PIGEON.contacts.upsert -1, email: 'mary@e.e', custom_fields: custom_fields
|
17
|
-
# validate_response resp, 400, 'error', /You cannot create more than 20 custom fields. Use one of the 'custom_fields'./
|
18
|
-
# end
|
19
|
-
#
|
20
|
-
# it 'should not create new contact without list_id' do
|
21
|
-
# resp = PIGEON.contacts.upsert '', email: 'ee@e.e', first_name: 'Marylin', last_name: 'Monroe'
|
22
|
-
# validate_response resp, 404, 'error', /contact=ee@e.e not found/
|
23
|
-
# end
|
24
|
-
#
|
25
|
-
# it 'test_create_with_suppressed_contact' do
|
26
|
-
# resp = PIGEON.contacts.upsert -1, email: 'suppressed@e.e'
|
27
|
-
# validate_response resp, 400, 'error', /contact=suppressed@e.e is in suppress list/
|
28
|
-
# end
|
29
|
-
#
|
30
|
-
# it 'cannot create with non-existent_list' do
|
31
|
-
# resp = PIGEON.contacts.upsert -1, email: 'e@e.e'
|
32
|
-
# validate_response resp, 404, 'error', /list=-1 not found/
|
33
|
-
# end
|
34
|
-
#
|
35
|
-
# it 'creates list with contacts' do
|
36
|
-
# list_response = PIGEON.lists.create 'My List', 'John Doe', 'john@doe.com'
|
37
|
-
# list_id = list_response.list.id
|
38
|
-
# resp = PIGEON.contacts.upsert list_id, email: 'mary@e.e',
|
39
|
-
# custom_fields: { custom_field_1: 'custom_value_1' }
|
40
|
-
# validate_response resp, 200, 'success', /contact=mary@e.e created\/updated successfully/
|
41
|
-
# resp.contact.custom_fields.custom_field_1.should eq 'custom_value_1'
|
42
|
-
# resp.contact.email.should eq 'mary@e.e'
|
43
|
-
# resp.contact.email_format.should eq 'html'
|
44
|
-
# resp.contact.status.should eq 'ACTIVE'
|
45
|
-
# PIGEON.lists.delete(list_id)
|
46
|
-
# end
|
47
|
-
#
|
48
|
-
# it 'creates list non-existent custom field' do
|
49
|
-
# list_response = PIGEON.lists.create 'My List', 'John Doe', 'a@a.a'
|
50
|
-
# list_id = list_response.list.id
|
51
|
-
# resp = PIGEON.contacts.upsert(list_id, email: 'mary@e.e', custom_fields: { c: 'c' })
|
52
|
-
# validate_response resp, 200, 'success', nil
|
53
|
-
# PIGEON.lists.delete(list_id)
|
54
|
-
# end
|
55
|
-
#
|
56
|
-
# it 'cannot export contacts from list without list_id' do
|
57
|
-
# content = ''
|
58
|
-
# PIGEON.lists.csv '-1' do |c|
|
59
|
-
# content << c
|
60
|
-
# end
|
61
|
-
# resp = JSON.parse(content)
|
62
|
-
# validate_response MetaHash.new(resp), 404, 'error', /list=-1 not found/
|
63
|
-
# end
|
64
|
-
#
|
65
|
-
# it 'should get contacts from suppressed list' do
|
66
|
-
# content = ''
|
67
|
-
# PIGEON.lists.csv 'suppress_list' do |c|
|
68
|
-
# content += c
|
69
|
-
# end
|
70
|
-
# resp = content.split /\n/
|
71
|
-
# resp.size.should eq 2
|
72
|
-
# resp[1].should =~ /"suppressed@e.e","Suppressed","Doe"/
|
73
|
-
# end
|
74
|
-
#
|
75
|
-
# it 'should get single contact' do
|
76
|
-
# resp = PIGEON.contacts.find_by_email 'suppressed@e.e'
|
77
|
-
# resp.email.should eq 'suppressed@e.e'
|
78
|
-
# end
|
79
|
-
#
|
80
|
-
# it 'should not find non existent contact' do
|
81
|
-
# resp = PIGEON.contacts.find_by_email 'a@a.a'
|
82
|
-
# validate_response resp, 404, 'error', /contact=a@a.a not found/
|
83
|
-
# end
|
84
|
-
#
|
85
|
-
# it 'should update contact' do
|
86
|
-
# list_response = PIGEON.lists.create('My List', 'John Doe', 'a@a.a')
|
87
|
-
# resp = PIGEON.contacts.upsert list_response.list.id,
|
88
|
-
# email: 'mary@e.e', first_name: 'Mary', last_name: 'Doe'
|
89
|
-
# validate_response resp, 200, 'success', /contact=mary@e.e created\/updated successfully/
|
90
|
-
# PIGEON.contacts.find_by_email('mary@e.e').last_name.should eq 'Doe'
|
91
|
-
#
|
92
|
-
# resp = PIGEON.contacts.upsert list_response.list.id,
|
93
|
-
# email: 'mary@e.e', first_name: 'Mary', last_name: 'Johns'
|
94
|
-
# validate_response resp, 200, 'success', /contact=mary@e.e created\/updated successfully/
|
95
|
-
# PIGEON.contacts.find_by_email('mary@e.e').last_name.should eq 'Johns'
|
96
|
-
# end
|
97
|
-
#
|
98
|
-
# it 'cannot delete contact with non-existent email' do
|
99
|
-
# res = PIGEON.contacts.delete('g@g.g')
|
100
|
-
# validate_response res, 404, 'error', /contact=g@g.g not found/
|
101
|
-
# end
|
102
|
-
#
|
103
|
-
# it 'should not delete suppressed contact' do
|
104
|
-
# res = PIGEON.contacts.delete('suppressed@e.e')
|
105
|
-
# validate_response res, 400, 'error', /contact=suppressed@e.e is in suppress list/
|
106
|
-
# end
|
107
|
-
#
|
108
|
-
# it 'should delete single contact from all lists' do
|
109
|
-
# list_response = PIGEON.lists.create 'My List', 'Jane Doe', 'a@a.a'
|
110
|
-
# PIGEON.contacts.upsert list_response.list.id, email: 'mary@e.e'
|
111
|
-
# res = PIGEON.contacts.delete 'mary@e.e'
|
112
|
-
# validate_response res, 200, 'success', /contact=mary@e.e deleted successfully/
|
113
|
-
# PIGEON.lists.delete list_response.list.id
|
114
|
-
# end
|
115
|
-
#
|
116
|
-
# it 'deletes single contact from single list' do
|
117
|
-
# list_response = PIGEON.lists.create 'My List', 'John D.', 'a@a.a'
|
118
|
-
# list_response_2 = PIGEON.lists.create('My List2', 'Jane D.', 'a@a.a')
|
119
|
-
# PIGEON.contacts.upsert(list_response.list.id, email: 'mary@e.e')
|
120
|
-
# PIGEON.contacts.upsert(list_response_2.list.id, email: 'mary@e.e')
|
121
|
-
#
|
122
|
-
# res = PIGEON.contacts.delete 'mary@e.e', list_response.list.id
|
123
|
-
#
|
124
|
-
# validate_response res, 200, 'success', /contact=mary@e.e deleted successfully/
|
125
|
-
#
|
126
|
-
# contacts_exported = ''
|
127
|
-
# PIGEON.lists.csv list_response.list.id do |c|
|
128
|
-
# contacts_exported << c
|
129
|
-
# end
|
130
|
-
# contacts_exported = contacts_exported.split /\n/
|
131
|
-
# contacts_exported.size.should eq 1
|
132
|
-
#
|
133
|
-
# contacts_exported_2 = ''
|
134
|
-
# PIGEON.lists.csv list_response_2.list.id do |c|
|
135
|
-
# contacts_exported_2 << c
|
136
|
-
# end
|
137
|
-
#
|
138
|
-
# contacts_exported_2 = contacts_exported_2.split /\n/
|
139
|
-
# contacts_exported_2.size.should eq 2
|
140
|
-
# contacts_exported_2[1].should =~ /"mary@e.e"/
|
141
|
-
#
|
142
|
-
# PIGEON.lists.delete(list_response.list.id)
|
143
|
-
# PIGEON.lists.delete(list_response_2.list.id)
|
144
|
-
# PIGEON.contacts.delete('mary@e.e')
|
145
|
-
# end
|
146
|
-
# #end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# RSpec.describe 'contacts integration test', skip: true do
|
2
|
-
# include PigeonSpecHelper
|
3
|
-
#
|
4
|
-
# it 'test_create_and_delete_new_list(self):' do
|
5
|
-
# contact_list = PIGEON.lists.create 'Active customers', 'Bob', 'bob@acmetools.com'
|
6
|
-
#
|
7
|
-
# validate_response contact_list, 200, 'success', /list=#{contact_list.list.id} created\/updated successfully/
|
8
|
-
# contact_list.list.name.should eq 'Active customers'
|
9
|
-
# contact_list.list.from_name.should eq 'Bob'
|
10
|
-
# contact_list.list.reply_to.should eq 'bob@acmetools.com'
|
11
|
-
# contact_list.list.contact_count.should eq 0
|
12
|
-
#
|
13
|
-
# res = PIGEON.lists.delete(contact_list.list.id)
|
14
|
-
# validate_response res, 200, 'success', /list=#{contact_list.list.id} deleted successfully/
|
15
|
-
# end
|
16
|
-
#
|
17
|
-
# it 'should update existing list' do
|
18
|
-
# existing_list = PIGEON.lists.create('Update', 'Bob', 'bob@acmetools.com')
|
19
|
-
# end
|
20
|
-
#
|
21
|
-
# list_name = "Upload_#{Kernel.rand(9999)}"
|
22
|
-
# existing_list = PIGEON.lists.create(list_name, 'Bob', 'bob@acmetools.com')
|
23
|
-
# end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
# RSpec.describe 'transactional messages integration test', skip: true do
|
2
|
-
# include PigeonSpecHelper
|
3
|
-
#
|
4
|
-
# it 'sends a single transactional message' do
|
5
|
-
# message_response = PIGEON.messages.send_message 4905, ENV['TARGET_EMAIL'], ENV['TARGET_EMAIL'], 'Team ExpressPigeon', 'Hi there!', first_name: 'Igor'
|
6
|
-
#
|
7
|
-
# validate_response message_response, 200, 'success', /email queued/
|
8
|
-
# report = PIGEON.messages.report(message_response.id)
|
9
|
-
# report.id.should eq message_response.id
|
10
|
-
# end
|
11
|
-
#
|
12
|
-
# it 'test_sending_multiple_messages_and_get_reports_for_today(self):' do
|
13
|
-
# start = Time.now.utc - 60 # one minute ago
|
14
|
-
#
|
15
|
-
# message_response = PIGEON.messages.send_message 4905, ENV['TARGET_EMAIL'], ENV['TARGET_EMAIL'],
|
16
|
-
# 'Team EP', 'Hi, there!', first_name: 'Bob'
|
17
|
-
#
|
18
|
-
# validate_response message_response, 200, 'success', /email queued/
|
19
|
-
# message_response.id should_not be_nil
|
20
|
-
#
|
21
|
-
# message_response2 = PIGEON.messages.send_message 4905, ENV['TARGET_EMAIL'], ENV['TARGET_EMAIL'],
|
22
|
-
# 'Team EP', 'Hi, there!', first_name: 'Bob'
|
23
|
-
# validate_response message_response2, 200, 'success', /email queued/
|
24
|
-
# message_response2.id should_not be_nil
|
25
|
-
#
|
26
|
-
# finish = start + 120 # two minutes after start
|
27
|
-
# reports = PIGEON.messages.reports (message_response.id - 1), start, finish
|
28
|
-
#
|
29
|
-
# reports.size.should eq 2
|
30
|
-
# reports[0]['id'].should eq message_response.id
|
31
|
-
# reports[1]['id'].should eq message_response2.id
|
32
|
-
#
|
33
|
-
# reports[0]['email'].should eq ENV['TARGET_EMAIL']
|
34
|
-
# reports[1]['email'].should eq ENV['TARGET_EMAIL']
|
35
|
-
# end
|
36
|
-
# end
|