maropost_api 0.2.2 → 0.3.0
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/lib/maropost_api.rb +1 -0
- data/lib/maropost_api/client.rb +4 -0
- data/lib/maropost_api/global_unsubscribes.rb +19 -0
- data/lib/maropost_api/version.rb +1 -1
- data/readme.md +6 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ddb794beb8cb9b0269f4b27e14fbb6d9073d1605
|
4
|
+
data.tar.gz: 735572c1e13f7b4485bc90ee59d30c41d38d1a5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfd61b950de0bbb3a3f22eb8167f38cfa3eab621ffa2caaeaf8b67782dc1e4fa7c1579b5a7b8beaef2bf57dc301404193f4b28defa76b03ad57e362955a84152
|
7
|
+
data.tar.gz: d6036a45579bc6de18d6d4a9e3ea2971d8607780fe1c010ca067641f464c72f5f8de010eb7f4794db07569aeca8bbee285518102669517702a3515a107ef6ccf
|
data/lib/maropost_api.rb
CHANGED
data/lib/maropost_api/client.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
module MaropostApi
|
2
|
+
class GlobalUnsubscribes
|
3
|
+
def initialize(request:, parser: Parser::EntityParser.new)
|
4
|
+
@request = request
|
5
|
+
@parser = parser
|
6
|
+
end
|
7
|
+
|
8
|
+
def find_by_email(email:)
|
9
|
+
response = @request.get(endpoint: "/global_unsubscribes/email.json?contact[email]=#{CGI.escape(email)}")
|
10
|
+
Response.new(response: response, parser: @parser).call
|
11
|
+
end
|
12
|
+
|
13
|
+
def add_to_dnm(email:)
|
14
|
+
params = { "global_unsubscribe": { "email": email } }
|
15
|
+
response = @request.post(endpoint: "/global_unsubscribes.json", params: params)
|
16
|
+
Response.new(response: response, parser: @parser).call
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/maropost_api/version.rb
CHANGED
data/readme.md
CHANGED
@@ -56,6 +56,12 @@ client.workflows.stop(workflow_id: '<workflow_id>', contact_id: '<contact_id>')
|
|
56
56
|
|
57
57
|
# To reset a workflow for a contact
|
58
58
|
client.workflows.reset(workflow_id: '<workflow_id>', contact_id: '<contact_id>')
|
59
|
+
|
60
|
+
# To check if a contact is in DNM list:
|
61
|
+
client.global_unsubscribes.find_by_email(email: 'test@example.com')
|
62
|
+
|
63
|
+
# To add a contact to DNM list:
|
64
|
+
client.global_unsubscribes.add_to_dnm(email: 'test@example.com')
|
59
65
|
```
|
60
66
|
|
61
67
|
## Development
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: maropost_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hossein Toussi
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-08-
|
12
|
+
date: 2016-08-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -142,6 +142,7 @@ files:
|
|
142
142
|
- lib/maropost_api/client.rb
|
143
143
|
- lib/maropost_api/contacts.rb
|
144
144
|
- lib/maropost_api/errors.rb
|
145
|
+
- lib/maropost_api/global_unsubscribes.rb
|
145
146
|
- lib/maropost_api/parser/entity_parser.rb
|
146
147
|
- lib/maropost_api/request.rb
|
147
148
|
- lib/maropost_api/response.rb
|