mailgun-ruby 1.1.9 → 1.2.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +0 -0
  3. data/.rubocop_todo.yml +0 -0
  4. data/.ruby-env.yml.example +1 -0
  5. data/.travis.yml +6 -5
  6. data/CHANGELOG.md +16 -0
  7. data/Gemfile +1 -1
  8. data/README.md +30 -3
  9. data/docs/Domains.md +3 -0
  10. data/docs/EmailValidation.md +34 -0
  11. data/docs/OptInHandler.md +1 -1
  12. data/docs/Snippets.md +54 -61
  13. data/docs/Subaccounts.md +68 -0
  14. data/docs/Suppressions.md +10 -0
  15. data/docs/Webhooks.md +0 -0
  16. data/docs/railgun/EmailValidation.md +34 -0
  17. data/docs/railgun/Overview.md +11 -0
  18. data/docs/railgun/Parameters.md +83 -0
  19. data/docs/railgun/Templates.md +92 -0
  20. data/lib/mailgun/address.rb +3 -28
  21. data/lib/mailgun/chains.rb +0 -0
  22. data/lib/mailgun/client.rb +55 -9
  23. data/lib/mailgun/domains/domains.rb +20 -2
  24. data/lib/mailgun/events/events.rb +2 -2
  25. data/lib/mailgun/exceptions/exceptions.rb +28 -1
  26. data/lib/mailgun/messages/batch_message.rb +1 -0
  27. data/lib/mailgun/messages/message_builder.rb +56 -8
  28. data/lib/mailgun/response.rb +7 -0
  29. data/lib/mailgun/subaccounts/subaccounts.rb +84 -0
  30. data/lib/mailgun/suppressions.rb +15 -8
  31. data/lib/mailgun/templates/templates.rb +187 -0
  32. data/lib/mailgun/version.rb +1 -1
  33. data/lib/mailgun/webhooks/webhooks.rb +2 -2
  34. data/lib/mailgun-ruby.rb +1 -1
  35. data/lib/mailgun.rb +5 -1
  36. data/lib/railgun/mailer.rb +85 -12
  37. data/lib/railgun/message.rb +2 -1
  38. data/lib/railgun/railtie.rb +3 -2
  39. data/mailgun.gemspec +15 -12
  40. data/spec/integration/bounces_spec.rb +3 -3
  41. data/spec/integration/campaign_spec.rb +0 -0
  42. data/spec/integration/complaints_spec.rb +0 -0
  43. data/spec/integration/domains_spec.rb +8 -0
  44. data/spec/integration/email_validation_spec.rb +10 -2
  45. data/spec/integration/events_spec.rb +1 -1
  46. data/spec/integration/list_members_spec.rb +0 -0
  47. data/spec/integration/list_spec.rb +0 -0
  48. data/spec/integration/mailer_spec.rb +67 -0
  49. data/spec/integration/mailgun_spec.rb +92 -1
  50. data/spec/integration/routes_spec.rb +0 -0
  51. data/spec/integration/stats_spec.rb +0 -0
  52. data/spec/integration/subaccounts_spec.rb +58 -0
  53. data/spec/integration/suppressions_spec.rb +18 -2
  54. data/spec/integration/templates_spec.rb +135 -0
  55. data/spec/integration/unsubscribes_spec.rb +0 -0
  56. data/spec/integration/webhook_spec.rb +0 -0
  57. data/spec/spec_helper.rb +3 -1
  58. data/spec/unit/connection/test_client.rb +18 -1
  59. data/spec/unit/events/events_spec.rb +19 -0
  60. data/spec/unit/mailgun_spec.rb +43 -2
  61. data/spec/unit/messages/batch_message_spec.rb +56 -40
  62. data/spec/unit/messages/message_builder_spec.rb +149 -16
  63. data/spec/unit/messages/sample_data/unknown.type +0 -0
  64. data/spec/unit/railgun/mailer_spec.rb +388 -0
  65. data/vcr_cassettes/bounces.yml +12 -12
  66. data/vcr_cassettes/complaints.yml +0 -0
  67. data/vcr_cassettes/domains.todo.yml +0 -0
  68. data/vcr_cassettes/domains.yml +51 -1
  69. data/vcr_cassettes/email_validation.yml +5 -5
  70. data/vcr_cassettes/events.yml +0 -0
  71. data/vcr_cassettes/exceptions-invalid-api-key.yml +52 -0
  72. data/vcr_cassettes/exceptions-invalid-data.yml +52 -0
  73. data/vcr_cassettes/exceptions-not-allowed.yml +54 -0
  74. data/vcr_cassettes/list_members.yml +0 -0
  75. data/vcr_cassettes/mailer_invalid_domain.yml +109 -0
  76. data/vcr_cassettes/mailing_list.todo.yml +0 -0
  77. data/vcr_cassettes/mailing_list.yml +0 -0
  78. data/vcr_cassettes/message_deliver.yml +149 -0
  79. data/vcr_cassettes/routes.yml +0 -0
  80. data/vcr_cassettes/send_message.yml +0 -0
  81. data/vcr_cassettes/stats.yml +0 -0
  82. data/vcr_cassettes/subaccounts.yml +270 -0
  83. data/vcr_cassettes/suppressions.yml +66 -15
  84. data/vcr_cassettes/templates.yml +1065 -0
  85. data/vcr_cassettes/unsubscribes.yml +0 -0
  86. data/vcr_cassettes/webhooks.yml +0 -0
  87. metadata +56 -29
  88. data/.ruby-version +0 -1
  89. /data/spec/unit/{railgun_spec.rb → railgun/content_type_spec.rb} +0 -0
