maropost 0.3.0 → 0.3.1
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 +3 -3
- data/lib/maropost/do_not_mail_list.rb +3 -3
- data/lib/maropost/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39e6f1d4da90fa3c4c9892b6b6f3b61e3e1d1a6c
|
4
|
+
data.tar.gz: c897b70a3579757098f9e9d454bff2b892e38b04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ed92b4f9101bedef107aa8208ea13abc5e0c8598cef2b1ec96f91dceae4cc691970e23874d6d063fddc5bd892bd0edcda019ee82c1c7d0f85a547b46388b371
|
7
|
+
data.tar.gz: 7c5e53edfce997062836955401cc26e9d0c869a86974d7da5b67836016e0edbd4e03dbfb2c5470872082e518d8a2fe68852b021197f5fc42b190745a95971a78
|
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('
|
5
|
+
maropost_url('contacts/email.json', "contact[email]=#{email}"))
|
6
6
|
Maropost::Contact.new(JSON.parse response.body)
|
7
7
|
rescue RestClient::ResourceNotFound
|
8
8
|
nil
|
@@ -20,7 +20,7 @@ module Maropost
|
|
20
20
|
|
21
21
|
def self.create(contact)
|
22
22
|
response = request(:post,
|
23
|
-
maropost_url('
|
23
|
+
maropost_url('contacts.json'),
|
24
24
|
create_or_update_payload(contact))
|
25
25
|
Maropost::Contact.new(JSON.parse response.body)
|
26
26
|
rescue RestClient::UnprocessableEntity, RestClient::BadRequest => e
|
@@ -30,7 +30,7 @@ module Maropost
|
|
30
30
|
|
31
31
|
def self.update(contact)
|
32
32
|
response = request(:put,
|
33
|
-
maropost_url("
|
33
|
+
maropost_url("contacts/#{contact.id}.json"),
|
34
34
|
create_or_update_payload(contact))
|
35
35
|
Maropost::Contact.new(JSON.parse response.body)
|
36
36
|
rescue RestClient::UnprocessableEntity, RestClient::BadRequest => e
|
@@ -2,7 +2,7 @@ module Maropost
|
|
2
2
|
class DoNotMailList
|
3
3
|
def self.exists?(contact)
|
4
4
|
response = request(:get,
|
5
|
-
maropost_url('
|
5
|
+
maropost_url('global_unsubscribes/email.json', "contact[email]=#{contact.email}"))
|
6
6
|
JSON.parse response.body
|
7
7
|
|
8
8
|
response['id'] ? true : false
|
@@ -15,7 +15,7 @@ module Maropost
|
|
15
15
|
payload = { 'global_unsubscribe': { 'email': contact.email } }
|
16
16
|
|
17
17
|
request(:post,
|
18
|
-
maropost_url('
|
18
|
+
maropost_url('global_unsubscribes.json'),
|
19
19
|
payload)
|
20
20
|
contact
|
21
21
|
rescue RestClient::UnprocessableEntity, RestClient::BadRequest => e
|
@@ -25,7 +25,7 @@ module Maropost
|
|
25
25
|
|
26
26
|
def self.delete(contact)
|
27
27
|
request(:delete,
|
28
|
-
maropost_url('
|
28
|
+
maropost_url('global_unsubscribes/delete.json', "email=#{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