mail_plugger 1.5.0 → 1.6.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: 174f3fa6b0708e5e3635df906ef07df145dbfecade90452bae98d2bfef912f5a
4
- data.tar.gz: 58c9aa8b5a2dc5d6552a02d79775d45bfbea6bb770fa4943b97986d4c58ad485
3
+ metadata.gz: 7ec4ac88872c10e0533aac02a9947fdb9f93a7027d004e380cd5a0f854db3840
4
+ data.tar.gz: 82f4adcbdcac821c94161cc61da1cb2228f3fee00fbfdd7306a17fe5e87a5347
5
5
  SHA512:
6
- metadata.gz: 1de355d0eff072fcd5ac56b99d258143a7d52eb7edfd23851335c8089ffab8cde18fb86fb6c952828b8529f573778216c10118043322df703311b491605c0779
7
- data.tar.gz: 46c0e544614420ade838a70b01031fbd2cf3698c98c7666869638bbfb42622dbf9ea47261a013bbb461e3ba4bffc5497ece8bc222da55bd65479bede4d127edc
6
+ metadata.gz: de83d9be11f14e045b70bdfcc6bac03353d3b84fee8e5858cf24558236925d750015117f0d04efb953161b735bf8c3beaa1ac474483e07856a215778633132c8
7
+ data.tar.gz: 03ff6162170252b04c7af6f7d1754ecd7d8a6e8c1843a59986b5c1b8a279f54542abd744e57e923e524f8526dc1866296a873ae0e1776567da2b94c1f37780e6
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Change log
2
2
 
3
+ ## 1.6.0 (2022-05-26)
4
+
5
+ ### Changes
6
+
7
+ * Drop Ruby 2.6 support.
8
+ * Fix some grammar issues and typos.
9
+ * Update bundler and gems.
10
+
11
+
3
12
  ## 1.5.0 (2021-12-31)
4
13
 
5
14
  ### Changes
