maropost 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/maropost/api.rb +22 -20
- data/lib/maropost/do_not_mail_list.rb +2 -2
- data/lib/maropost/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d46cc851445cb8bb9b24438e695176ccec886f5b
|
4
|
+
data.tar.gz: 77fba51fa490defd9d70aa357af6944275138e33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 663220a79654e756bf764d93abebd008a07fcacf95ea22fc0d97ff611e5bd4619054cd963024e52ab0c77deb3aab3e8c9c43d920b58c6f93318b91d7100f042e
|
7
|
+
data.tar.gz: 155e82c202e4217d3ce0e2cf9bfa06fe1bc5ebf0afc6132a5ab52064ea106d76a5af3af43c612cc4baa47fe763a0d97d517dfe7d1851cf0f6ff8c7011dc49047
|
data/lib/maropost/api.rb
CHANGED
@@ -2,7 +2,7 @@ module Maropost
|
|
2
2
|
class Api
|
3
3
|
def self.find(email)
|
4
4
|
response = request(:get,
|
5
|
-
maropost_url('contacts/email.json', "contact[email]=#{email}"))
|
5
|
+
maropost_url('contacts/email.json', "contact[email]=#{CGI::escape(email)}"))
|
6
6
|
Maropost::Contact.new(JSON.parse response.body)
|
7
7
|
rescue RestClient::ResourceNotFound
|
8
8
|
nil
|
@@ -20,8 +20,8 @@ module Maropost
|
|
20
20
|
|
21
21
|
def self.create(contact)
|
22
22
|
response = request(:post,
|
23
|
-
|
24
|
-
|
23
|
+
maropost_url('contacts.json'),
|
24
|
+
create_or_update_payload(contact))
|
25
25
|
Maropost::Contact.new(JSON.parse response.body)
|
26
26
|
rescue RestClient::UnprocessableEntity, RestClient::BadRequest => e
|
27
27
|
contact.errors << 'Unable to create or update contact'
|
@@ -59,24 +59,26 @@ module Maropost
|
|
59
59
|
def self.create_or_update_payload(contact)
|
60
60
|
{
|
61
61
|
contact:
|
62
|
-
{
|
62
|
+
{
|
63
|
+
email: contact.email,
|
63
64
|
phone: contact.phone_number,
|
64
|
-
custom_field:
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
65
|
+
custom_field:
|
66
|
+
{
|
67
|
+
ama_rewards: contact.ama_rewards,
|
68
|
+
ama_membership: contact.ama_membership,
|
69
|
+
ama_insurance: contact.ama_insurance,
|
70
|
+
ama_travel: contact.ama_travel,
|
71
|
+
ama_new_member_series: contact.ama_new_member_series,
|
72
|
+
ama_fleet_safety: contact.ama_fleet_safety,
|
73
|
+
ovrr_personal: contact.ovrr_personal,
|
74
|
+
ovrr_business: contact.ovrr_business,
|
75
|
+
ovrr_associate: contact.ovrr_associate,
|
76
|
+
ama_vr_reminder: contact.ama_vr_reminder,
|
77
|
+
ama_vr_reminder_email: contact.ama_vr_reminder_email,
|
78
|
+
ama_vr_reminder_sms: contact.ama_vr_reminder_sms,
|
79
|
+
ama_vr_reminder_autocall: contact.ama_vr_reminder_autocall,
|
80
|
+
cell_phone_number: contact.cell_phone_number
|
81
|
+
}
|
80
82
|
}
|
81
83
|
}
|
82
84
|
end
|
@@ -2,7 +2,7 @@ module Maropost
|
|
2
2
|
class DoNotMailList
|
3
3
|
def self.exists?(contact)
|
4
4
|
response = request(:get,
|
5
|
-
maropost_url('global_unsubscribes/email.json', "contact[email]=#{contact.email}"))
|
5
|
+
maropost_url('global_unsubscribes/email.json', "contact[email]=#{CGI::escape(contact.email)}"))
|
6
6
|
JSON.parse response.body
|
7
7
|
|
8
8
|
response['id'] ? true : false
|
@@ -25,7 +25,7 @@ module Maropost
|
|
25
25
|
|
26
26
|
def self.delete(contact)
|
27
27
|
request(:delete,
|
28
|
-
maropost_url('global_unsubscribes/delete.json', "email=#{contact.email}"))
|
28
|
+
maropost_url('global_unsubscribes/delete.json', "email=#{CGI::escape(contact.email)}"))
|
29
29
|
contact
|
30
30
|
rescue RestClient::UnprocessableEntity, RestClient::BadRequest => e
|
31
31
|
contact.errors << "Unable to unsubscribe contact. Error: #{e.message}"
|
data/lib/maropost/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: maropost
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael van den Beuken
|
@@ -21,7 +21,7 @@ authors:
|
|
21
21
|
autorequire:
|
22
22
|
bindir: exe
|
23
23
|
cert_chain: []
|
24
|
-
date: 2017-10-
|
24
|
+
date: 2017-10-15 00:00:00.000000000 Z
|
25
25
|
dependencies:
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: rest-client
|