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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7dc66c3cbcc15141e340c383214139b27cfc3281
4
- data.tar.gz: ef13a2dca9de1962188db892f36eec7673b3dfdd
3
+ metadata.gz: ddb794beb8cb9b0269f4b27e14fbb6d9073d1605
4
+ data.tar.gz: 735572c1e13f7b4485bc90ee59d30c41d38d1a5e
5
5
  SHA512:
6
- metadata.gz: b615b3dd47c64109c0d98751b2f32916ae198463d0004b3393bbb0695e5e85595c0c66a9ad2772ba618fdde7ce2756d8431031cddcb5e6d8a7318b92731234f4
7
- data.tar.gz: dd4b7add3fad5b892ce2de342eba5ed7f1737e14c5223db13503dafc4739534fd8d38213a64d5fdaa7964a63f2b3dcdca74ce1f5a1bfaf5f83725d870f4ef558
6
+ metadata.gz: cfd61b950de0bbb3a3f22eb8167f38cfa3eab621ffa2caaeaf8b67782dc1e4fa7c1579b5a7b8beaef2bf57dc301404193f4b28defa76b03ad57e362955a84152
7
+ data.tar.gz: d6036a45579bc6de18d6d4a9e3ea2971d8607780fe1c010ca067641f464c72f5f8de010eb7f4794db07569aeca8bbee285518102669517702a3515a107ef6ccf
@@ -7,6 +7,7 @@ require "maropost_api/parser/entity_parser"
7
7
  require "maropost_api/client"
8
8
  require "maropost_api/contacts"
9
9
  require "maropost_api/workflows"
10
+ require "maropost_api/global_unsubscribes"
10
11
 
11
12
  module MaropostApi
12
13
  end
@@ -11,5 +11,9 @@ module MaropostApi
11
11
  def workflows
12
12
  @workflows ||= Workflows.new(request: @request)
13
13
  end
14
+
15
+ def global_unsubscribes
16
+ @global_unsubscribes ||= GlobalUnsubscribes.new(request: @request)
17
+ end
14
18
  end
15
19
  end
@@ -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
@@ -1,3 +1,3 @@
1
1
  module MaropostApi
2
- VERSION = '0.2.2'
2
+ VERSION = '0.3.0'
3
3
  end
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.2.2
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-09 00:00:00.000000000 Z
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