mailup 1.1.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 +7 -0
- data/.gitignore +22 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +79 -0
- data/Rakefile +7 -0
- data/lib/mailup.rb +206 -0
- data/lib/mailup/console/base.rb +115 -0
- data/lib/mailup/console/email.rb +35 -0
- data/lib/mailup/console/group.rb +111 -0
- data/lib/mailup/console/images.rb +69 -0
- data/lib/mailup/console/import.rb +38 -0
- data/lib/mailup/console/list.rb +863 -0
- data/lib/mailup/console/recipient.rb +69 -0
- data/lib/mailup/console/user.rb +77 -0
- data/lib/mailup/errors.rb +18 -0
- data/lib/mailup/public/base.rb +18 -0
- data/lib/mailup/public/console.rb +75 -0
- data/lib/mailup/stats/base.rb +41 -0
- data/lib/mailup/stats/message.rb +284 -0
- data/lib/mailup/stats/recipient.rb +303 -0
- data/lib/mailup/version.rb +4 -0
- data/mailup.gemspec +25 -0
- data/rails/init.rb +1 -0
- data/spec/mailup/console/base_spec.rb +33 -0
- data/spec/mailup/console/email_spec.rb +19 -0
- data/spec/mailup/console/group_spec.rb +42 -0
- data/spec/mailup/console/images_spec.rb +29 -0
- data/spec/mailup/console/import_spec.rb +17 -0
- data/spec/mailup/console/list_spec.rb +164 -0
- data/spec/mailup/console/recipient_spec.rb +11 -0
- data/spec/mailup/console/user_spec.rb +16 -0
- data/spec/mailup/mailup_spec.rb +36 -0
- data/spec/mailup/public/base_spec.rb +22 -0
- data/spec/mailup/public/console_spec.rb +24 -0
- data/spec/mailup/stats/base_spec.rb +22 -0
- data/spec/mailup/stats/message_spec.rb +35 -0
- data/spec/mailup/stats/recipient_spec.rb +40 -0
- data/spec/spec_helper.rb +37 -0
- metadata +138 -0
@@ -0,0 +1,303 @@
|
|
1
|
+
module MailUp
|
2
|
+
module Stats
|
3
|
+
class Recipient
|
4
|
+
attr_accessor :api
|
5
|
+
|
6
|
+
def initialize(id, api)
|
7
|
+
@api = api
|
8
|
+
@id = id
|
9
|
+
end
|
10
|
+
|
11
|
+
# Paged list of messages received by the specified recipient.
|
12
|
+
#
|
13
|
+
# @param [Hash] params Optional params or filters:
|
14
|
+
# @option params [Integer] :pageNumber The page number to return.
|
15
|
+
# @option params [Integer] :pageSize The number of results to per page.
|
16
|
+
# @option params [String] :filterby A filtering expression.
|
17
|
+
# @option params [String] :orderby The sorting condition for the results.
|
18
|
+
#
|
19
|
+
# @return [JSON] Results and data including:
|
20
|
+
# * IsPaginated [Boolean]
|
21
|
+
# * Items [Array<Hash>]
|
22
|
+
# * PageNumber [Integer]
|
23
|
+
# * PageSize [Integer]
|
24
|
+
# * Skipped [Integer]
|
25
|
+
# * TotalElementsCount [Integer]
|
26
|
+
#
|
27
|
+
# @see http://help.mailup.com/display/mailupapi/Email+statistics+methods+v1.1#Emailstatisticsmethodsv1.1-ListRecipientMessageDeliveries
|
28
|
+
#
|
29
|
+
# @example
|
30
|
+
#
|
31
|
+
# deliveries = mailup.console.recipient(154).deliveries
|
32
|
+
# deliveries['TotalElementsCount']
|
33
|
+
# => 10
|
34
|
+
# deliveries['Items'].first['Subject']
|
35
|
+
# => "Message Subject"
|
36
|
+
#
|
37
|
+
def deliveries(params = {})
|
38
|
+
@api.get("#{@api.path}/Recipient/#{@id}/List/Deliveries", params: params)
|
39
|
+
end
|
40
|
+
|
41
|
+
# Count of messages received by the specified recipient.
|
42
|
+
#
|
43
|
+
#
|
44
|
+
# @return [Integer] Count of deliveries.
|
45
|
+
#
|
46
|
+
# @see http://help.mailup.com/display/mailupapi/Email+statistics+methods+v1.1#Emailstatisticsmethodsv1.1-CountRecipientMessageDeliveries
|
47
|
+
#
|
48
|
+
# @example
|
49
|
+
#
|
50
|
+
# deliveries = mailup.console.recipient(154).deliveries_count
|
51
|
+
# => 324
|
52
|
+
#
|
53
|
+
def deliveries_count
|
54
|
+
@api.get("#{@api.path}/Recipient/#{@id}/Count/Deliveries")
|
55
|
+
end
|
56
|
+
|
57
|
+
# Paged list of messages viewed by the specified recipient.
|
58
|
+
#
|
59
|
+
# @param [Hash] params Optional params or filters:
|
60
|
+
# @option params [Integer] :pageNumber The page number to return.
|
61
|
+
# @option params [Integer] :pageSize The number of results to per page.
|
62
|
+
# @option params [String] :filterby A filtering expression.
|
63
|
+
# @option params [String] :orderby The sorting condition for the results.
|
64
|
+
#
|
65
|
+
# @return [JSON] Results and data including:
|
66
|
+
# * IsPaginated [Boolean]
|
67
|
+
# * Items [Array<Hash>]
|
68
|
+
# * PageNumber [Integer]
|
69
|
+
# * PageSize [Integer]
|
70
|
+
# * Skipped [Integer]
|
71
|
+
# * TotalElementsCount [Integer]
|
72
|
+
#
|
73
|
+
# @see http://help.mailup.com/display/mailupapi/Email+statistics+methods+v1.1#Emailstatisticsmethodsv1.1-ListRecipientMessageViews
|
74
|
+
#
|
75
|
+
# @example
|
76
|
+
#
|
77
|
+
# views = mailup.console.recipient(154).views
|
78
|
+
# views['TotalElementsCount']
|
79
|
+
# => 10
|
80
|
+
# views['Items'].first['Subject']
|
81
|
+
# => "Message Subject"
|
82
|
+
#
|
83
|
+
def views(params = {})
|
84
|
+
@api.get("#{@api.path}/Recipient/#{@id}/List/Views", params: params)
|
85
|
+
end
|
86
|
+
|
87
|
+
# Count of messages viewed by the specified recipient.
|
88
|
+
#
|
89
|
+
#
|
90
|
+
# @return [Integer] Count of views.
|
91
|
+
#
|
92
|
+
# @see http://help.mailup.com/display/mailupapi/Email+statistics+methods+v1.1#Emailstatisticsmethodsv1.1-CountRecipientMessageViews
|
93
|
+
#
|
94
|
+
# @example
|
95
|
+
#
|
96
|
+
# views = mailup.console.recipient(154).views_count
|
97
|
+
# => 324
|
98
|
+
#
|
99
|
+
def views_count
|
100
|
+
@api.get("#{@api.path}/Recipient/#{@id}/Count/Views")
|
101
|
+
end
|
102
|
+
|
103
|
+
# Paged list of bounces with details returned by the specified recipient.
|
104
|
+
#
|
105
|
+
# @param [Hash] params Optional params or filters:
|
106
|
+
# @option params [Integer] :pageNumber The page number to return.
|
107
|
+
# @option params [Integer] :pageSize The number of results to per page.
|
108
|
+
# @option params [String] :filterby A filtering expression.
|
109
|
+
# @option params [String] :orderby The sorting condition for the results.
|
110
|
+
#
|
111
|
+
# @return [JSON] Results and data including:
|
112
|
+
# * IsPaginated [Boolean]
|
113
|
+
# * Items [Array<Hash>]
|
114
|
+
# * PageNumber [Integer]
|
115
|
+
# * PageSize [Integer]
|
116
|
+
# * Skipped [Integer]
|
117
|
+
# * TotalElementsCount [Integer]
|
118
|
+
#
|
119
|
+
# @see http://help.mailup.com/display/mailupapi/Email+statistics+methods+v1.1#Emailstatisticsmethodsv1.1-ListRecipientMessageBouncesDetails
|
120
|
+
#
|
121
|
+
# @example
|
122
|
+
#
|
123
|
+
# bounces = mailup.console.recipient(154).bounces_details
|
124
|
+
# bounces['TotalElementsCount']
|
125
|
+
# => 10
|
126
|
+
# bounces['Items'].first['Subject']
|
127
|
+
# => "Message Subject"
|
128
|
+
#
|
129
|
+
def bounces_details(params = {})
|
130
|
+
@api.get("#{@api.path}/Recipient/#{@id}/List/BouncesDetails", params: params)
|
131
|
+
end
|
132
|
+
|
133
|
+
# Paged list of bounces returned by the specified recipient.
|
134
|
+
#
|
135
|
+
# @param [Hash] params Optional params or filters:
|
136
|
+
# @option params [Integer] :pageNumber The page number to return.
|
137
|
+
# @option params [Integer] :pageSize The number of results to per page.
|
138
|
+
# @option params [String] :filterby A filtering expression.
|
139
|
+
# @option params [String] :orderby The sorting condition for the results.
|
140
|
+
#
|
141
|
+
# @return [JSON] Results and data including:
|
142
|
+
# * IsPaginated [Boolean]
|
143
|
+
# * Items [Array<Hash>]
|
144
|
+
# * PageNumber [Integer]
|
145
|
+
# * PageSize [Integer]
|
146
|
+
# * Skipped [Integer]
|
147
|
+
# * TotalElementsCount [Integer]
|
148
|
+
#
|
149
|
+
# @see http://help.mailup.com/display/mailupapi/Email+statistics+methods+v1.1#Emailstatisticsmethodsv1.1-ListRecipientMessageBounces
|
150
|
+
#
|
151
|
+
# @example
|
152
|
+
#
|
153
|
+
# bounces = mailup.console.recipient(154).bounces
|
154
|
+
# bounces['TotalElementsCount']
|
155
|
+
# => 10
|
156
|
+
# bounces['Items'].first['Subject']
|
157
|
+
# => "Message Subject"
|
158
|
+
#
|
159
|
+
def bounces(params = {})
|
160
|
+
@api.get("#{@api.path}/Recipient/#{@id}/List/Bounces", params: params)
|
161
|
+
end
|
162
|
+
|
163
|
+
# Count of bounces returned by the specified recipient.
|
164
|
+
#
|
165
|
+
#
|
166
|
+
# @return [Integer] Count of bounces.
|
167
|
+
#
|
168
|
+
# @see http://help.mailup.com/display/mailupapi/Email+statistics+methods+v1.1#Emailstatisticsmethodsv1.1-CountRecipientMessageBounces
|
169
|
+
#
|
170
|
+
# @example
|
171
|
+
#
|
172
|
+
# views = mailup.console.recipient(154).bounces_count
|
173
|
+
# => 324
|
174
|
+
#
|
175
|
+
def bounces_count
|
176
|
+
@api.get("#{@api.path}/Recipient/#{@id}/Count/Bounces")
|
177
|
+
end
|
178
|
+
|
179
|
+
# Paged list of unsubscriptions done by the specified recipient.
|
180
|
+
#
|
181
|
+
# @param [Hash] params Optional params or filters:
|
182
|
+
# @option params [Integer] :pageNumber The page number to return.
|
183
|
+
# @option params [Integer] :pageSize The number of results to per page.
|
184
|
+
# @option params [String] :filterby A filtering expression.
|
185
|
+
# @option params [String] :orderby The sorting condition for the results.
|
186
|
+
#
|
187
|
+
# @return [JSON] Results and data including:
|
188
|
+
# * IsPaginated [Boolean]
|
189
|
+
# * Items [Array<Hash>]
|
190
|
+
# * PageNumber [Integer]
|
191
|
+
# * PageSize [Integer]
|
192
|
+
# * Skipped [Integer]
|
193
|
+
# * TotalElementsCount [Integer]
|
194
|
+
#
|
195
|
+
# @see http://help.mailup.com/display/mailupapi/Email+statistics+methods+v1.1#Emailstatisticsmethodsv1.1-ListRecipientUnsubscriptions
|
196
|
+
#
|
197
|
+
# @example
|
198
|
+
#
|
199
|
+
# unsubscribes = mailup.console.recipient(154).unsubscribes
|
200
|
+
# unsubscribes['TotalElementsCount']
|
201
|
+
# => 10
|
202
|
+
# unsubscribes['Items'].first['Subject']
|
203
|
+
# => "Message Subject"
|
204
|
+
#
|
205
|
+
def unsubscribes(params = {})
|
206
|
+
@api.get("#{@api.path}/Recipient/#{@id}/List/Unsubscriptions", params: params)
|
207
|
+
end
|
208
|
+
|
209
|
+
# Count of unsubscriptions done by the specified recipient.
|
210
|
+
#
|
211
|
+
#
|
212
|
+
# @return [Integer] Count of unsubscribes.
|
213
|
+
#
|
214
|
+
# @see http://help.mailup.com/display/mailupapi/Email+statistics+methods+v1.1#Emailstatisticsmethodsv1.1-CountRecipientUnsubscriptions
|
215
|
+
#
|
216
|
+
# @example
|
217
|
+
#
|
218
|
+
# unsubscribes = mailup.console.recipient(154).unsubscribes_count
|
219
|
+
# => 324
|
220
|
+
#
|
221
|
+
def unsubscribes_count
|
222
|
+
@api.get("#{@api.path}/Recipient/#{@id}/Count/Unsubscriptions")
|
223
|
+
end
|
224
|
+
|
225
|
+
# Verbose paged list of message clicks on a link done by the specified recipient.
|
226
|
+
#
|
227
|
+
# @param [Hash] params Optional params or filters:
|
228
|
+
# @option params [Integer] :pageNumber The page number to return.
|
229
|
+
# @option params [Integer] :pageSize The number of results to per page.
|
230
|
+
# @option params [String] :filterby A filtering expression.
|
231
|
+
# @option params [String] :orderby The sorting condition for the results.
|
232
|
+
#
|
233
|
+
# @return [JSON] Results and data including:
|
234
|
+
# * IsPaginated [Boolean]
|
235
|
+
# * Items [Array<Hash>]
|
236
|
+
# * PageNumber [Integer]
|
237
|
+
# * PageSize [Integer]
|
238
|
+
# * Skipped [Integer]
|
239
|
+
# * TotalElementsCount [Integer]
|
240
|
+
#
|
241
|
+
# @see http://help.mailup.com/display/mailupapi/Email+statistics+methods#Emailstatisticsmethods-ListRecipientClickDetailsByDate
|
242
|
+
#
|
243
|
+
# @example
|
244
|
+
#
|
245
|
+
# clicks = mailup.console.recipient(154).clicks_details
|
246
|
+
# clicks['TotalElementsCount']
|
247
|
+
# => 10
|
248
|
+
# clicks['Items'].first['Subject']
|
249
|
+
# => "Message Subject"
|
250
|
+
#
|
251
|
+
def clicks_details(params = {})
|
252
|
+
@api.get("#{@api.path}/Recipient/#{@id}/List/ClicksDetails", params: params)
|
253
|
+
end
|
254
|
+
|
255
|
+
# Paged list of message clicks on a link done by the specified recipient.
|
256
|
+
#
|
257
|
+
# @param [Hash] params Optional params or filters:
|
258
|
+
# @option params [Integer] :pageNumber The page number to return.
|
259
|
+
# @option params [Integer] :pageSize The number of results to per page.
|
260
|
+
# @option params [String] :filterby A filtering expression.
|
261
|
+
# @option params [String] :orderby The sorting condition for the results.
|
262
|
+
#
|
263
|
+
# @return [JSON] Results and data including:
|
264
|
+
# * IsPaginated [Boolean]
|
265
|
+
# * Items [Array<Hash>]
|
266
|
+
# * PageNumber [Integer]
|
267
|
+
# * PageSize [Integer]
|
268
|
+
# * Skipped [Integer]
|
269
|
+
# * TotalElementsCount [Integer]
|
270
|
+
#
|
271
|
+
# @see http://help.mailup.com/display/mailupapi/Email+statistics+methods+v1.1#Emailstatisticsmethodsv1.1-ListRecipientMessageClicks
|
272
|
+
#
|
273
|
+
# @example
|
274
|
+
#
|
275
|
+
# clicks = mailup.console.recipient(154).clicks
|
276
|
+
# clicks['TotalElementsCount']
|
277
|
+
# => 10
|
278
|
+
# clicks['Items'].first['Subject']
|
279
|
+
# => "Message Subject"
|
280
|
+
#
|
281
|
+
def clicks(params = {})
|
282
|
+
@api.get("#{@api.path}/Recipient/#{@id}/List/Clicks", params: params)
|
283
|
+
end
|
284
|
+
|
285
|
+
# Count of clicks on a link in the specified email.
|
286
|
+
#
|
287
|
+
#
|
288
|
+
# @return [Integer] Count of clicks.
|
289
|
+
#
|
290
|
+
# @see http://help.mailup.com/display/mailupapi/Email+statistics+methods+v1.1#Emailstatisticsmethodsv1.1-CountRecipientClicks
|
291
|
+
#
|
292
|
+
# @example
|
293
|
+
#
|
294
|
+
# clicks = mailup.console.recipient(154).clicks_count
|
295
|
+
# => 324
|
296
|
+
#
|
297
|
+
def clicks_count
|
298
|
+
@api.get("#{@api.path}/Recipient/#{@id}/Count/Clicks")
|
299
|
+
end
|
300
|
+
|
301
|
+
end
|
302
|
+
end
|
303
|
+
end
|
data/mailup.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'mailup/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "mailup"
|
8
|
+
gem.version = MailUp::VERSION
|
9
|
+
gem.platform = Gem::Platform::RUBY
|
10
|
+
gem.authors = ["Brian Getting"]
|
11
|
+
gem.email = ["brian@tatem.ae"]
|
12
|
+
gem.homepage = "https://github.com/mailup/mailup-ruby"
|
13
|
+
gem.summary = "Ruby wrapper for the MailUp REST API"
|
14
|
+
gem.description = "A Ruby gem for interacting with the MailUp REST API."
|
15
|
+
|
16
|
+
gem.files = `git ls-files`.split($/)
|
17
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
18
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
|
+
gem.require_paths = ["lib"]
|
20
|
+
|
21
|
+
gem.add_dependency 'oauth2', '>= 0.9.2'
|
22
|
+
|
23
|
+
gem.add_development_dependency "rspec"
|
24
|
+
gem.add_development_dependency "rake"
|
25
|
+
end
|
data/rails/init.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'mailup'
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
# Console API Methods
|
4
|
+
describe MailUp::Console do
|
5
|
+
before(:each){ init_mailup }
|
6
|
+
|
7
|
+
it 'should return a console base object' do
|
8
|
+
@mailup.console.should be_an_instance_of(MailUp::Console::Base)
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should have the correct API path' do
|
12
|
+
@mailup.console.api.path.should eq("/API/v#{MailUp::API_VERSION}/Rest/ConsoleService.svc/Console")
|
13
|
+
end
|
14
|
+
|
15
|
+
%w(email images recipient user).each do |resource|
|
16
|
+
context resource do
|
17
|
+
it "should return a #{resource} object" do
|
18
|
+
test = @mailup.console.send(resource.to_sym)
|
19
|
+
test.should be_an_instance_of(Object.const_get "MailUp::Console::#{resource.capitalize}")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
%w(group import list).each do |resource|
|
25
|
+
context resource do
|
26
|
+
it "should return a #{resource} object" do
|
27
|
+
test = @mailup.console.send(resource.to_sym, 1)
|
28
|
+
test.should be_an_instance_of(Object.const_get "MailUp::Console::#{resource.capitalize}")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe MailUp::Console::Email do
|
4
|
+
before(:each){ init_mailup }
|
5
|
+
|
6
|
+
%w(send).each do |method|
|
7
|
+
it "should have a #{method} method" do
|
8
|
+
@mailup.console.email.should respond_to(method.to_sym)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should fire the correct POST request for send" do
|
13
|
+
email = "test@email.com"
|
14
|
+
id = rand(100).abs
|
15
|
+
@mailup.console.email.api.should_receive(:post).with("#{@mailup.console.email.api.path}/Email/Send", {body: {:idMessage => id, :Email => email}})
|
16
|
+
@mailup.console.email.send(id, email)
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe MailUp::Console::Group do
|
4
|
+
before(:each) { init_mailup }
|
5
|
+
|
6
|
+
%w(add_recipients recipients subscribe unsubscribe send_message).each do |method|
|
7
|
+
it "should have a #{method} method" do
|
8
|
+
@mailup.console.group(1).should respond_to(method.to_sym)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should fire the correct POST request for add_recipients" do
|
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})
|
15
|
+
@mailup.console.group(1).add_recipients(payload)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should fire the correct GET request for recipients" do
|
19
|
+
payload = Date._jisx0301("empty hash, please")
|
20
|
+
@mailup.console.group(1).api.should_receive(:get).with("#{@mailup.console.group(1).api.path}/Group/1/Recipients", {params: {}})
|
21
|
+
@mailup.console.group(1).recipients
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should fire the correct POST request for subscribe" do
|
25
|
+
id = rand(100).abs
|
26
|
+
@mailup.console.group(1).api.should_receive(:post).with("#{@mailup.console.group(1).api.path}/Group/1/Subscribe/#{id}")
|
27
|
+
@mailup.console.group(1).subscribe(id)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should fire the correct DELETE request for unsubscribe" do
|
31
|
+
id = rand(100).abs
|
32
|
+
@mailup.console.group(1).api.should_receive(:delete).with("#{@mailup.console.group(1).api.path}/Group/1/Unsubscribe/#{id}")
|
33
|
+
@mailup.console.group(1).unsubscribe(id)
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should fire the correct POST request for send_message" do
|
37
|
+
id = rand(100).abs
|
38
|
+
@mailup.console.group(1).api.should_receive(:post).with("#{@mailup.console.group(1).api.path}/Group/1/Email/#{id}/Send")
|
39
|
+
@mailup.console.group(1).send_message(id)
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe MailUp::Console::Images do
|
4
|
+
before(:each) { init_mailup }
|
5
|
+
|
6
|
+
%w(add_image delete_image list).each do |method|
|
7
|
+
it "should have a #{method} method" do
|
8
|
+
@mailup.console.images.should respond_to(method.to_sym)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should fire the correct GET request for list" do
|
13
|
+
@mailup.console.images.api.should_receive(:get).with("#{@mailup.console.images.api.path}/Images")
|
14
|
+
@mailup.console.images.list
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should fire the correct POST request for add_image" do
|
18
|
+
payload = Date._jisx0301("empty hash, please")
|
19
|
+
@mailup.console.images.api.should_receive(:post).with("#{@mailup.console.images.api.path}/Images", {body: payload})
|
20
|
+
@mailup.console.images.add_image(payload)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should fire the correct DELETE request for delete_image" do
|
24
|
+
path = "/Test/Image/Path"
|
25
|
+
@mailup.console.images.api.should_receive(:delete).with("#{@mailup.console.images.api.path}/Images", {body: path})
|
26
|
+
@mailup.console.images.delete_image(path)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|