@@ -49,7 +49,7 @@ http_interactions:
49
49
  body:
50
50
  encoding: UTF-8
51
51
  string: '{"message":"4 addresses have been added to the bounces table"}'
52
- http_version:
52
+ http_version:
53
53
  recorded_at: Wed, 30 Nov 2016 20:53:49 GMT
54
54
  - request:
55
55
  method: delete
@@ -93,7 +93,7 @@ http_interactions:
93
93
  encoding: UTF-8
94
94
  string: '{"address":"test1@example.com","message":"Bounced address has been
95
95
  removed"}'
96
- http_version:
96
+ http_version:
97
97
  recorded_at: Wed, 30 Nov 2016 20:53:49 GMT
98
98
  - request:
99
99
  method: delete
@@ -137,7 +137,7 @@ http_interactions:
137
137
  encoding: UTF-8
138
138
  string: '{"address":"test2@example.org","message":"Bounced address has been
139
139
  removed"}'
140
- http_version:
140
+ http_version:
141
141
  recorded_at: Wed, 30 Nov 2016 20:53:50 GMT
142
142
  - request:
143
143
  method: delete
@@ -181,7 +181,7 @@ http_interactions:
181
181
  encoding: UTF-8
182
182
  string: '{"address":"test3@example.net","message":"Bounced address has been
183
183
  removed"}'
184
- http_version:
184
+ http_version:
185
185
  recorded_at: Wed, 30 Nov 2016 20:53:50 GMT
186
186
  - request:
187
187
  method: delete
@@ -225,7 +225,7 @@ http_interactions:
225
225
  encoding: UTF-8
226
226
  string: '{"address":"test4@example.info","message":"Bounced address has been
227
227
  removed"}'
228
- http_version:
228
+ http_version:
229
229
  recorded_at: Wed, 30 Nov 2016 20:53:50 GMT
230
230
  - request:
231
231
  method: post
@@ -274,7 +274,7 @@ http_interactions:
274
274
  body:
275
275
  encoding: UTF-8
276
276
  string: '{"message":"4 addresses have been added to the unsubscribes table"}'
277
- http_version:
277
+ http_version:
278
278
  recorded_at: Wed, 30 Nov 2016 20:53:51 GMT
279
279
  - request:
280
280
  method: delete
@@ -318,7 +318,7 @@ http_interactions:
318
318
  encoding: UTF-8
319
319
  string: '{"address":"test1@example.com","message":"Unsubscribe event has been
320
320
  removed"}'
321
- http_version:
321
+ http_version:
322
322
  recorded_at: Wed, 30 Nov 2016 20:53:51 GMT
323
323
  - request:
324
324
  method: delete
@@ -362,7 +362,7 @@ http_interactions:
362
362
  encoding: UTF-8
363
363
  string: '{"address":"test2@example.org","message":"Unsubscribe event has been
364
364
  removed"}'
365
- http_version:
365
+ http_version:
366
366
  recorded_at: Wed, 30 Nov 2016 20:53:51 GMT
367
367
  - request:
368
368
  method: delete
@@ -406,7 +406,7 @@ http_interactions:
406
406
  encoding: UTF-8
407
407
  string: '{"address":"test3@example.net","message":"Unsubscribe event has been
408
408
  removed"}'
