mail_plugger 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 403f35a6dee9fc93915f2271da9664c04e9fcce377badde7ef4a071a889f0022
4
- data.tar.gz: 146f2ab69a3848eea46951e4ffb97fa1ee6bea3dd3a61e2b507ed4880e7dd3a0
3
+ metadata.gz: f909bb4d7136983266dbbe01519966ec0a3f5166cd7576401de5129e8fb6d255
4
+ data.tar.gz: 79a650bdbe95199bb28ff1dddefbf405d09e2dcf661d8bb0557b7c4594d85cc4
5
5
  SHA512:
6
- metadata.gz: f236b23b4f0c0712161e3de82d33fe72186414dd09c4472470863b408d21cb236a6bf445b66f82ffc4cfc1c28b46d8e88000ed9af862cda788c9ada2845fef50
7
- data.tar.gz: fc8f8254b3a46145744eebd9f1d67841e990b0d53a7364c32126d6b1b2c9a8a65ff30def68da4c223d58d43ad07aa76646ecfed8c8a13b2c04840b09e5e2139b
6
+ metadata.gz: 82416b31f9a56713434d37055caf55c83d361ea0bb22f1d643116106bc13cb5803974d9f89945ef938471fb63626742299353f40673df24f49f2ef098172daee
7
+ data.tar.gz: 2ee3ad7f530aad9e8dcf864bef0dc17c3dd23fea193fa796cffd676bf917f11d36a0af95632edb46fd2bb0267c12035f95b4783dd80fea1cff2125d5fcfc90f6
data/CHANGELOG.md CHANGED
@@ -1,21 +1,35 @@
1
1
  # Change log
2
2
 
3
+ ## 1.3.0 (2021-04-14)
4
+
5
+ ### New features
6
+
7
+ * Add MailGrabber to FakePlugger. Now we can use FakePlugger and MailGrabber in same time.
8
+
9
+ ### Changes
10
+
11
+ * Remove unnecessary double quotes from `show_debug_info` method in `FakePlugger::DeliveryMethod` and fix documentations.
12
+ * Update bundler and gems.
13
+ * Update bug_report.md.
14
+
15
+
3
16
  ## 1.2.0 (2021-03-18)
4
17
 
5
18
  ### New organization
6
19
 
7
- * Move mail_plugger repository into MailToolbox organization
20
+ * Move mail_plugger repository into MailToolbox organization.
8
21
 
9
22
  ### Changes
10
23
 
11
- * Update gems
12
- * Fix some documentation issues
24
+ * Update gems.
25
+ * Fix some documentation issues.
26
+
13
27
 
14
28
  ## 1.1.1 (2021-01-21)
15
29
 
16
30
  ### Changes
17
31
 
18
- * Change FakePlugger::DeliveryMethod to returns with the extracted delivery data instead of the message object.
32
+ * Change `FakePlugger::DeliveryMethod` to returns with the extracted delivery data instead of the message object.
19
33
  * Update code documentations.
20
34
  * Add missing FakePlugger description in the README.md.
21
35
 
@@ -61,7 +75,7 @@
61
75
  * Check hash keys in `MailPlugger::MailHelper.delivery_system` method, so now if we are add wrong `delivey_system` then we are getting a meaningful error message.
62
76
  * Change `MailPlugger::MailHelper.extract_attachments` method. If an attachment is inline then the hash contains the `filename` and `cid` as well.
63
77
  * Add/Change tests.
64
- * Change `MailPlugger::MailHelper.delivery_option` that returns with indifferent hash
78
+ * Change `MailPlugger::MailHelper.delivery_option` that returns with indifferent hash.
65
79
 
66
80
 
67
81
  ## 1.0.0.beta1 (2021-01-02)
data/README.md CHANGED
@@ -44,13 +44,14 @@ Or install it yourself as:
44
44
 
45
45
  # F<img src="https://raw.githubusercontent.com/MailToolbox/mail_plugger/main/images/fake_plugger800x500.png" height="22" />kePlugger
46
46
 
47
- **FakePlugger** is a delivery method to mock **MailPlugger**. It is working similarly like **MailPlugger**, but it won't send any emails (but if we would like it is possible, just we should do manually). Also it can write out debug informations or we can manipulate the response with it.
47
+ **FakePlugger** is a delivery method to mock **MailPlugger**. It is working similarly like **MailPlugger**, but it won't send any emails (but if we would like it is possible, just we should do manually). Also it can write out debug informations or we can manipulate the response with it. Another option that we can use **[MailGrabber](https://github.com/MailToolbox/mail_grabber)** web interface if the delivery method is `:fake_plugger`.
48
48
 
49
49
  ## Usage
50
50
 
