maropost_api 0.2.1 → 0.2.2
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 +0 -1
- data/lib/maropost_api/contacts.rb +4 -2
- data/lib/maropost_api/version.rb +1 -1
- data/lib/maropost_api/workflows.rb +5 -6
- data/readme.md +5 -0
- metadata +2 -3
- data/lib/maropost_api/parser/message_body_parser.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7dc66c3cbcc15141e340c383214139b27cfc3281
|
4
|
+
data.tar.gz: ef13a2dca9de1962188db892f36eec7673b3dfdd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b615b3dd47c64109c0d98751b2f32916ae198463d0004b3393bbb0695e5e85595c0c66a9ad2772ba618fdde7ce2756d8431031cddcb5e6d8a7318b92731234f4
|
7
|
+
data.tar.gz: dd4b7add3fad5b892ce2de342eba5ed7f1737e14c5223db13503dafc4739534fd8d38213a64d5fdaa7964a63f2b3dcdca74ce1f5a1bfaf5f83725d870f4ef558
|
data/lib/maropost_api.rb
CHANGED
@@ -4,7 +4,6 @@ require "maropost_api/request"
|
|
4
4
|
require "maropost_api/errors"
|
5
5
|
require "maropost_api/response"
|
6
6
|
require "maropost_api/parser/entity_parser"
|
7
|
-
require "maropost_api/parser/message_body_parser"
|
8
7
|
require "maropost_api/client"
|
9
8
|
require "maropost_api/contacts"
|
10
9
|
require "maropost_api/workflows"
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module MaropostApi
|
2
2
|
class Contacts
|
3
|
-
def initialize(request:)
|
3
|
+
def initialize(request:, parser: Parser::EntityParser.new)
|
4
4
|
@request = request
|
5
|
-
@parser =
|
5
|
+
@parser = parser
|
6
6
|
end
|
7
7
|
|
8
8
|
def find_by_email(email:)
|
@@ -29,5 +29,7 @@ module MaropostApi
|
|
29
29
|
response = @request.put(endpoint: "/contacts/unsubscribe_all.json?contact[email]=#{CGI.escape(email)}")
|
30
30
|
Response.new(response: response, parser: @parser).call
|
31
31
|
end
|
32
|
+
|
33
|
+
alias :upsert :create
|
32
34
|
end
|
33
35
|
end
|
data/lib/maropost_api/version.rb
CHANGED
@@ -1,24 +1,23 @@
|
|
1
1
|
module MaropostApi
|
2
2
|
class Workflows
|
3
|
-
def initialize(request:)
|
3
|
+
def initialize(request:, parser: Parser::EntityParser.new)
|
4
4
|
@request = request
|
5
|
-
@
|
6
|
-
@entity_parser = Parser::EntityParser.new
|
5
|
+
@parser = parser
|
7
6
|
end
|
8
7
|
|
9
8
|
def stop(workflow_id:, contact_id:)
|
10
9
|
response = @request.put(endpoint: "/workflows/#{workflow_id}/stop/#{contact_id}.json")
|
11
|
-
Response.new(response: response, parser: @
|
10
|
+
Response.new(response: response, parser: @parser).call
|
12
11
|
end
|
13
12
|
|
14
13
|
def start(workflow_id:, contact_id:)
|
15
14
|
response = @request.put(endpoint: "/workflows/#{workflow_id}/start/#{contact_id}.json")
|
16
|
-
Response.new(response: response, parser: @
|
15
|
+
Response.new(response: response, parser: @parser).call
|
17
16
|
end
|
18
17
|
|
19
18
|
def reset(workflow_id:, contact_id:)
|
20
19
|
response = @request.put(endpoint: "/workflows/#{workflow_id}/reset/#{contact_id}.json")
|
21
|
-
Response.new(response: response, parser: @
|
20
|
+
Response.new(response: response, parser: @parser).call
|
22
21
|
end
|
23
22
|
end
|
24
23
|
end
|
data/readme.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
[](https://badge.fury.io/rb/maropost_api)
|
2
|
+
|
1
3
|
# MaropostApi
|
2
4
|
|
3
5
|
A simple ruby wrapper for Maropost (http://maropost.com/) API.
|
@@ -37,6 +39,9 @@ client.contacts.add_to_list(list_ids: '<id>', params: {email: 'test@example.com'
|
|
37
39
|
# To create a contact without any lists
|
38
40
|
client.contacts.create(params: {email: 'test@example.com'})
|
39
41
|
|
42
|
+
# Upsert, alias for contacts.create
|
43
|
+
client.contacts.upsert(params: {email: 'test@example.com'})
|
44
|
+
|
40
45
|
# To update a contact
|
41
46
|
client.contacts.update(contact_id: '<id>', params: {email: 'test@example.com', first_name: 'test-updated'})
|
42
47
|
|
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.
|
4
|
+
version: 0.2.2
|
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-
|
12
|
+
date: 2016-08-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -143,7 +143,6 @@ files:
|
|
143
143
|
- lib/maropost_api/contacts.rb
|
144
144
|
- lib/maropost_api/errors.rb
|
145
145
|
- lib/maropost_api/parser/entity_parser.rb
|
146
|
-
- lib/maropost_api/parser/message_body_parser.rb
|
147
146
|
- lib/maropost_api/request.rb
|
148
147
|
- lib/maropost_api/response.rb
|
149
148
|
- lib/maropost_api/version.rb
|