maropost_api 0.3.0 → 0.4.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: ddb794beb8cb9b0269f4b27e14fbb6d9073d1605
4
- data.tar.gz: 735572c1e13f7b4485bc90ee59d30c41d38d1a5e
3
+ metadata.gz: 8e52f2fcdf513ba4a8a8a6ca5243b1fc67ca5d09
4
+ data.tar.gz: b56a5af3403ce595e25dd0d87d75f377c54548c7
5
5
  SHA512:
6
- metadata.gz: cfd61b950de0bbb3a3f22eb8167f38cfa3eab621ffa2caaeaf8b67782dc1e4fa7c1579b5a7b8beaef2bf57dc301404193f4b28defa76b03ad57e362955a84152
7
- data.tar.gz: d6036a45579bc6de18d6d4a9e3ea2971d8607780fe1c010ca067641f464c72f5f8de010eb7f4794db07569aeca8bbee285518102669517702a3515a107ef6ccf
6
+ metadata.gz: 02c2cb9f28a1f2049916919a8db91c5cf1aad3a6a8d5315aa4fdf97420956897d73a67e927764fc5bf55abac28e06dd293cbb5aec862f357d05d17d68f3641aa
7
+ data.tar.gz: e9fee3ed692756f64ed372a602593a0ac862b9ed06edf2a088c18fd7db08a4936521c53cc0aa60941c68b7a0ca51d2ff122c5ca62a3438737d5c50356cf4f49c
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.0
5
+ before_install: gem install bundler -v 1.12.5
data/lib/maropost_api.rb CHANGED
@@ -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/journeys"
10
11
  require "maropost_api/global_unsubscribes"
11
12
 
12
13
  module MaropostApi
@@ -8,6 +8,10 @@ module MaropostApi
8
8
  @contacts ||= Contacts.new(request: @request)
9
9
  end
10
10
 
11
+ def journeys
12
+ @journeys ||= Journeys.new(request: @request)
13
+ end
14
+
11
15
  def workflows
12
16
  @workflows ||= Workflows.new(request: @request)
13
17
  end
@@ -0,0 +1,28 @@
1
+ module MaropostApi
2
+ class Journeys
3
+ def initialize(request:, parser: Parser::EntityParser.new)
4
+ @request = request
5
+ @parser = parser
6
+ end
7
+
8
+ def stop(journey_id:, contact_id:)
9
+ response = @request.put(endpoint: "/journeys/#{journey_id}/stop/#{contact_id}.json")
10
+ Response.new(response: response, parser: @parser).call
11
+ end
12
+
13
+ def start(journey_id:, contact_id:)
14
+ response = @request.put(endpoint: "/journeys/#{journey_id}/start/#{contact_id}.json")
15
+ Response.new(response: response, parser: @parser).call
16
+ end
17
+
18
+ def reset(journey_id:, contact_id:)
19
+ response = @request.put(endpoint: "/journeys/#{journey_id}/reset/#{contact_id}.json")
20
+ Response.new(response: response, parser: @parser).call
21
+ end
22
+
23
+ def stop_all_journeys(email:)
24
+ response = @request.put(endpoint: "/journeys/stop_all_journeys.json?email=#{CGI.escape(email)}")
25
+ Response.new(response: response, parser: @parser).call
26
+ end
27
+ end
28
+ end
@@ -1,3 +1,3 @@
1
1
  module MaropostApi
2
- VERSION = '0.3.0'
2
+ VERSION = '0.4.0'
3
3
  end
data/readme.md CHANGED
@@ -1,4 +1,5 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/maropost_api.svg)](https://badge.fury.io/rb/maropost_api)
2
+ [![Build Status](https://travis-ci.org/hosseintoussi/maropost_api.svg?branch=adding-support-for-journeys)](https://travis-ci.org/hosseintoussi/maropost_api)
2
3
 
3
4
  # MaropostApi
4
5
 
@@ -48,6 +49,26 @@ client.contacts.update(contact_id: '<id>', params: {email: 'test@example.com', f
48
49
  # To unsubscribe a contact from all lists
49
50
  client.contacts.unsubscribe_all_lists(email: 'test@example.com')
50
51
 
52
+ # To check if a contact is in DNM list:
53
+ client.global_unsubscribes.find_by_email(email: 'test@example.com')
54
+
55
+ # To add a contact to DNM list:
56
+ client.global_unsubscribes.add_to_dnm(email: 'test@example.com')
57
+
58
+ # To start a journey for a contact
59
+ client.journeys.start(journey_id: '<journey_id>', contact_id: '<contact_id>')
60
+
61
+ # To stop journey for a contact
62
+ client.journeys.stop(journey_id: '<journey_id>', contact_id: '<contact_id>')
63
+
64
+ # To reset a journey for a contact
65
+ client.journeys.reset(journey_id: '<journey_id>', contact_id: '<contact_id>')
66
+
67
+ # To stop all journeys for a contact
68
+ client.journeys.stop_all_journeys(email: 'test@example.com')
69
+
70
+ ## Endpoints that are going to be deprecated soon:
71
+
51
72
  # To start a workflow for a contact
52
73
  client.workflows.start(workflow_id: '<workflow_id>', contact_id: '<contact_id>')
53
74
 
@@ -56,12 +77,6 @@ client.workflows.stop(workflow_id: '<workflow_id>', contact_id: '<contact_id>')
56
77
 
57
78
  # To reset a workflow for a contact
58
79
  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')
65
80
  ```
66
81
 
67
82
  ## 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.3.0
4
+ version: 0.4.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-16 00:00:00.000000000 Z
12
+ date: 2016-09-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -133,6 +133,7 @@ extra_rdoc_files: []
133
133
  files:
134
134
  - ".gitignore"
135
135
  - ".rspec"
136
+ - ".travis.yml"
136
137
  - Gemfile
137
138
  - LICENSE.txt
138
139
  - Rakefile
@@ -143,6 +144,7 @@ files:
143
144
  - lib/maropost_api/contacts.rb
144
145
  - lib/maropost_api/errors.rb
145
146
  - lib/maropost_api/global_unsubscribes.rb
147
+ - lib/maropost_api/journeys.rb
146
148
  - lib/maropost_api/parser/entity_parser.rb
147
149
  - lib/maropost_api/request.rb
148
150
  - lib/maropost_api/response.rb