mailup 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +7 -0
- data/LICENSE +21 -0
- data/README.md +6 -2
- data/Rakefile +1 -1
- data/lib/mailup.rb +24 -1
- data/lib/mailup/console/base.rb +1 -1
- data/lib/mailup/console/email.rb +47 -2
- data/lib/mailup/console/group.rb +25 -13
- data/lib/mailup/console/import.rb +11 -3
- data/lib/mailup/console/list.rb +79 -51
- data/lib/mailup/console/recipient.rb +6 -5
- data/lib/mailup/public/console.rb +3 -3
- data/lib/mailup/version.rb +1 -1
- data/mailup.gemspec +7 -5
- data/spec/mailup/console/base_spec.rb +2 -2
- data/spec/mailup/console/group_spec.rb +8 -2
- data/spec/mailup/console/import_spec.rb +7 -1
- data/spec/mailup/console/list_spec.rb +21 -2
- data/spec/mailup/public/base_spec.rb +1 -1
- data/spec/mailup/public/console_spec.rb +5 -5
- data/spec/mailup/stats/base_spec.rb +1 -1
- data/spec/spec_helper.rb +9 -0
- metadata +38 -14
- data/LICENSE.txt +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 022ed54407b8cdb93c017bf25f3fcd002395230d
|
4
|
+
data.tar.gz: ae2e4c7aa56dd02173851fc7f6ce25e1e76c001d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0ecb6b846da02d4a1dcae714c07d93707db6598818100bcbb3ae0253561c618ad9bcb47542d7ffe317e75da03639f9ecc6623d25c77e515746c8aa527590690
|
7
|
+
data.tar.gz: f5b33ac0f05b5ea2dfee10b498e9b4dda0b56ad4363d84043a15261ce29d2c5677ebe54e4c03cf27331050ee0284fdb4bcc7a6cffd85c2154d14ad785174223c
|
data/.travis.yml
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 MailUp S.p.A
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
A Ruby gem for interacting with the MailUp REST API.
|
4
4
|
|
5
|
+
[![Build Status](https://travis-ci.org/mailup/mailup-ruby.svg)](https://travis-ci.org/mailup/mailup-ruby)
|
6
|
+
[![Coverage Status](https://img.shields.io/coveralls/mailup/mailup-ruby.svg)](https://coveralls.io/r/mailup/mailup-ruby)
|
7
|
+
[![Code Climate](https://codeclimate.com/github/mailup/mailup-ruby/badges/gpa.svg)](https://codeclimate.com/github/mailup/mailup-ruby)
|
8
|
+
[![Dependency Status](https://gemnasium.com/mailup/mailup-ruby.svg)](https://gemnasium.com/mailup/mailup-ruby)
|
5
9
|
## Installation
|
6
10
|
|
7
11
|
Install the gem directly:
|
@@ -37,7 +41,7 @@ credentials = {
|
|
37
41
|
}
|
38
42
|
}
|
39
43
|
|
40
|
-
mailup = MailUp::
|
44
|
+
mailup = MailUp::API.new(credentials)
|
41
45
|
```
|
42
46
|
|
43
47
|
### Console Methods
|
@@ -76,4 +80,4 @@ views_count = mailup.stats.message(17).views_count
|
|
76
80
|
|
77
81
|
fields = mailup.stats.recipient(5).fields
|
78
82
|
# => {"IsPaginated"=>true, "Items"=>[{"Description"=>"AllOrderedProductIDs", "Id"=>26}, ...], ...}
|
79
|
-
```
|
83
|
+
```
|
data/Rakefile
CHANGED
data/lib/mailup.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
require 'oauth2'
|
2
2
|
require 'multi_json'
|
3
|
+
require "net/https"
|
4
|
+
require 'json'
|
5
|
+
require "uri"
|
3
6
|
|
4
7
|
require 'mailup/version'
|
5
8
|
require 'mailup/errors'
|
@@ -19,7 +22,7 @@ require 'mailup/stats/recipient'
|
|
19
22
|
|
20
23
|
module MailUp
|
21
24
|
class API
|
22
|
-
attr_accessor :access_token, :debug, :host, :path
|
25
|
+
attr_accessor :access_token, :debug, :host, :path, :credentials
|
23
26
|
|
24
27
|
# Initialize a new (thread-safe) API instance.
|
25
28
|
#
|
@@ -49,6 +52,7 @@ module MailUp
|
|
49
52
|
@debug = debug
|
50
53
|
@host = 'https://services.mailup.com'
|
51
54
|
@path = ''
|
55
|
+
@credentials = credentials
|
52
56
|
|
53
57
|
# Validate the credentials
|
54
58
|
raise Error.new, 'MailUp credentials missing' if credentials.nil? or !credentials.is_a?(Hash)
|
@@ -103,6 +107,25 @@ module MailUp
|
|
103
107
|
end
|
104
108
|
end
|
105
109
|
|
110
|
+
# Make a request with for Provisioning Calls.
|
111
|
+
#
|
112
|
+
# @param [Symbol] verb the HTTP request method
|
113
|
+
# @param [String] path the HTTP URL path of the request
|
114
|
+
# @param [Hash] opts the options to make the request with
|
115
|
+
#
|
116
|
+
def provisioning_request(path, body = nil) # :nodoc:
|
117
|
+
uri = URI.parse(@host)
|
118
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
119
|
+
http.use_ssl = true
|
120
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
121
|
+
|
122
|
+
req = Net::HTTP::Post.new(path, initheader = {'Content-Type' =>'application/json'})
|
123
|
+
req.basic_auth @credentials[:client_id], @credentials[:client_secret]
|
124
|
+
req.body = body.to_json
|
125
|
+
|
126
|
+
http.request(req).body.to_json
|
127
|
+
end
|
128
|
+
|
106
129
|
# Make a GET request with the Access Token
|
107
130
|
# @see #request
|
108
131
|
#
|
data/lib/mailup/console/base.rb
CHANGED
data/lib/mailup/console/email.rb
CHANGED
@@ -4,11 +4,11 @@ module MailUp
|
|
4
4
|
attr_accessor :api
|
5
5
|
|
6
6
|
def initialize(api)
|
7
|
-
|
7
|
+
@api = api
|
8
8
|
end
|
9
9
|
|
10
10
|
# Send single email message to specified recipient.
|
11
|
-
#
|
11
|
+
#
|
12
12
|
# @param [Integer] message_id The ID of the message to send.
|
13
13
|
# @param [String] email The email address of the recipient.
|
14
14
|
#
|
@@ -30,6 +30,51 @@ module MailUp
|
|
30
30
|
@api.post("#{@api.path}/Email/Send", body: {:idMessage => message_id, :Email => email})
|
31
31
|
end
|
32
32
|
|
33
|
+
# Schedules a mailing for immediate sending
|
34
|
+
#
|
35
|
+
# @param [Integer] Id Sending.
|
36
|
+
#
|
37
|
+
def send_immediate_confirmation(sending_id)
|
38
|
+
@api.post("#{@api.path}/Email/Sendings/#{sending_id}/Immediate")
|
39
|
+
end
|
40
|
+
|
41
|
+
# Retrieves the earliest date to schedule the given sending task.
|
42
|
+
#
|
43
|
+
# @param [Integer] Id Sending.
|
44
|
+
#
|
45
|
+
def get_deferred_confirmation_date(sending_id)
|
46
|
+
@api.get("#{@api.path}/Email/Sendings/#{sending_id}/Deferred")
|
47
|
+
end
|
48
|
+
|
49
|
+
# Sets up a mailing for scheduled delivery
|
50
|
+
#
|
51
|
+
# @param [Integer] Id Sending.
|
52
|
+
# @param [String] :Date date/time for a deferred sending(should be UTC).
|
53
|
+
#
|
54
|
+
def send_deferred_confirmation(sending_id, date = nil)
|
55
|
+
@api.post("#{@api.path}/Email/Sendings/#{sending_id}/Deferred", body: {'Date' => date})
|
56
|
+
end
|
57
|
+
|
58
|
+
# Retrieves the list of email messages that are currently queued up for "immediate sending".
|
59
|
+
#
|
60
|
+
#
|
61
|
+
def get_immediate_confirmation_queque
|
62
|
+
@api.get("#{@api.path}/Email/Sendings/Immediate")
|
63
|
+
end
|
64
|
+
|
65
|
+
# Retrieves the list of email messages that are currently queued up for "deferred sending".
|
66
|
+
#
|
67
|
+
#
|
68
|
+
def get_deferred_confirmation_queque
|
69
|
+
@api.get("#{@api.path}/Email/Sendings/Deferred")
|
70
|
+
end
|
71
|
+
|
72
|
+
# Retrieves the list of email messages that are neither "scheduled" nor queued up for "immediate sending".
|
73
|
+
#
|
74
|
+
#
|
75
|
+
def get_undefined_confirmation_queque
|
76
|
+
@api.get("#{@api.path}/Email/Sendings/Undefined")
|
77
|
+
end
|
33
78
|
end
|
34
79
|
end
|
35
80
|
end
|
data/lib/mailup/console/group.rb
CHANGED
@@ -4,24 +4,36 @@ module MailUp
|
|
4
4
|
attr_accessor :api
|
5
5
|
|
6
6
|
def initialize(id, api)
|
7
|
-
|
8
|
-
|
7
|
+
@api = api
|
8
|
+
@id = id
|
9
|
+
end
|
10
|
+
|
11
|
+
# Import a recipient to the specified group(synchronous import).
|
12
|
+
#
|
13
|
+
# @param [Hash] recipient data, see ConsoleRecipientItems (See http://help.mailup.com/display/mailupapi/Models+v1.1#Modelsv1.1-ConsoleRecipientItem).
|
14
|
+
# @param [Hash] params Optional params or filters:
|
15
|
+
# @option params [Boolean] :ConfirmEmail Confirmed opt-in option. Default false.
|
16
|
+
#
|
17
|
+
# @see http://help.mailup.com/display/mailupapi/Console+methods+v1.1#Consolemethodsv1.1-AsyncImportRecipientsToGroup
|
18
|
+
#
|
19
|
+
def add_recipient(recipient, params = {})
|
20
|
+
@api.post("#{@api.path}/Group/#{@id}/Recipient", body: recipient, params: params)
|
9
21
|
end
|
10
22
|
|
11
23
|
# Async Import recipients to the specified group.
|
12
|
-
#
|
13
|
-
# @param [Array] recipients an array ConsoleRecipientItems (See http://help.mailup.com/display/mailupapi/Models+v1.1#Modelsv1.1-ConsoleRecipientItem).
|
14
24
|
#
|
15
|
-
# @
|
25
|
+
# @param [Array] recipients an array ConsoleRecipientItems (See http://help.mailup.com/display/mailupapi/Models+v1.1#Modelsv1.1-ConsoleRecipientItem).
|
26
|
+
# @param [Hash] params Optional params or filters:
|
27
|
+
# @option params [Boolean] :ConfirmEmail Confirmed opt-in option. Default false.
|
16
28
|
#
|
17
29
|
# @see http://help.mailup.com/display/mailupapi/Console+methods+v1.1#Consolemethodsv1.1-AsyncImportRecipientsToGroup
|
18
30
|
#
|
19
|
-
def add_recipients(recipients)
|
20
|
-
@api.post("#{@api.path}/Group/#{@id}/Recipients", body: recipients)
|
31
|
+
def add_recipients(recipients, params = {})
|
32
|
+
@api.post("#{@api.path}/Group/#{@id}/Recipients", body: recipients, params: params)
|
21
33
|
end
|
22
|
-
|
34
|
+
|
23
35
|
# Retrieve the recipients in the specified group.
|
24
|
-
#
|
36
|
+
#
|
25
37
|
# @param [Hash] params Optional params or filters:
|
26
38
|
# @option params [Integer] :pageNumber The page number to return.
|
27
39
|
# @option params [Integer] :pageSize The number of results to per page.
|
@@ -37,7 +49,7 @@ module MailUp
|
|
37
49
|
# * TotalElementsCount [Integer]
|
38
50
|
#
|
39
51
|
# @see http://help.mailup.com/display/mailupapi/Console+methods+v1.1#Consolemethodsv1.1-GetRecipientsByGroup
|
40
|
-
#
|
52
|
+
#
|
41
53
|
# @example
|
42
54
|
#
|
43
55
|
# recipients = mailup.console.group(5).recipients
|
@@ -49,7 +61,7 @@ module MailUp
|
|
49
61
|
def recipients(params = {})
|
50
62
|
@api.get("#{@api.path}/Group/#{@id}/Recipients", params: params)
|
51
63
|
end
|
52
|
-
|
64
|
+
|
53
65
|
# Subscribe the recipient with the related id to the specified group.
|
54
66
|
#
|
55
67
|
# @param [Integer] recipient_id The ID of the recipient.
|
@@ -66,7 +78,7 @@ module MailUp
|
|
66
78
|
def subscribe(recipient_id)
|
67
79
|
@api.post("#{@api.path}/Group/#{@id}/Subscribe/#{recipient_id}")
|
68
80
|
end
|
69
|
-
|
81
|
+
|
70
82
|
# Unsubscribe the recipient with the related id from the specified group.
|
71
83
|
#
|
72
84
|
# @param [Integer] recipient_id The ID of the recipient.
|
@@ -83,7 +95,7 @@ module MailUp
|
|
83
95
|
def unsubscribe(recipient_id)
|
84
96
|
@api.delete("#{@api.path}/Group/#{@id}/Unsubscribe/#{recipient_id}")
|
85
97
|
end
|
86
|
-
|
98
|
+
|
87
99
|
# Send email message to all recipient in group.
|
88
100
|
#
|
89
101
|
# @param [Integer] message_id of the message.
|
@@ -4,8 +4,8 @@ module MailUp
|
|
4
4
|
attr_accessor :api
|
5
5
|
|
6
6
|
def initialize(id, api)
|
7
|
-
|
8
|
-
|
7
|
+
@api = api
|
8
|
+
@id = id
|
9
9
|
end
|
10
10
|
|
11
11
|
# Get import status.
|
@@ -20,7 +20,7 @@ module MailUp
|
|
20
20
|
# * NotValidRecipients [Integer]
|
21
21
|
#
|
22
22
|
# @see http://help.mailup.com/display/mailupapi/Console+methods+v1.1#Consolemethodsv1.1-GetImportStatus
|
23
|
-
#
|
23
|
+
#
|
24
24
|
# @example
|
25
25
|
#
|
26
26
|
# status = mailup.console.import(9).status
|
@@ -33,6 +33,14 @@ module MailUp
|
|
33
33
|
@api.get("#{@api.path}/Import/#{@id}")
|
34
34
|
end
|
35
35
|
|
36
|
+
# Get Sending Confirmation Email Id.
|
37
|
+
#
|
38
|
+
# @see http://help.mailup.com/display/mailupapi/Recipients#Recipients-SendConfirmationEmail
|
39
|
+
#
|
40
|
+
def confirmation_email_id
|
41
|
+
@api.get("#{@api.path}/Import/#{@id}/Sending")
|
42
|
+
end
|
43
|
+
|
36
44
|
end
|
37
45
|
end
|
38
46
|
end
|
data/lib/mailup/console/list.rb
CHANGED
@@ -4,8 +4,8 @@ module MailUp
|
|
4
4
|
attr_accessor :api
|
5
5
|
|
6
6
|
def initialize(id, api)
|
7
|
-
|
8
|
-
|
7
|
+
@api = api
|
8
|
+
@id = id
|
9
9
|
end
|
10
10
|
|
11
11
|
# Retrieve groups for the specified list
|
@@ -25,7 +25,7 @@ module MailUp
|
|
25
25
|
# * TotalElementsCount [Integer]
|
26
26
|
#
|
27
27
|
# @see http://help.mailup.com/display/mailupapi/Console+methods+v1.1#Consolemethodsv1.1-GetConsoleGroupsByList
|
28
|
-
#
|
28
|
+
#
|
29
29
|
# @example
|
30
30
|
#
|
31
31
|
# list = mailup.console.list(2)
|
@@ -38,7 +38,7 @@ module MailUp
|
|
38
38
|
def groups(params = {})
|
39
39
|
@api.get("#{@api.path}/List/#{@id}/Groups", params: params)
|
40
40
|
end
|
41
|
-
|
41
|
+
|
42
42
|
# Create a new group for the specified list.
|
43
43
|
#
|
44
44
|
# @param [Hash] group A hash of group attributes.
|
@@ -54,7 +54,7 @@ module MailUp
|
|
54
54
|
# * Deletable [Boolean]
|
55
55
|
#
|
56
56
|
# @see http://help.mailup.com/display/mailupapi/Console+methods+v1.1#Consolemethodsv1.1-CreateGroup
|
57
|
-
#
|
57
|
+
#
|
58
58
|
# @example
|
59
59
|
#
|
60
60
|
# group = {
|
@@ -69,7 +69,7 @@ module MailUp
|
|
69
69
|
def add_group(group)
|
70
70
|
@api.post("#{@api.path}/List/#{@id}/Group", body: group)
|
71
71
|
end
|
72
|
-
|
72
|
+
|
73
73
|
# Update a group for the specified list.
|
74
74
|
#
|
75
75
|
# @param [Hash] group A hash of group attributes.
|
@@ -85,7 +85,7 @@ module MailUp
|
|
85
85
|
# * Deletable [Boolean]
|
86
86
|
#
|
87
87
|
# @see http://help.mailup.com/display/mailupapi/Console+methods+v1.1#Consolemethodsv1.1-UpdateGroup
|
88
|
-
#
|
88
|
+
#
|
89
89
|
# @example
|
90
90
|
#
|
91
91
|
# group = {
|
@@ -100,7 +100,7 @@ module MailUp
|
|
100
100
|
def update_group(group_id, group)
|
101
101
|
@api.put("#{@api.path}/List/#{@id}/Group/#{group_id}", body: group)
|
102
102
|
end
|
103
|
-
|
103
|
+
|
104
104
|
# Delete a group from the specified list.
|
105
105
|
#
|
106
106
|
# @param [Integer] group_id The ID of the group to delete.
|
@@ -136,7 +136,7 @@ module MailUp
|
|
136
136
|
# * TotalElementsCount [Integer]
|
137
137
|
#
|
138
138
|
# @see http://help.mailup.com/display/mailupapi/Console+methods+v1.1#Consolemethodsv1.1-GetConsoleGroupsByRecipient
|
139
|
-
#
|
139
|
+
#
|
140
140
|
# @example
|
141
141
|
#
|
142
142
|
# groups = mailup.console.list(2).recipient_groups(5)
|
@@ -150,7 +150,7 @@ module MailUp
|
|
150
150
|
def recipient_groups(recipient_id, params = {})
|
151
151
|
@api.get("#{@api.path}/List/#{@id}/Recipient/#{recipient_id}/Groups", params: params)
|
152
152
|
end
|
153
|
-
|
153
|
+
|
154
154
|
# Retrieve pending recipients in the specified list.
|
155
155
|
#
|
156
156
|
# @param [Hash] params Optional params or filters:
|
@@ -168,7 +168,7 @@ module MailUp
|
|
168
168
|
# * TotalElementsCount [Integer]
|
169
169
|
#
|
170
170
|
# @see http://help.mailup.com/display/mailupapi/Console+methods+v1.1#Consolemethodsv1.1-GetPendingRecipientsByList
|
171
|
-
#
|
171
|
+
#
|
172
172
|
# @example
|
173
173
|
#
|
174
174
|
# pending = mailup.console.list(2).pending
|
@@ -182,7 +182,7 @@ module MailUp
|
|
182
182
|
def pending(params = {})
|
183
183
|
@api.get("#{@api.path}/List/#{@id}/Recipients/Pending", params: params)
|
184
184
|
end
|
185
|
-
|
185
|
+
|
186
186
|
# Retrieve subscribed recipients in the specified list.
|
187
187
|
#
|
188
188
|
# @param [Hash] params Optional params or filters:
|
@@ -200,7 +200,7 @@ module MailUp
|
|
200
200
|
# * TotalElementsCount [Integer]
|
201
201
|
#
|
202
202
|
# @see http://help.mailup.com/display/mailupapi/Admin+Console+Methods#AdminConsoleMethods-GetSubscribedRecipientsByList
|
203
|
-
#
|
203
|
+
#
|
204
204
|
# @example
|
205
205
|
#
|
206
206
|
# subscribed = mailup.console.list(2).subscribed
|
@@ -214,7 +214,7 @@ module MailUp
|
|
214
214
|
def subscribed(params = {})
|
215
215
|
@api.get("#{@api.path}/List/#{@id}/Recipients/Subscribed", params: params)
|
216
216
|
end
|
217
|
-
|
217
|
+
|
218
218
|
# Retrieve unsubscribed recipients in the specified list.
|
219
219
|
#
|
220
220
|
# @param [Hash] params Optional params or filters:
|
@@ -232,7 +232,7 @@ module MailUp
|
|
232
232
|
# * TotalElementsCount [Integer]
|
233
233
|
#
|
234
234
|
# @see http://help.mailup.com/display/mailupapi/Console+methods+v1.1#Consolemethodsv1.1-GetUnsubscribedRecipientsByList
|
235
|
-
#
|
235
|
+
#
|
236
236
|
# @example
|
237
237
|
#
|
238
238
|
# unsubscribed = mailup.console.list(2).unsusbcribed
|
@@ -246,7 +246,29 @@ module MailUp
|
|
246
246
|
def unsubscribed(params = {})
|
247
247
|
@api.get("#{@api.path}/List/#{@id}/Recipients/Unsubscribed", params: params)
|
248
248
|
end
|
249
|
-
|
249
|
+
|
250
|
+
# Import a single recipient to a list(synchronous import).
|
251
|
+
#
|
252
|
+
# @param [Hash] recipients An array of Recipients.
|
253
|
+
# * idRecipient [Integer] (optional)
|
254
|
+
# * Name [String]
|
255
|
+
# * Email [String]
|
256
|
+
# * MobilePrefix [String]
|
257
|
+
# * MobileNumber [String]
|
258
|
+
# * Fields [Array]
|
259
|
+
#
|
260
|
+
# @param [Hash] params Optional params or filters:
|
261
|
+
# @option params [Boolean] :ConfirmEmail Confirmed opt-in option. Default false.
|
262
|
+
# @option params [String] :importType By setting as 'asOptout' allows you to "import as unsubscribed" a list of specified recipients.
|
263
|
+
#
|
264
|
+
# @return [Integer] The number of imported recipients.
|
265
|
+
#
|
266
|
+
# @see http://help.mailup.com/display/mailupapi/Console+methods+v1.1#Consolemethodsv1.1-AsyncImportRecipientsToList
|
267
|
+
#
|
268
|
+
def import_recipient(recipient, params = {})
|
269
|
+
@api.post("#{@api.path}/List/#{@id}/Recipient", {params: params, body: recipient})
|
270
|
+
end
|
271
|
+
|
250
272
|
# Import multiple recipients to a list.
|
251
273
|
#
|
252
274
|
# @param [Array<Hash>] recipients An array of Recipients.
|
@@ -257,14 +279,18 @@ module MailUp
|
|
257
279
|
# * MobileNumber [String]
|
258
280
|
# * Fields [Array]
|
259
281
|
#
|
282
|
+
# @param [Hash] params Optional params or filters:
|
283
|
+
# @option params [Boolean] :ConfirmEmail Confirmed opt-in option. Default false.
|
284
|
+
# @option params [String] :importType By setting as 'asOptout' allows you to "import as unsubscribed" a list of specified recipients.
|
285
|
+
#
|
260
286
|
# @return [Integer] The number of imported recipients.
|
261
287
|
#
|
262
288
|
# @see http://help.mailup.com/display/mailupapi/Console+methods+v1.1#Consolemethodsv1.1-AsyncImportRecipientsToList
|
263
289
|
#
|
264
|
-
def import_recipients(recipients)
|
265
|
-
@api.post("#{@api.path}/List/#{@id}/Recipients", body: recipients)
|
290
|
+
def import_recipients(recipients, params = {})
|
291
|
+
@api.post("#{@api.path}/List/#{@id}/Recipients", {params: params, body: recipients})
|
266
292
|
end
|
267
|
-
|
293
|
+
|
268
294
|
# Subscribe a recipient from the specified list.
|
269
295
|
#
|
270
296
|
# @param [Integer] recipient_id The ID of the recipient.
|
@@ -281,7 +307,7 @@ module MailUp
|
|
281
307
|
def subscribe(recipient_id)
|
282
308
|
@api.post("#{@api.path}/List/#{@id}/Subscribe/#{recipient_id}")
|
283
309
|
end
|
284
|
-
|
310
|
+
|
285
311
|
# Unsubscribe a recipient in the specified list.
|
286
312
|
#
|
287
313
|
# @param [Integer] recipient_id The ID of the recipient.
|
@@ -298,7 +324,7 @@ module MailUp
|
|
298
324
|
def unsubscribe(recipient_id)
|
299
325
|
@api.delete("#{@api.path}/List/#{@id}/Unsubscribe/#{recipient_id}")
|
300
326
|
end
|
301
|
-
|
327
|
+
|
302
328
|
# Get the enabled tag list for the specified list id.
|
303
329
|
#
|
304
330
|
# @param [Hash] params Optional params or filters:
|
@@ -329,7 +355,7 @@ module MailUp
|
|
329
355
|
@api.get("#{@api.path}/List/#{@id}/Tags", params: params)
|
330
356
|
end
|
331
357
|
alias_method :enabled_tags, :tags
|
332
|
-
|
358
|
+
|
333
359
|
# Add a new tag in the specified list.
|
334
360
|
#
|
335
361
|
# @param [String] name The name of the tag to create.
|
@@ -340,7 +366,7 @@ module MailUp
|
|
340
366
|
# * Enabled [Boolean]
|
341
367
|
#
|
342
368
|
# @see http://help.mailup.com/display/mailupapi/Console+methods+v1.1#Consolemethodsv1.1-CreateTag
|
343
|
-
#
|
369
|
+
#
|
344
370
|
# @example
|
345
371
|
#
|
346
372
|
# new_tag = mailup.console.list(2).add_tag("My New Tag")
|
@@ -348,7 +374,7 @@ module MailUp
|
|
348
374
|
def add_tag(tag)
|
349
375
|
@api.post("#{@api.path}/List/#{@id}/Tag", body: tag)
|
350
376
|
end
|
351
|
-
|
377
|
+
|
352
378
|
# Update a tag in the specified list.
|
353
379
|
#
|
354
380
|
# @param [Hash] tag A hash of tag attributes:
|
@@ -376,7 +402,7 @@ module MailUp
|
|
376
402
|
def update_tag(tag_id, tag)
|
377
403
|
@api.put("#{@api.path}/List/#{@id}/Tag/#{tag_id}", body: tag)
|
378
404
|
end
|
379
|
-
|
405
|
+
|
380
406
|
# Delete a tag from the specified list.
|
381
407
|
#
|
382
408
|
# @param [Integer] idTag The ID of the tag to delete.
|
@@ -393,7 +419,7 @@ module MailUp
|
|
393
419
|
def delete_tag(tag_id)
|
394
420
|
@api.delete("#{@api.path}/List/#{@id}/Tag/#{tag_id}")
|
395
421
|
end
|
396
|
-
|
422
|
+
|
397
423
|
# Get the attachment list for the specific message.
|
398
424
|
#
|
399
425
|
# @param [Integer] message_id The ID of the message.
|
@@ -419,7 +445,7 @@ module MailUp
|
|
419
445
|
def attachments(message_id, params = {})
|
420
446
|
@api.get("#{@api.path}/List/#{@id}/Email/#{message_id}/Attachment", params: params)
|
421
447
|
end
|
422
|
-
|
448
|
+
|
423
449
|
# Add an attachment to the specified message.
|
424
450
|
#
|
425
451
|
# @param [Integer] message_id The ID of the message.
|
@@ -434,7 +460,7 @@ module MailUp
|
|
434
460
|
# * Path [String]
|
435
461
|
#
|
436
462
|
# @see http://help.mailup.com/display/mailupapi/Console+methods+v1.1#Consolemethodsv1.1-AddMessageAttachments
|
437
|
-
#
|
463
|
+
#
|
438
464
|
# @example
|
439
465
|
#
|
440
466
|
# attachment = {
|
@@ -448,7 +474,7 @@ module MailUp
|
|
448
474
|
def add_attachment(message_id, slot, attachment)
|
449
475
|
@api.post("#{@api.path}/List/#{@id}/Email/#{message_id}/Attachment/#{slot}", body: attachment)
|
450
476
|
end
|
451
|
-
|
477
|
+
|
452
478
|
# Delete an attachment from the specified message.
|
453
479
|
#
|
454
480
|
# @param [Integer] message_id The ID of the message.
|
@@ -466,7 +492,7 @@ module MailUp
|
|
466
492
|
def delete_attachment(message_id, slot)
|
467
493
|
@api.delete("#{@api.path}/List/#{@id}/Email/#{message_id}/#{slot}")
|
468
494
|
end
|
469
|
-
|
495
|
+
|
470
496
|
# Get all the images for the specified list.
|
471
497
|
#
|
472
498
|
# @param [Hash] params Optional params or filters:
|
@@ -488,7 +514,7 @@ module MailUp
|
|
488
514
|
def images(params = {})
|
489
515
|
@api.get("#{@api.path}/List/#{@id}/Images", params: params)
|
490
516
|
end
|
491
|
-
|
517
|
+
|
492
518
|
# Add a new image to the specified mailing list.
|
493
519
|
#
|
494
520
|
# @param [Hash] image A hash of Image attributes.
|
@@ -498,7 +524,7 @@ module MailUp
|
|
498
524
|
# @return [String] the created Image URL.
|
499
525
|
#
|
500
526
|
# @see http://help.mailup.com/display/mailupapi/Console+methods+v1.1#Consolemethodsv1.1-AddListImage
|
501
|
-
#
|
527
|
+
#
|
502
528
|
# @example
|
503
529
|
#
|
504
530
|
# image = {
|
@@ -511,7 +537,7 @@ module MailUp
|
|
511
537
|
def add_image(image)
|
512
538
|
@api.post("#{@api.path}/List/#{@id}/Images", body: image)
|
513
539
|
end
|
514
|
-
|
540
|
+
|
515
541
|
# Create an email message in the specified list id from template.
|
516
542
|
#
|
517
543
|
# @param [Integer] template_id The ID of the template.
|
@@ -522,7 +548,7 @@ module MailUp
|
|
522
548
|
# * Subject [String]
|
523
549
|
#
|
524
550
|
# @see http://help.mailup.com/display/mailupapi/Console+methods+v1.1#Consolemethodsv1.1-CreateEmailMessageFromTemplate
|
525
|
-
#
|
551
|
+
#
|
526
552
|
# @example
|
527
553
|
#
|
528
554
|
# new_message = mailup.console.list(2).add_message_from_template(5)
|
@@ -532,7 +558,7 @@ module MailUp
|
|
532
558
|
def add_message_from_template(template_id)
|
533
559
|
@api.post("#{@api.path}/List/#{@id}/Email/Template/#{template_id}")
|
534
560
|
end
|
535
|
-
|
561
|
+
|
536
562
|
# Create an email message in the specified list id.
|
537
563
|
#
|
538
564
|
# @param [Hash] message A hash of Message attributes:
|
@@ -550,7 +576,7 @@ module MailUp
|
|
550
576
|
# * Subject [String]
|
551
577
|
#
|
552
578
|
# @see http://help.mailup.com/display/mailupapi/Console+methods+v1.1#Consolemethodsv1.1-CreateEmailMessage
|
553
|
-
#
|
579
|
+
#
|
554
580
|
# @example
|
555
581
|
#
|
556
582
|
# new_message = mailup.console.list(2).add_message(message)
|
@@ -560,7 +586,7 @@ module MailUp
|
|
560
586
|
def add_message(message)
|
561
587
|
@api.post("#{@api.path}/List/#{@id}/Email", body: message)
|
562
588
|
end
|
563
|
-
|
589
|
+
|
564
590
|
# Modify an email message in the specified list id.
|
565
591
|
#
|
566
592
|
# @param [Integer] message_id The ID of the message.
|
@@ -579,7 +605,7 @@ module MailUp
|
|
579
605
|
# * Subject [String]
|
580
606
|
#
|
581
607
|
# @see http://help.mailup.com/display/mailupapi/Console+methods+v1.1#Consolemethodsv1.1-UpdateEmailMessage
|
582
|
-
#
|
608
|
+
#
|
583
609
|
# @example
|
584
610
|
#
|
585
611
|
# update = mailup.console.list(2).update_message(5, message)
|
@@ -589,7 +615,7 @@ module MailUp
|
|
589
615
|
def update_message(message_id, message)
|
590
616
|
@api.put("#{@api.path}/List/#{@id}/Email/#{message_id}", body: message)
|
591
617
|
end
|
592
|
-
|
618
|
+
|
593
619
|
# Modify the email message online visibility.
|
594
620
|
#
|
595
621
|
# @param [Integer] message_id The ID of the message.
|
@@ -598,7 +624,7 @@ module MailUp
|
|
598
624
|
# @return [Boolean] `true` if successful.
|
599
625
|
#
|
600
626
|
# @see http://help.mailup.com/display/mailupapi/Console+methods+v1.1#Consolemethodsv1.1-UpdateOnlineEmailMessageVisibility
|
601
|
-
#
|
627
|
+
#
|
602
628
|
# @example
|
603
629
|
#
|
604
630
|
# update = mailup.console.list(2).update_message_visibility(5, true)
|
@@ -607,7 +633,7 @@ module MailUp
|
|
607
633
|
def update_message_visibility(message_id, visibility)
|
608
634
|
@api.put("#{@api.path}/List/#{@id}/Email/#{message_id}/Online/Visibility", body: visibility)
|
609
635
|
end
|
610
|
-
|
636
|
+
|
611
637
|
# Delete an email message from the specified list id.
|
612
638
|
#
|
613
639
|
# @param [Integer] message_id The ID of the message.
|
@@ -624,7 +650,7 @@ module MailUp
|
|
624
650
|
def delete_message(message_id)
|
625
651
|
@api.delete("#{@api.path}/List/#{@id}/Email/#{message_id}")
|
626
652
|
end
|
627
|
-
|
653
|
+
|
628
654
|
# Retrieve the email message details by specified id.
|
629
655
|
#
|
630
656
|
# @param [Integer] message_id The ID of the message.
|
@@ -651,7 +677,7 @@ module MailUp
|
|
651
677
|
def message_details(message_id)
|
652
678
|
@api.get("#{@api.path}/List/#{@id}/Email/#{message_id}")
|
653
679
|
end
|
654
|
-
|
680
|
+
|
655
681
|
# Retrieve email messages (cloned and uncloned) for this list.
|
656
682
|
#
|
657
683
|
# @param [Hash] params Optional params or filters:
|
@@ -683,7 +709,7 @@ module MailUp
|
|
683
709
|
def emails(params = {})
|
684
710
|
@api.get("#{@api.path}/List/#{@id}/Emails", params: params)
|
685
711
|
end
|
686
|
-
|
712
|
+
|
687
713
|
# Retrieve the email messages visible online through the website by the specified list id.
|
688
714
|
#
|
689
715
|
# @param [Hash] params Optional params or filters:
|
@@ -748,7 +774,7 @@ module MailUp
|
|
748
774
|
def archived_emails(params = {})
|
749
775
|
@api.get("#{@api.path}/List/#{@id}/Archived/Emails", params: params)
|
750
776
|
end
|
751
|
-
|
777
|
+
|
752
778
|
# Get email message send history.
|
753
779
|
#
|
754
780
|
# @param [Integer] message_id The ID of the message.
|
@@ -777,10 +803,12 @@ module MailUp
|
|
777
803
|
def send_history(message_id, params = {})
|
778
804
|
@api.get("#{@api.path}/List/#{@id}/Email/#{message_id}/SendHistory", params: params)
|
779
805
|
end
|
780
|
-
|
806
|
+
|
781
807
|
# Send an email message to the recipients in the specified list.
|
782
808
|
#
|
783
809
|
# @param [Integer] message_id The ID of the list.
|
810
|
+
# @param [Hash] params Optional params or filters:
|
811
|
+
# @option params [String] :datetime date/time for a deferred sending(should be UTC).
|
784
812
|
#
|
785
813
|
# @return [JSON] A Send object with the following attributes:
|
786
814
|
# * idMessage [Integer]
|
@@ -796,10 +824,10 @@ module MailUp
|
|
796
824
|
# send['Sent']
|
797
825
|
# => 1794
|
798
826
|
#
|
799
|
-
def send_message(message_id)
|
800
|
-
@api.post("#{@api.path}/List/#{@id}/Email/#{message_id}/Send")
|
827
|
+
def send_message(message_id, params = {})
|
828
|
+
@api.post("#{@api.path}/List/#{@id}/Email/#{message_id}/Send", params: params)
|
801
829
|
end
|
802
|
-
|
830
|
+
|
803
831
|
# Retrieve the list of the current defined message templates in the specified list.
|
804
832
|
#
|
805
833
|
# @param [Hash] params Optional params or filters:
|
@@ -829,7 +857,7 @@ module MailUp
|
|
829
857
|
def templates(params = {})
|
830
858
|
@api.get("#{@api.path}/List/#{@id}/Templates", params: params)
|
831
859
|
end
|
832
|
-
|
860
|
+
|
833
861
|
# Retrieve the details for the specified message template in the specified list.
|
834
862
|
#
|
835
863
|
# @param [Integer] template_id The ID of the template.
|
@@ -857,7 +885,7 @@ module MailUp
|
|
857
885
|
def template_details(template_id)
|
858
886
|
@api.get("#{@api.path}/List/#{@id}/Templates/#{template_id}")
|
859
887
|
end
|
860
|
-
|
888
|
+
|
861
889
|
end
|
862
890
|
end
|
863
891
|
end
|
@@ -29,11 +29,12 @@ module MailUp
|
|
29
29
|
# @example
|
30
30
|
#
|
31
31
|
# recipient = {
|
32
|
-
# :
|
33
|
-
# :
|
32
|
+
# idRecipient: "1234"
|
33
|
+
# Name: "Joe Public",
|
34
|
+
# Email: "joe@public.com"
|
34
35
|
# }
|
35
36
|
# updated_recipient = mailup.console.recipient.update(recipient)
|
36
|
-
# updated_recipient
|
37
|
+
# updated_recipient['Name']
|
37
38
|
# => "Joe Public"
|
38
39
|
#
|
39
40
|
def update(recipient)
|
@@ -60,8 +61,8 @@ module MailUp
|
|
60
61
|
# fields['Items'].first['Description']
|
61
62
|
# => "Field description..."
|
62
63
|
#
|
63
|
-
def fields
|
64
|
-
@api.get("#{@api.path}/Recipient/DynamicFields")
|
64
|
+
def fields(params = {})
|
65
|
+
@api.get("#{@api.path}/Recipient/DynamicFields", params: params)
|
65
66
|
end
|
66
67
|
|
67
68
|
end
|
@@ -38,8 +38,8 @@ module MailUp
|
|
38
38
|
# trial['id']
|
39
39
|
# => 1329874
|
40
40
|
#
|
41
|
-
def
|
42
|
-
@api.
|
41
|
+
def activate_trial(account = {})
|
42
|
+
@api.provisioning_request("#{@api.path}/Console/TrialActivation", account)
|
43
43
|
end
|
44
44
|
|
45
45
|
# Retrieve the information about current trial activation status.
|
@@ -67,7 +67,7 @@ module MailUp
|
|
67
67
|
# => "Status description..."
|
68
68
|
#
|
69
69
|
def status(account = {})
|
70
|
-
@api.
|
70
|
+
@api.provisioning_request("#{@api.path}/Console/TrialActivationStatus", account)
|
71
71
|
end
|
72
72
|
|
73
73
|
end
|
data/lib/mailup/version.rb
CHANGED
data/mailup.gemspec
CHANGED
@@ -7,19 +7,21 @@ Gem::Specification.new do |gem|
|
|
7
7
|
gem.name = "mailup"
|
8
8
|
gem.version = MailUp::VERSION
|
9
9
|
gem.platform = Gem::Platform::RUBY
|
10
|
-
gem.authors = ["Brian Getting"]
|
10
|
+
gem.authors = ["Brian Getting", "Rocco Galluzzo"]
|
11
11
|
gem.email = ["brian@tatem.ae"]
|
12
12
|
gem.homepage = "https://github.com/mailup/mailup-ruby"
|
13
13
|
gem.summary = "Ruby wrapper for the MailUp REST API"
|
14
14
|
gem.description = "A Ruby gem for interacting with the MailUp REST API."
|
15
|
-
|
15
|
+
gem.licenses = ['MIT']
|
16
|
+
|
16
17
|
gem.files = `git ls-files`.split($/)
|
17
18
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
18
19
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
20
|
gem.require_paths = ["lib"]
|
20
|
-
|
21
|
-
gem.
|
22
|
-
|
21
|
+
|
22
|
+
gem.add_runtime_dependency 'oauth2', '~> 0.9', '>= 0.9.2'
|
23
|
+
|
23
24
|
gem.add_development_dependency "rspec"
|
24
25
|
gem.add_development_dependency "rake"
|
26
|
+
gem.add_development_dependency "coveralls"
|
25
27
|
end
|
@@ -16,7 +16,7 @@ describe MailUp::Console do
|
|
16
16
|
context resource do
|
17
17
|
it "should return a #{resource} object" do
|
18
18
|
test = @mailup.console.send(resource.to_sym)
|
19
|
-
test.should be_an_instance_of(Object.const_get
|
19
|
+
test.should be_an_instance_of(Object.const_get("MailUp").const_get("Console").const_get("#{resource.capitalize}"))
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -25,7 +25,7 @@ describe MailUp::Console do
|
|
25
25
|
context resource do
|
26
26
|
it "should return a #{resource} object" do
|
27
27
|
test = @mailup.console.send(resource.to_sym, 1)
|
28
|
-
test.should be_an_instance_of(Object.const_get
|
28
|
+
test.should be_an_instance_of(Object.const_get("MailUp").const_get("Console").const_get("#{resource.capitalize}"))
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
@@ -11,10 +11,16 @@ describe MailUp::Console::Group do
|
|
11
11
|
|
12
12
|
it "should fire the correct POST request for add_recipients" do
|
13
13
|
payload = Date._jisx0301("empty hash, please")
|
14
|
-
@mailup.console.group(1).api.should_receive(:post).with("#{@mailup.console.group(1).api.path}/Group/1/Recipients", {body: payload})
|
14
|
+
@mailup.console.group(1).api.should_receive(:post).with("#{@mailup.console.group(1).api.path}/Group/1/Recipients", {body: payload, params: {}})
|
15
15
|
@mailup.console.group(1).add_recipients(payload)
|
16
16
|
end
|
17
17
|
|
18
|
+
it "should fire the correct POST request for add_recipient" do
|
19
|
+
payload = Date._jisx0301("empty hash, please")
|
20
|
+
@mailup.console.group(1).api.should_receive(:post).with("#{@mailup.console.group(1).api.path}/Group/1/Recipient", {body: payload, params: {}})
|
21
|
+
@mailup.console.group(1).add_recipient(payload)
|
22
|
+
end
|
23
|
+
|
18
24
|
it "should fire the correct GET request for recipients" do
|
19
25
|
payload = Date._jisx0301("empty hash, please")
|
20
26
|
@mailup.console.group(1).api.should_receive(:get).with("#{@mailup.console.group(1).api.path}/Group/1/Recipients", {params: {}})
|
@@ -38,5 +44,5 @@ describe MailUp::Console::Group do
|
|
38
44
|
@mailup.console.group(1).api.should_receive(:post).with("#{@mailup.console.group(1).api.path}/Group/1/Email/#{id}/Send")
|
39
45
|
@mailup.console.group(1).send_message(id)
|
40
46
|
end
|
41
|
-
|
47
|
+
|
42
48
|
end
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe MailUp::Console::Import do
|
4
4
|
before(:each) { init_mailup }
|
5
5
|
|
6
|
-
%w(status).each do |method|
|
6
|
+
%w(status confirmation_email_id).each do |method|
|
7
7
|
it "should have a #{method} method" do
|
8
8
|
@mailup.console.import(1).should respond_to(method.to_sym)
|
9
9
|
end
|
@@ -14,4 +14,10 @@ describe MailUp::Console::Import do
|
|
14
14
|
@mailup.console.import(id).api.should_receive(:get).with("#{@mailup.console.import(id).api.path}/Import/#{id}")
|
15
15
|
@mailup.console.import(id).status
|
16
16
|
end
|
17
|
+
|
18
|
+
it "should fire the correct GET request for confirmation_email_id" do
|
19
|
+
id = rand(100).abs
|
20
|
+
@mailup.console.import(id).api.should_receive(:get).with("#{@mailup.console.import(id).api.path}/Import/#{id}/Sending")
|
21
|
+
@mailup.console.import(id).confirmation_email_id
|
22
|
+
end
|
17
23
|
end
|
@@ -59,7 +59,7 @@ describe MailUp::Console::List do
|
|
59
59
|
|
60
60
|
# POST requests
|
61
61
|
|
62
|
-
%w(add_group
|
62
|
+
%w(add_group).each do |method|
|
63
63
|
it "should fire the correct POST request for #{method}" do
|
64
64
|
payload = Date._jisx0301("empty hash, please")
|
65
65
|
@mailup.console.list(1).api.should_receive(:post).with("#{@mailup.console.list(1).api.path}/List/1/#{method.split('_').last.capitalize}", {body: payload})
|
@@ -67,6 +67,25 @@ describe MailUp::Console::List do
|
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
+
it "should fire the correct POST request for import_recipients" do
|
71
|
+
payload = Date._jisx0301("empty hash, please")
|
72
|
+
@mailup.console.list(1).api.should_receive(:post).with("#{@mailup.console.list(1).api.path}/List/1/Recipients", {body: payload, params: {}})
|
73
|
+
@mailup.console.list(1).send(:import_recipients, payload)
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should fire the correct POST request for import_recipient" do
|
77
|
+
payload = Date._jisx0301("empty hash, please")
|
78
|
+
@mailup.console.list(1).api.should_receive(:post).with("#{@mailup.console.list(1).api.path}/List/1/Recipient", {body: payload, params: {}})
|
79
|
+
@mailup.console.list(1).send(:import_recipient, payload)
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should fire the correct POST request for import_recipients and email optin" do
|
83
|
+
payload = Date._jisx0301("empty hash, please")
|
84
|
+
@mailup.console.list(1).api.should_receive(:post).with("#{@mailup.console.list(1).api.path}/List/1/Recipients",
|
85
|
+
{body: payload, params: {ConfirmEmail: true}})
|
86
|
+
@mailup.console.list(1).send(:import_recipients, payload, {ConfirmEmail: true})
|
87
|
+
end
|
88
|
+
|
70
89
|
it "should fire the correct POST request for subscribe" do
|
71
90
|
payload = rand(100).abs
|
72
91
|
@mailup.console.list(1).api.should_receive(:post).with("#{@mailup.console.list(1).api.path}/List/1/Subscribe/#{payload}")
|
@@ -106,7 +125,7 @@ describe MailUp::Console::List do
|
|
106
125
|
|
107
126
|
it "should fire the correct POST request for send_message" do
|
108
127
|
payload = rand(100).abs
|
109
|
-
@mailup.console.list(1).api.should_receive(:post).with("#{@mailup.console.list(1).api.path}/List/1/Email/#{payload}/Send")
|
128
|
+
@mailup.console.list(1).api.should_receive(:post).with("#{@mailup.console.list(1).api.path}/List/1/Email/#{payload}/Send", {params: {}})
|
110
129
|
@mailup.console.list(1).send_message(payload)
|
111
130
|
end
|
112
131
|
|
@@ -15,7 +15,7 @@ describe MailUp::Public do
|
|
15
15
|
context resource do
|
16
16
|
it "should return a #{resource} object" do
|
17
17
|
test = @mailup.public.send(resource.to_sym)
|
18
|
-
test.should be_an_instance_of(Object.const_get
|
18
|
+
test.should be_an_instance_of(Object.const_get("MailUp").const_get("Public").const_get("#{resource.capitalize}"))
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -3,21 +3,21 @@ require 'spec_helper'
|
|
3
3
|
describe MailUp::Public::Console do
|
4
4
|
before(:each) { init_mailup }
|
5
5
|
|
6
|
-
%w(
|
6
|
+
%w(activate_trial status).each do |method|
|
7
7
|
it "should have a #{method} method" do
|
8
8
|
@mailup.public.console.should respond_to(method.to_sym)
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
it "should fire the correct POST request for
|
12
|
+
it "should fire the correct POST request for activate_trial" do
|
13
13
|
payload = Date._jisx0301("empty hash, please")
|
14
|
-
@mailup.public.console.api.should_receive(:
|
15
|
-
@mailup.public.console.
|
14
|
+
@mailup.public.console.api.should_receive(:provisioning_request).with("#{@mailup.public.console.api.path}/Console/TrialActivation", payload)
|
15
|
+
@mailup.public.console.activate_trial(payload)
|
16
16
|
end
|
17
17
|
|
18
18
|
it "should fire the correct POST request for status" do
|
19
19
|
payload = Date._jisx0301("empty hash, please")
|
20
|
-
@mailup.public.console.api.should_receive(:
|
20
|
+
@mailup.public.console.api.should_receive(:provisioning_request).with("#{@mailup.public.console.api.path}/Console/TrialActivationStatus", payload)
|
21
21
|
@mailup.public.console.status(payload)
|
22
22
|
end
|
23
23
|
|
@@ -15,7 +15,7 @@ describe MailUp::Stats do
|
|
15
15
|
context resource do
|
16
16
|
it "should return a #{resource} object" do
|
17
17
|
test = @mailup.stats.send(resource.to_sym, 1)
|
18
|
-
test.should be_an_instance_of(Object.const_get
|
18
|
+
test.should be_an_instance_of(Object.const_get("MailUp").const_get("Stats").const_get("#{resource.capitalize}"))
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'bundler/setup'
|
3
3
|
require 'mailup'
|
4
|
+
require 'coveralls'
|
5
|
+
Coveralls.wear!
|
4
6
|
|
5
7
|
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
6
8
|
RSpec.configure do |config|
|
@@ -16,6 +18,13 @@ RSpec.configure do |config|
|
|
16
18
|
|
17
19
|
# Global hooks
|
18
20
|
config.before(:each) { init_credentials}
|
21
|
+
|
22
|
+
config.mock_with :rspec do |c|
|
23
|
+
c.syntax = [:should, :expect]
|
24
|
+
end
|
25
|
+
config.expect_with :rspec do |c|
|
26
|
+
c.syntax = [:should, :expect]
|
27
|
+
end
|
19
28
|
end
|
20
29
|
|
21
30
|
# Create Credentials Hash
|
metadata
CHANGED
@@ -1,55 +1,76 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mailup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Getting
|
8
|
+
- Rocco Galluzzo
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2015-03-27 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: oauth2
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
16
17
|
requirements:
|
17
|
-
- -
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0.9'
|
21
|
+
- - ">="
|
18
22
|
- !ruby/object:Gem::Version
|
19
23
|
version: 0.9.2
|
20
24
|
type: :runtime
|
21
25
|
prerelease: false
|
22
26
|
version_requirements: !ruby/object:Gem::Requirement
|
23
27
|
requirements:
|
24
|
-
- -
|
28
|
+
- - "~>"
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '0.9'
|
31
|
+
- - ">="
|
25
32
|
- !ruby/object:Gem::Version
|
26
33
|
version: 0.9.2
|
27
34
|
- !ruby/object:Gem::Dependency
|
28
35
|
name: rspec
|
29
36
|
requirement: !ruby/object:Gem::Requirement
|
30
37
|
requirements:
|
31
|
-
- -
|
38
|
+
- - ">="
|
32
39
|
- !ruby/object:Gem::Version
|
33
40
|
version: '0'
|
34
41
|
type: :development
|
35
42
|
prerelease: false
|
36
43
|
version_requirements: !ruby/object:Gem::Requirement
|
37
44
|
requirements:
|
38
|
-
- -
|
45
|
+
- - ">="
|
39
46
|
- !ruby/object:Gem::Version
|
40
47
|
version: '0'
|
41
48
|
- !ruby/object:Gem::Dependency
|
42
49
|
name: rake
|
43
50
|
requirement: !ruby/object:Gem::Requirement
|
44
51
|
requirements:
|
45
|
-
- -
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: coveralls
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
46
67
|
- !ruby/object:Gem::Version
|
47
68
|
version: '0'
|
48
69
|
type: :development
|
49
70
|
prerelease: false
|
50
71
|
version_requirements: !ruby/object:Gem::Requirement
|
51
72
|
requirements:
|
52
|
-
- -
|
73
|
+
- - ">="
|
53
74
|
- !ruby/object:Gem::Version
|
54
75
|
version: '0'
|
55
76
|
description: A Ruby gem for interacting with the MailUp REST API.
|
@@ -59,9 +80,10 @@ executables: []
|
|
59
80
|
extensions: []
|
60
81
|
extra_rdoc_files: []
|
61
82
|
files:
|
62
|
-
- .gitignore
|
83
|
+
- ".gitignore"
|
84
|
+
- ".travis.yml"
|
63
85
|
- Gemfile
|
64
|
-
- LICENSE
|
86
|
+
- LICENSE
|
65
87
|
- README.md
|
66
88
|
- Rakefile
|
67
89
|
- lib/mailup.rb
|
@@ -98,7 +120,8 @@ files:
|
|
98
120
|
- spec/mailup/stats/recipient_spec.rb
|
99
121
|
- spec/spec_helper.rb
|
100
122
|
homepage: https://github.com/mailup/mailup-ruby
|
101
|
-
licenses:
|
123
|
+
licenses:
|
124
|
+
- MIT
|
102
125
|
metadata: {}
|
103
126
|
post_install_message:
|
104
127
|
rdoc_options: []
|
@@ -106,17 +129,17 @@ require_paths:
|
|
106
129
|
- lib
|
107
130
|
required_ruby_version: !ruby/object:Gem::Requirement
|
108
131
|
requirements:
|
109
|
-
- -
|
132
|
+
- - ">="
|
110
133
|
- !ruby/object:Gem::Version
|
111
134
|
version: '0'
|
112
135
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
136
|
requirements:
|
114
|
-
- -
|
137
|
+
- - ">="
|
115
138
|
- !ruby/object:Gem::Version
|
116
139
|
version: '0'
|
117
140
|
requirements: []
|
118
141
|
rubyforge_project:
|
119
|
-
rubygems_version: 2.
|
142
|
+
rubygems_version: 2.2.2
|
120
143
|
signing_key:
|
121
144
|
specification_version: 4
|
122
145
|
summary: Ruby wrapper for the MailUp REST API
|
@@ -136,3 +159,4 @@ test_files:
|
|
136
159
|
- spec/mailup/stats/message_spec.rb
|
137
160
|
- spec/mailup/stats/recipient_spec.rb
|
138
161
|
- spec/spec_helper.rb
|
162
|
+
has_rdoc:
|
data/LICENSE.txt
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2013 Brian Getting
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|