data/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  [![Maintainability](https://api.codeclimate.com/v1/badges/137881380fc475b4a836/maintainability)](https://codeclimate.com/github/MailToolbox/mail_plugger/maintainability)
8
8
  [![Test Coverage](https://api.codeclimate.com/v1/badges/137881380fc475b4a836/test_coverage)](https://codeclimate.com/github/MailToolbox/mail_plugger/test_coverage)
9
9
 
10
- **MailPlugger** helps you to use different mail providers' **SMTP** and **API**. You can use any SMTPs and APIs which one would like to use. It allows you to send different emails with different SMTPs and APIs. Also it can help to move between providers, load balancing or cost management.
10
+ **MailPlugger** helps you to use different mail providers' **SMTP** and **API**. You can use any SMTPs and APIs which one would like to use. It allows you to send different emails with different SMTPs and APIs. Also, it can help to move between providers, load balancing or cost management.
11
11
 
12
12
  ## Installation
13
13
 
@@ -46,7 +46,7 @@ Or install it yourself as:
46
46
 
47
47
  # F<img src="https://raw.githubusercontent.com/MailToolbox/mail_plugger/main/images/fake_plugger800x500.png" height="22" />kePlugger
48
48
 
49
- **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`.
49
+ **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 information, 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`.
50
50
 
51
51
  ## Usage
52
52
 
@@ -23,10 +23,10 @@ module FakePlugger
23
23
  # e.g. 'defined_api'
24
24
  #
25
25
  # @option options [Boolean] debug
26
- # if true it will show debug informations
26
+ # if true, it will show debug information
27
27
  #
28
28
  # @option options [Boolean] raw_message
29
- # if true it will show raw message
29
+ # if true, it will show raw message
30
30
  #
31
31
  # @option options [String/Symbol/Array/Hash] response
32
32
  # the deliver! method will return with this value or if this value is nil
@@ -53,22 +53,22 @@ module FakePlugger
53
53
  #
54
54
  # Using API:
55
55
  # Mock send message with the given client if the message parameter is a
56
- # Mail::Message object. If 'response' parameter is nil then it will extract
57
- # those information from the Mail::Message object which was provided in the
56
+ # Mail::Message object. If 'response' parameter is nil, then it will extract
57
+ # this information from the Mail::Message object which was provided in the
58
58
  # 'delivery_options'. After that it generates a hash with these data and
59
59
  # returns with the provided client class which has a 'deliver' method, but
60
60
  # it won't call the 'deliver' method.
61
61
  # If the 'response' parameter is a hash with 'return_delivery_data: true'
62
- # then it will retrun with the extracted delivery data.
62
+ # then it will return with the extracted delivery data.
63
63
  #
64
64
  #
65
- # If the 'response' parameter is not nil then retruns with that given data
65
+ # If the 'response' parameter is not nil, then returns with that given data
66
66
  # without call any other methods.
67
- # Except if 'debug' is true. In this case it will call those methods which
68
- # is calling in normal operation as well.
69
- # If 'debug' is true then it prints out some debug informations.
70
- # If 'raw_message' is true then it prints out raw message.
71
- # if 'use_mail_grabber' is true then it stores the message in a database.
67
+ # Except if 'debug' is true. In this case, it will call those methods which
68
+ # are calling in normal operation as well.
69
+ # If 'debug' is true, then it prints out some debug information.
70
+ # If 'raw_message' is true, then it prints out raw message.
71
+ # If 'use_mail_grabber' is true, then it stores the message in a database.
72
72
  #
73
73
  # @param [Mail::Message] message what we would like to send
74
74
  #
@@ -165,7 +165,7 @@ module FakePlugger
165
165
 
166
166
  private
167
167
 
168
- # Call extra options like show debug informations, show raw message,
168
+ # Call extra options like show debug information, show raw message,
169
169
  # use mail grabber.
170
170
  def call_extra_options
171
171
  show_debug_info if @debug
@@ -176,7 +176,7 @@ module FakePlugger
176
176
  MailGrabber::DeliveryMethod.new.deliver!(@message)
177
177
  end
178
178
 
179
- # Debug informations for API
179
+ # Debug information for API
180
180
  def debug_info_for_api
181
181
  puts <<~DEBUG_INFO
182
182
 
@@ -246,7 +246,7 @@ module FakePlugger
246
246
  end
247
247
  end
248
248
 
249
- # Check that it should retrun with the delivery data.
249
+ # Check that it should return with the delivery data.
250
250
  def return_delivery_data?
251
251
  !send_via_smtp? &&
252
252
  @response.is_a?(Hash) &&
@@ -262,7 +262,7 @@ module FakePlugger
262
262
  @response
263
263
  end
264
264
 
265
- # Show debug informations from variables and methods.
265
+ # Show debug information from variables and methods.
266
266
  def show_debug_info
267
267
  send_via_smtp? ? debug_info_for_smtp : debug_info_for_api
268
268
  end
@@ -44,7 +44,7 @@ module MailPlugger
44
44
  #
45
45
  # Using API:
46
46
  # Send message with the given client if the message parameter is a
47
- # Mail::Message object. Before doing that extract those information from the
47
+ # Mail::Message object. Before doing that, extract this information from the
48
48
  # Mail::Message object which was provided in the 'delivery_options'. After
49
49
  # that it generates a hash with these data and sends the message with the
50
50
  # provided client class which has a 'deliver' method.
@@ -2,24 +2,25 @@
2
2
 
3
3
  module MailPlugger
4
4
  class Error < StandardError
5
- # Specific error class for errors if client is not given or has a wrong type
5
+ # Specific error class for errors if client is not given or has a wrong
6
+ # type.
6
7
  class WrongApiClient < Error; end
7
8
 
8
- # Specific error class for errors if delivery options is not given or
9
- # has a wrong type
9
+ # Specific error class for errors if delivery options are not given or
10
+ # has a wrong type.
10
11
  class WrongDeliveryOptions < Error; end
11
12
 
12
- # Specific error class for errors if delivery settings has a wrong type
13
+ # Specific error class for errors if delivery settings has a wrong type.
13
14
  class WrongDeliverySettings < Error; end
14
15
 
15
- # Specific error class for errors if delivery system is not given
16
+ # Specific error class for errors if delivery system is not given.
16
17
  class WrongDeliverySystem < Error; end
17
18
 
18
- # Specific error class for errors if parameter is not given
19
+ # Specific error class for errors if parameter is not given.
19
20
  class WrongParameter < Error; end
20
21
 
21
- # Specific error class for errors if tries to add undelclared option
22
- # in plug_in block
22
+ # Specific error class for errors if tries to add undeclared option
23
+ # in plug_in block.
23
24
  class WrongPlugInOption < Error; end
24
25
  end
25
26
  end
@@ -27,9 +27,9 @@ module MailPlugger
27
27
  requirement.satisfied_by?(current_version)
28
28
  end
29
29
 
30
- # Extract 'client'. If it's a hash then it'll return the right
31
- # client belongs to the delivery system. If it's not a hash it'll return
32
- # the given value. But if the value doesn't a class it'll raise an error.
30
+ # Extract 'client'. If it's a hash, then it'll return the right
31
+ # client belongs to the delivery system. If it's not a hash, it'll return
32
+ # the given value. But if the value doesn't a class, it'll raise an error.
33
33
  #
34
34
  # @return [Class] the defined API class
35
35
  def client
@@ -73,22 +73,22 @@ module MailPlugger
73
73
  end
74
74
 
75
75
  # Tries to set up a default delivery system, if the 'delivery_system'
76
- # wasn't defined in the Mail::Message object and we're using
76
+ # wasn't defined in the Mail::Message object, and we're using
77
77
  # MailPlugger.plug_in then it returns with first key of the stored
78
78
  # 'delivery_systems'.
79
- # When we are't using MailPlugger.plug_in method and 'delivery_options',
79
+ # When we aren't using MailPlugger.plug_in method and 'delivery_options',
80
80
  # 'client' and/or 'delivery_settings' is a hash, then it tries to get the
81
81
  # 'delivery_system' from the hashes.
82
- # Otherwise it returns with nil.
82
+ # Otherwise, it returns with nil.
83
83
  #
84
84
  # @return [Stirng/NilClass] the first key from the extracted keys or nil
85
85
  def default_delivery_system_get
86
86
  extract_keys&.first
87
87
  end
88
88
 
89
- # Extract 'delivery_options'. If it's a hash then it'll return the right
90
- # options belongs to the delivery system. If it's not a hash it'll return
91
- # the given value. But if the value doesn't an array it'll raise an error.
89
+ # Extract 'delivery_options'. If it's a hash, then it'll return the right
90
+ # options, belongs to the delivery system. If it's not a hash, it'll return
91
+ # the given value. But if the value doesn't an array, it'll raise an error.
92
92
  #
93
93
  # @return [Array] the options it'll collect from the Mail::Message object
94
94
  def delivery_options
@@ -103,7 +103,7 @@ module MailPlugger
103
103
  end
104
104
 
105
105
  # Extract 'delivery_system' from the Mail::Message object or if it's not
106
- # defined then use the default one. If it's still nil and one of the
106
+ # defined, then use the default one. If it's still nil and one of the
107
107
  # 'delivery_options', 'client' and/or 'delivery_settings' is a hash and
108
108
  # 'delivery_settings' doesn't contain 'delivery_system' then raise error.
109
109
  #
@@ -121,8 +121,8 @@ module MailPlugger
121
121
  # Check the given 'delivery_options', 'client' and 'delivery_settings' are
122
122
  # hashes and if one of that does then check the 'delivery_system' is valid
123
123
  # or not.
124
- # If the given 'delivery_system' is nil or doesn't match with extracted keys
125
- # then it will raise error.
124
+ # If the given 'delivery_system' is nil or doesn't match with extracted
125
+ # keys, then it will raise error.
126
126
  def delivery_system_value_check
127
127
  return unless need_delivery_system?
128
128
 
@@ -138,7 +138,7 @@ module MailPlugger
138
138
  end
139
139
 
140
140
  # Check that 'delivery_settings' has 'delivery_system' key or not.
141
- # If 'delivery_settings' contains 'DELIVERY_SETTINGS_KEYS' then it retruns
141
+ # If 'delivery_settings' contains 'DELIVERY_SETTINGS_KEYS' then it returns
142
142
  # false, else true.
143
143
  #
144
144
  # @return [Boolean] true/false
@@ -163,9 +163,9 @@ module MailPlugger
163
163
  end
164
164
  end
165
165
 
166
- # Return 'delivery_systems' array if it's exist. If not then extract keys
166
+ # Return 'delivery_systems' array if it's exist. If not, then extract keys
167
167
  # from 'delivery_options', 'client' or 'delivery_settings',
168
- # depends on which is a hash. If none of these are hashes then returns nil.
168
+ # depends on which is a hash. If none of these are hashes, then returns nil.
169
169
  #
170
170
  # @return [Array/NilClass] with the keys or nil
171
171
  def extract_keys
@@ -175,7 +175,7 @@ module MailPlugger
175
175
  end
176
176
 
177
177
  # Extract keys from 'delivery_options', 'client' or 'delivery_settings',
178
- # depends on which is a hash. If none of these are hashes then returns nil.
178
+ # depends on which is a hash. If none of these are hashes, then returns nil.
179
179
  #
180
180
  # @return [Array/NilClass] with the keys from one of the hash or nil
181
181
  def extract_keys_from_other_variables
@@ -188,7 +188,7 @@ module MailPlugger
188
188
  end&.keys
189
189
  end
190
190
 
191
- # How to Extract the (unparsed) value of the mail message fields.
191
+ # How to extract the (unparsed) value of the mail message fields.
192
192
  #
193
193
  # @return [String] version dependent method call
194
194
  def mail_field_value
@@ -247,9 +247,9 @@ module MailPlugger
247
247
  false
248
248
  end
249
249
 
250
- # Extract 'settings'. If it's a hash then it'll return the right
251
- # settings belongs to the delivery system. If 'delivery_settings' is nil
252
- # it'll return an empty hash. But if the value doesn't a hash it'll raise
250
+ # Extract 'settings'. If it's a hash, then it'll return the right
251
+ # settings, belongs to the delivery system. If 'delivery_settings' is nil,
252
+ # it'll return an empty hash. But if the value doesn't a hash, it'll raise
253
253
  # an error.
254
254
  #
255
255
  # @return [Hash] settings for Mail delivery_method and/or FakePlugger
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MailPlugger
4
- VERSION = '1.5.0'
4
+ VERSION = '1.6.0'
5
5
  end
data/lib/mail_plugger.rb CHANGED
@@ -3,12 +3,12 @@
3
3
  require 'mail_plugger/error'
4
4
  require 'mail_plugger/mail_helper'
5
5
  require 'mail_plugger/delivery_method'
6
- # If we are using this gem outside of Rails then do not load this code.
6
+ # If we are using this gem outside of Rails, then do not load this code.
7
7
  require 'mail_plugger/railtie' if defined?(Rails)
8
8
  require 'mail_plugger/version'
9
9
 
10
10
  require 'fake_plugger/delivery_method'
11
- # If we are using this gem outside of Rails then do not load this code.
11
+ # If we are using this gem outside of Rails, then do not load this code.
12
12
  require 'fake_plugger/railtie' if defined?(Rails)
13
13
 
14
14
  module MailPlugger
@@ -104,8 +104,8 @@ module MailPlugger
104
104
  end
105
105
 
106
106
  # Define 'client', 'delivery_options' and 'delivery_settings' setter
107
- # methods. These methods are generating a hash where the key is the
108
- # 'delivery_system'. This let us to set/use more than one STMP/API.
107
+ # methods. These methods are generating a hash, where the key is the
108
+ # 'delivery_system'. This let us set/use more than one STMP/API.
109
109
  %w[client delivery_options delivery_settings].each do |method|
110
110
  define_method "#{method}=" do |value|
111
111
  variable = instance_variable_get("@#{method}")
@@ -116,7 +116,7 @@ module MailPlugger
116
116
 
117
117
  private
118
118
 
119
- # Check 'delivery_system' is valid or not. If it's not valid then
119
+ # Check 'delivery_system' is valid or not. If it's not valid, then
120
120
  # it will raise an error.
121
121
  #
122
122
  # @param [String/Symbol] delivery_system the name of the SMTP/API
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.5.0
4
+ version: 1.6.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-12-31 00:00:00.000000000 Z
11
+ date: 2022-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mail
@@ -77,7 +77,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
77
77
  requirements:
78
78
  - - ">="
79
79
  - !ruby/object:Gem::Version
80
- version: 2.6.0
80
+ version: 2.7.0
81
81
  required_rubygems_version: !ruby/object:Gem::Requirement
82
82
  requirements:
83
83
  - - ">="