409
- http_version:
409
+ http_version:
410
410
  recorded_at: Wed, 30 Nov 2016 20:53:51 GMT
411
411
  - request:
412
412
  method: delete
@@ -450,7 +450,7 @@ http_interactions:
450
450
  encoding: UTF-8
451
451
  string: '{"address":"test4@example.info","message":"Unsubscribe event has been
452
452
  removed"}'
453
- http_version:
453
+ http_version:
454
454
  recorded_at: Wed, 30 Nov 2016 20:53:52 GMT
455
455
  - request:
456
456
  method: post
@@ -498,7 +498,7 @@ http_interactions:
498
498
  encoding: UTF-8
499
499
  string: '{"message":"4 complaint addresses have been added to the complaints
500
500
  table"}'
501
- http_version:
501
+ http_version:
502
502
  recorded_at: Wed, 30 Nov 2016 20:53:52 GMT
503
503
  - request:
504
504
  method: delete
@@ -541,7 +541,7 @@ http_interactions:
541
541
  body:
542
542
  encoding: UTF-8
543
543
  string: '{"address":"test1@example.com","message":"Spam complaint has been removed"}'
544
- http_version:
544
+ http_version:
545
545
  recorded_at: Wed, 30 Nov 2016 20:53:52 GMT
546
546
  - request:
547
547
  method: delete
@@ -584,7 +584,7 @@ http_interactions:
584
584
  body:
585
585
  encoding: UTF-8
586
586
  string: '{"address":"test2@example.org","message":"Spam complaint has been removed"}'
587
- http_version:
587
+ http_version:
588
588
  recorded_at: Wed, 30 Nov 2016 20:53:52 GMT
589
589
  - request:
590
590
  method: delete
@@ -627,7 +627,7 @@ http_interactions:
627
627
  body:
628
628
  encoding: UTF-8
629
629
  string: '{"address":"test3@example.net","message":"Spam complaint has been removed"}'
630
- http_version:
630
+ http_version:
631
631
  recorded_at: Wed, 30 Nov 2016 20:53:53 GMT
632
632
  - request:
633
633
  method: delete
@@ -671,6 +671,57 @@ http_interactions:
671
671
  encoding: UTF-8
672
672
  string: '{"address":"test4@example.info","message":"Spam complaint has been
673
673
  removed"}'
674
- http_version:
674
+ http_version:
675
675
  recorded_at: Wed, 30 Nov 2016 20:53:53 GMT
676
+ - request:
677
+ method: post
678
+ uri: https://api:<APIKEY>@api.mailgun.net/v3/DOMAIN.TEST/unsubscribes
679
+ body:
680
+ encoding: UTF-8
681
+ string: '[{"address":"test4@example.info","tag":"integration"},{"address":"test3@example.net","tag":"integration"},{"address":"test2@example.org","tag":"integration"},{"address":"test1@example.com","tag":"integration"}]'
682
+ headers:
683
+ Accept:
684
+ - "*/*"
685
+ Accept-Encoding:
686
+ - gzip, deflate
687
+ User-Agent:
688
+ - rest-client/2.0.2 (darwin18.7.0 x86_64) ruby/2.5.7p206
689
+ Content-Type:
690
+ - application/json
691
+ Content-Length:
692
+ - '210'
693
+ Host:
694
+ - api.mailgun.net
695
+ response:
696
+ status:
697
+ code: 200
698
+ message: OK
699
+ headers:
700
+ Access-Control-Allow-Headers:
701
+ - Content-Type, x-requested-with
702
+ Access-Control-Allow-Methods:
703
+ - GET, POST, PUT, DELETE, OPTIONS
704
+ Access-Control-Allow-Origin:
705
+ - "*"
706
+ Access-Control-Max-Age:
707
+ - '600'
708
+ Content-Type:
709
+ - application/json; charset=utf-8
710
+ Date:
711
+ - Tue, 04 Feb 2020 15:16:07 GMT
712
+ Server:
713
+ - nginx
714
+ Strict-Transport-Security:
715
+ - max-age=63072000; includeSubDomains
716
+ Content-Length:
717
+ - '68'
718
+ Connection:
719
+ - keep-alive
720
+ body:
721
+ encoding: UTF-8
722
+ string: '{"message":"4 addresses have been added to the unsubscribes table"}
723
+
724
+ '
725
+ http_version:
726
+ recorded_at: Tue, 04 Feb 2020 15:16:07 GMT
676
727
  recorded_with: VCR 3.0.3