51
51
  - [How to use FakePlugger::DeliveryMethod class](https://github.com/MailToolbox/mail_plugger/blob/main/docs/usage_of_fake_plugger_delivery_method.md)
52
52
  - [How to use FakePlugger in a Ruby script or IRB console](https://github.com/MailToolbox/mail_plugger/blob/main/docs/usage_of_fake_plugger_in_script_or_console.md)
53
53
  - [How to use FakePlugger in Ruby on Rails](https://github.com/MailToolbox/mail_plugger/blob/main/docs/usage_of_fake_plugger_in_ruby_on_rails.md)
54
+ - [How to use FakePlugger with MailGrabber in Ruby on Rails](https://github.com/MailToolbox/mail_plugger/blob/main/docs/usage_of_fake_plugger_with_mail_grabber_in_ruby_on_rails.md)
54
55
 
55
56
  ## Development
56
57
 
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'mail_grabber' if Gem.loaded_specs.key?('mail_grabber')
4
+
3
5
  module FakePlugger
4
6
  class DeliveryMethod < MailPlugger::DeliveryMethod
5
7
  # Initialize FakePlugger delivery method attributes. If we are using
@@ -29,13 +31,20 @@ module FakePlugger
29
31
  # @option options [String/Symbol/Array/Hash] response
30
32
  # the deliver! method will return with this value or if this value is nil
31
33
  # then it will return with the client object
34
+ #
35
+ # @option options [Boolean] use_mail_grabber
36
+ # if true it will store the message in a database which MailGrabber can
37
+ # read
32
38
  def initialize(options = {})
33
39
  super
34
40
 
35
- @debug = options[:debug] || settings[:fake_plugger_debug] || false
36
- @raw_message = options[:raw_message] ||
37
- settings[:fake_plugger_raw_message] || false
38
- @response = options[:response] || settings[:fake_plugger_response]
41
+ @debug = options[:debug] ||
42
+ settings[:fake_plugger_debug] || false
43
+ @raw_message = options[:raw_message] ||
44
+ settings[:fake_plugger_raw_message] || false
45
+ @response = options[:response] || settings[:fake_plugger_response]
46
+ @use_mail_grabber = options[:use_mail_grabber] ||
47
+ settings[:fake_plugger_use_mail_grabber] || false
39
48
  end
40
49
 
41
50
  # Mock send message with the given client if the message parameter is a
@@ -52,6 +61,7 @@ module FakePlugger
52
61
  # is calling in normal operation as well.
53
62
  # If 'debug' is true then it prints out some debug informations.
54
63
  # If 'raw_message' is true then it prints out raw message.
64
+ # if 'use_mail_grabber' is true then it stores the message in a database.
55
65
  #
56
66
  # @param [Mail::Message] message what we would like to send
57
67
  #
@@ -64,6 +74,7 @@ module FakePlugger
64
74
  # api.delivery_settings = {
65
75
  # fake_plugger_debug: true,
66
76
  # fake_plugger_raw_message: true,
77
+ # fake_plugger_use_mail_grabber: true,
67
78
  # fake_plugger_response: { response: 'OK' }
68
79
  # }
69
80
  # api.client = DefinedApiClientClass
@@ -84,6 +95,7 @@ module FakePlugger
84
95
  # client: DefinedApiClientClass,
85
96
  # debug: true,
86
97
  # raw_message: true,
98
+ # use_mail_grabber: true,
87
99
  # response: { response: 'OK' }
88
100
  # ).deliver!(message)
89
101
  #
@@ -95,14 +107,24 @@ module FakePlugger
95
107
 
96
108
  @message = message
97
109
 
98
- show_debug_info if @debug
99
- show_raw_message if @raw_message
110
+ call_extra_options
100
111
 
101
112
  return_with_response
102
113
  end
103
114
 
104
115
  private
105
116
 
117
+ # Call extra options like show debug informations, show raw message,
118
+ # use mail grabber
119
+ def call_extra_options
120
+ show_debug_info if @debug
121
+ show_raw_message if @raw_message
122
+
123
+ return unless Gem.loaded_specs.key?('mail_grabber') && @use_mail_grabber
124
+
125
+ MailGrabber::DeliveryMethod.new.deliver!(@message)
126
+ end
127
+
106
128
  # Return with a response which depends on the conditions.
107
129
  def return_with_response
108
130
  return client.new(delivery_data) if @response.nil?
@@ -123,9 +145,9 @@ module FakePlugger
123
145
 
124
146
  ==> @client: #{@client.inspect}
125
147
 
126
- ==> @delivery_options: #{@delivery_options.inspect}"
148
+ ==> @delivery_options: #{@delivery_options.inspect}
127
149
 
128
- ==> @delivery_settings: #{@delivery_settings.inspect}"
150
+ ==> @delivery_settings: #{@delivery_settings.inspect}
129
151
 
130
152
  ==> @default_delivery_system: #{@default_delivery_system.inspect}
131
153
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MailPlugger
4
- VERSION = '1.2.0'
4
+ VERSION = '1.3.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mail_plugger
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Norbert Szivós
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-18 00:00:00.000000000 Z
11
+ date: 2021-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mail