mailgunner 2.2.2 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mailgunner.rb +6 -4
- data/mailgunner.gemspec +1 -1
- data/spec/mailgunner_spec.rb +35 -9
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f2850f4c4d7090a89e92f1f892da73b54dbdce6
|
4
|
+
data.tar.gz: 793b27238fa767fe883dc634442715fa355f958c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49a2692751d5a67f6fb05aaebf2c73fcd389aa2841311de02dea82a1e156471e3b6802c5e2e7813e08ed5f1bbe83fb3993d451b0f946254ddba7a63274d9cf94
|
7
|
+
data.tar.gz: ddd64af9eb4d81e9c9ddb6734d647681e8f82f863f732967c398a4a6b91a980c1d0f5a98a6dade7fa33d228b669f665209fad453016bac21fbcffa68d4f8a7af
|
data/lib/mailgunner.rb
CHANGED
@@ -145,9 +145,15 @@ module Mailgunner
|
|
145
145
|
end
|
146
146
|
|
147
147
|
def get_stats(params = {})
|
148
|
+
Kernel.warn 'Mailgunner::Client#get_stats is deprecated'
|
149
|
+
|
148
150
|
get("/v3/#{escape @domain}/stats", params)
|
149
151
|
end
|
150
152
|
|
153
|
+
def get_total_stats(params = {})
|
154
|
+
get("/v3/#{escape @domain}/stats/total", params)
|
155
|
+
end
|
156
|
+
|
151
157
|
def get_events(params = {})
|
152
158
|
get("/v3/#{escape @domain}/events", params)
|
153
159
|
end
|
@@ -256,10 +262,6 @@ module Mailgunner
|
|
256
262
|
delete("/v3/lists/#{escape list_address}/members/#{escape member_address}")
|
257
263
|
end
|
258
264
|
|
259
|
-
def get_list_stats(list_address)
|
260
|
-
get("/v3/lists/#{escape list_address}/stats")
|
261
|
-
end
|
262
|
-
|
263
265
|
private
|
264
266
|
|
265
267
|
def get(path, params = {}, headers = {})
|
data/mailgunner.gemspec
CHANGED
data/spec/mailgunner_spec.rb
CHANGED
@@ -5,6 +5,8 @@ require 'mailgunner'
|
|
5
5
|
require 'json'
|
6
6
|
require 'mail'
|
7
7
|
|
8
|
+
WebMock::Config.instance.query_values_notation = :flat_array
|
9
|
+
|
8
10
|
describe 'Mailgunner::Client' do
|
9
11
|
before do
|
10
12
|
@domain = 'samples.mailgun.org'
|
@@ -373,6 +375,10 @@ describe 'Mailgunner::Client' do
|
|
373
375
|
end
|
374
376
|
|
375
377
|
describe 'get_stats method' do
|
378
|
+
before do
|
379
|
+
Kernel.stubs(:warn)
|
380
|
+
end
|
381
|
+
|
376
382
|
it 'fetches the domain stats resource and returns the response object' do
|
377
383
|
stub_request(:get, "#@base_url/#@domain/stats").to_return(@json_response)
|
378
384
|
|
@@ -386,10 +392,38 @@ describe 'Mailgunner::Client' do
|
|
386
392
|
end
|
387
393
|
|
388
394
|
it 'encodes an event parameter with multiple values' do
|
389
|
-
stub_request(:get, "#@base_url/#@domain/stats?event=
|
395
|
+
stub_request(:get, "#@base_url/#@domain/stats?event=opened&event=sent")
|
390
396
|
|
391
397
|
@client.get_stats(event: %w(sent opened))
|
392
398
|
end
|
399
|
+
|
400
|
+
it 'emits a deprecation warning' do
|
401
|
+
stub_request(:get, "#@base_url/#@domain/stats")
|
402
|
+
|
403
|
+
Kernel.expects(:warn).with(regexp_matches(/Mailgunner::Client#get_stats is deprecated/))
|
404
|
+
|
405
|
+
@client.get_stats
|
406
|
+
end
|
407
|
+
end
|
408
|
+
|
409
|
+
describe 'get_total_stats method' do
|
410
|
+
it 'fetches the domain total stats resource and returns the response object' do
|
411
|
+
stub_request(:get, "#@base_url/#@domain/stats/total?event=delivered").to_return(@json_response)
|
412
|
+
|
413
|
+
@client.get_total_stats(event: 'delivered').must_equal(@json_response_object)
|
414
|
+
end
|
415
|
+
|
416
|
+
it 'encodes optional parameters' do
|
417
|
+
stub_request(:get, "#@base_url/#@domain/stats/total?event=delivered&resolution=hour")
|
418
|
+
|
419
|
+
@client.get_total_stats(event: 'delivered', resolution: 'hour')
|
420
|
+
end
|
421
|
+
|
422
|
+
it 'encodes multiple event values' do
|
423
|
+
stub_request(:get, "#@base_url/#@domain/stats/total?event=delivered&event=accepted")
|
424
|
+
|
425
|
+
@client.get_total_stats(event: %w(accepted delivered))
|
426
|
+
end
|
393
427
|
end
|
394
428
|
|
395
429
|
describe 'get_events method' do
|
@@ -721,12 +755,4 @@ describe 'Mailgunner::Client' do
|
|
721
755
|
@client.delete_list_member('developers@mailgun.net', @address).must_equal(@json_response_object)
|
722
756
|
end
|
723
757
|
end
|
724
|
-
|
725
|
-
describe 'get_list_stats method' do
|
726
|
-
it 'fetches the list stats resource and returns the response object' do
|
727
|
-
stub_request(:get, "#@base_url/lists/developers%40mailgun.net/stats").to_return(@json_response)
|
728
|
-
|
729
|
-
@client.get_list_stats('developers@mailgun.net').must_equal(@json_response_object)
|
730
|
-
end
|
731
|
-
end
|
732
758
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mailgunner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Craft
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
115
|
version: '0'
|
116
116
|
requirements: []
|
117
117
|
rubyforge_project:
|
118
|
-
rubygems_version: 2.
|
118
|
+
rubygems_version: 2.4.5.1
|
119
119
|
signing_key:
|
120
120
|
specification_version: 4
|
121
121
|
summary: Ruby client for the Mailgun API
|