mail_plugger 1.0.0.rc1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +54 -2
  3. data/README.md +40 -22
  4. data/lib/fake_plugger/delivery_method.rb +164 -0
  5. data/lib/fake_plugger/railtie.rb +14 -0
  6. data/lib/mail_plugger.rb +11 -2
  7. data/lib/mail_plugger/delivery_method.rb +2 -2
  8. data/lib/mail_plugger/version.rb +1 -1
  9. metadata +17 -48
  10. data/.github/ISSUE_TEMPLATE/bug_report.md +0 -22
  11. data/.github/ISSUE_TEMPLATE/feature_request.md +0 -16
  12. data/.gitignore +0 -11
  13. data/.rspec +0 -3
  14. data/.rubocop.yml +0 -53
  15. data/.travis.yml +0 -22
  16. data/Appraisals +0 -13
  17. data/CODE_OF_CONDUCT.md +0 -14
  18. data/CONTRIBUTING.md +0 -26
  19. data/Gemfile +0 -19
  20. data/Gemfile.lock +0 -92
  21. data/Rakefile +0 -11
  22. data/bin/console +0 -17
  23. data/bin/setup +0 -8
  24. data/docs/usage_in_ruby_on_rails.md +0 -182
  25. data/docs/usage_in_script_or_console.md +0 -158
  26. data/docs/usage_of_attachments_in_ruby_on_rails.md +0 -110
  27. data/docs/usage_of_aws_ses_in_ruby_on_rails.md +0 -136
  28. data/docs/usage_of_delivery_method.md +0 -104
  29. data/docs/usage_of_mailgun_in_ruby_on_rails.md +0 -58
  30. data/docs/usage_of_mandrill_in_ruby_on_rails.md +0 -104
  31. data/docs/usage_of_more_delivery_system_in_ruby_on_rails.md +0 -332
  32. data/docs/usage_of_one_delivery_system_with_more_send_methods_in_ruby_on_rails.md +0 -119
  33. data/docs/usage_of_plug_in_method.md +0 -62
  34. data/docs/usage_of_postmark_in_ruby_on_rails.md +0 -59
  35. data/docs/usage_of_secial_options_in_ruby_on_rails.md +0 -90
  36. data/docs/usage_of_sendgrid_in_ruby_on_rails.md +0 -82
  37. data/docs/usage_of_sparkpost_in_ruby_on_rails.md +0 -142
  38. data/gemfiles/.bundle/config +0 -2
  39. data/gemfiles/mail_2.6.gemfile +0 -15
  40. data/gemfiles/mail_2.6.gemfile.lock +0 -95
  41. data/gemfiles/mail_2.7.0.gemfile +0 -15
  42. data/gemfiles/mail_2.7.0.gemfile.lock +0 -93
  43. data/gemfiles/mail_2.7.gemfile +0 -15
  44. data/gemfiles/mail_2.7.gemfile.lock +0 -93
  45. data/images/mail_plugger.png +0 -0
  46. data/mail_plugger.gemspec +0 -40
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c47f868eab003c41513627ce740e0d61ab9628a97ba4fd896181254ce957ad92
4
- data.tar.gz: 5212e247ab3e9372e10c403edd9d680109e67aa07cf07d2cb2e2d92a3a2d8b59
3
+ metadata.gz: 403f35a6dee9fc93915f2271da9664c04e9fcce377badde7ef4a071a889f0022
4
+ data.tar.gz: 146f2ab69a3848eea46951e4ffb97fa1ee6bea3dd3a61e2b507ed4880e7dd3a0
5
5
  SHA512:
6
- metadata.gz: d79e80294fffb6b85ad0cb7838b03595d1c695d058feea40640d677e93609095a3b3162d95a2918798c8afc07b8e7d828f79b03019410fd59136d20fce904de8
7
- data.tar.gz: 401581be7d293bf54d5e133a65d8b793dbf31c36823a96c7080b5f6f3e965f376b9e84c7296272241f245832d665b6c7ca437a86fac9ea55ee7e150bb087cad4
6
+ metadata.gz: f236b23b4f0c0712161e3de82d33fe72186414dd09c4472470863b408d21cb236a6bf445b66f82ffc4cfc1c28b46d8e88000ed9af862cda788c9ada2845fef50
7
+ data.tar.gz: fc8f8254b3a46145744eebd9f1d67841e990b0d53a7364c32126d6b1b2c9a8a65ff30def68da4c223d58d43ad07aa76646ecfed8c8a13b2c04840b09e5e2139b
data/CHANGELOG.md CHANGED
@@ -1,17 +1,69 @@
1
1
  # Change log
2
2
 
3
+ ## 1.2.0 (2021-03-18)
4
+
5
+ ### New organization
6
+
7
+ * Move mail_plugger repository into MailToolbox organization
8
+
9
+ ### Changes
10
+
11
+ * Update gems
12
+ * Fix some documentation issues
13
+
14
+ ## 1.1.1 (2021-01-21)
15
+
16
+ ### Changes
17
+
18
+ * Change FakePlugger::DeliveryMethod to returns with the extracted delivery data instead of the message object.
19
+ * Update code documentations.
20
+ * Add missing FakePlugger description in the README.md.
21
+
22
+
23
+ ## 1.1.0 (2021-01-18)
24
+
25
+ ### New features
26
+
27
+ * Add FakePlugger to mock MailPlugger.
28
+
29
+ ### Changes
30
+
31
+ * Fix typos in the documentations.
32
+ * Add more metadata to gempspec file.
33
+
34
+
35
+ ## 1.0.1 (2021-01-15)
36
+
37
+ ### Changes
38
+
39
+ * Tidy up the gemspec file and change which files contains in the gem. Now the gem is much smaller.
40
+ * Add a new mail plugger image which has a different canvas and use it in the README.md.
41
+
42
+
43
+ ## 1.0.0 (2021-01-14)
44
+
45
+ ### Changes
46
+
47
+ * Update gems.
48
+ * Remove `webmock` gem to clean up unused things.
49
+ * Update documentations.
50
+
51
+
3
52
  ## 1.0.0.rc1 (2021-01-13)
4
53
 
54
+ ### Changes
55
+
5
56
  * Change description and fix changelog_uri in gemspec file.
6
57
  * Add/Change documentations.
7
58
  * Update gems.
8
59
  * Change `MailPlugger.plug_in` and `MailPlugger::MailHelper.delivery_options` methods to accept strings and symbols.
9
- * Change `MailPlugger::MailHelper.delivery_data` method that we can retrieve massage object as well.
60
+ * Change `MailPlugger::MailHelper.delivery_data` method that we can retrieve message object as well.
10
61
  * 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.
11
62
  * Change `MailPlugger::MailHelper.extract_attachments` method. If an attachment is inline then the hash contains the `filename` and `cid` as well.
12
63
  * Add/Change tests.
13
64
  * Change `MailPlugger::MailHelper.delivery_option` that returns with indifferent hash
14
65
 
66
+
15
67
  ## 1.0.0.beta1 (2021-01-02)
16
68
 
17
- * Implement MailPlugger methods and functionality. See [README.md](https://github.com/norbertszivos/mail_plugger/blob/main/README.md)
69
+ * Implement MailPlugger methods and functionality. See [README.md](https://github.com/MailToolbox/mail_plugger/blob/main/README.md)
data/README.md CHANGED
@@ -1,11 +1,11 @@
1
- # M<img src="https://github.com/norbertszivos/mail_plugger/blob/main/images/mail_plugger.png" height="25" />ilPlugger
1
+ # M<img src="https://raw.githubusercontent.com/MailToolbox/mail_plugger/main/images/mail_plugger800x500.png" height="22" />ilPlugger
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/mail_plugger.svg)](https://badge.fury.io/rb/mail_plugger)
4
- [![MIT license](https://img.shields.io/badge/license-MIT-brightgreen)](LICENSE.txt)
4
+ [![MIT license](https://img.shields.io/badge/license-MIT-brightgreen)](https://github.com/MailToolbox/mail_plugger/blob/main/LICENSE.txt)
5
5
  [![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop-hq/rubocop)
6
- [![Build Status](https://travis-ci.com/norbertszivos/mail_plugger.svg?branch=main)](https://travis-ci.com/norbertszivos/mail_plugger)
7
- [![Maintainability](https://api.codeclimate.com/v1/badges/bd2cda43214c111d8d16/maintainability)](https://codeclimate.com/github/norbertszivos/mail_plugger/maintainability)
8
- [![Test Coverage](https://api.codeclimate.com/v1/badges/bd2cda43214c111d8d16/test_coverage)](https://codeclimate.com/github/norbertszivos/mail_plugger/test_coverage)
6
+ [![Build Status](https://travis-ci.com/MailToolbox/mail_plugger.svg?branch=main)](https://travis-ci.com/MailToolbox/mail_plugger)
7
+ [![Maintainability](https://api.codeclimate.com/v1/badges/137881380fc475b4a836/maintainability)](https://codeclimate.com/github/MailToolbox/mail_plugger/maintainability)
8
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/137881380fc475b4a836/test_coverage)](https://codeclimate.com/github/MailToolbox/mail_plugger/test_coverage)
9
9
 
10
10
  **MailPlugger** helps you to use different mail providers' **API**. You can use any APIs which one would like to use. It allows you to send different emails with different APIs. Also it can help to move between providers, load balacing or cost management.
11
11
 
@@ -27,30 +27,48 @@ Or install it yourself as:
27
27
 
28
28
  ## Usage
29
29
 
30
- - [How to use MailPlugger.plug_in method](https://github.com/norbertszivos/mail_plugger/blob/main/docs/usage_of_plug_in_method.md)
31
- - [How to use MailPlugger::DeliveryMethod class](https://github.com/norbertszivos/mail_plugger/blob/main/docs/usage_of_delivery_method.md)
32
- - [How to use MailPlugger in a Ruby script or IRB console](https://github.com/norbertszivos/mail_plugger/blob/main/docs/usage_in_script_or_console.md)
33
- - [How to use MailPlugger in Ruby on Rails](https://github.com/norbertszivos/mail_plugger/blob/main/docs/usage_in_ruby_on_rails.md)
34
- - [How to add API specific options to the mailer method in Ruby on Rails](https://github.com/norbertszivos/mail_plugger/blob/main/docs/usage_of_secial_options_in_ruby_on_rails.md)
35
- - [How to add attachments to the mailer method in Ruby on Rails](https://github.com/norbertszivos/mail_plugger/blob/main/docs/usage_of_attachments_in_ruby_on_rails.md)
36
- - [How to use more delivey systems in Ruby on Rails](https://github.com/norbertszivos/mail_plugger/blob/main/docs/usage_of_more_delivery_system_in_ruby_on_rails.md)
37
- - [How to use one delivey system with more send methods in Ruby on Rails](https://github.com/norbertszivos/mail_plugger/blob/main/docs/usage_of_one_delivery_system_with_more_send_methods_in_ruby_on_rails.md)
38
- - [How to use AWS SES with MailPlugger in Ruby on Rails](https://github.com/norbertszivos/mail_plugger/blob/main/docs/usage_of_aws_ses_in_ruby_on_rails.md)
39
- - [How to use SparkPost with MailPlugger in Ruby on Rails](https://github.com/norbertszivos/mail_plugger/blob/main/docs/usage_of_sparkpost_in_ruby_on_rails.md)
40
- - [How to use SendGrid with MailPlugger in Ruby on Rails](https://github.com/norbertszivos/mail_plugger/blob/main/docs/usage_of_sendgrid_in_ruby_on_rails.md)
41
- - [How to use Mandrill with MailPlugger in Ruby on Rails](https://github.com/norbertszivos/mail_plugger/blob/main/docs/usage_of_mandrill_in_ruby_on_rails.md)
42
- - [How to use Postmark with MailPlugger in Ruby on Rails](https://github.com/norbertszivos/mail_plugger/blob/main/docs/usage_of_postmark_in_ruby_on_rails.md)
43
- - [How to use Mailgun with MailPlugger in Ruby on Rails](https://github.com/norbertszivos/mail_plugger/blob/main/docs/usage_of_mailgun_in_ruby_on_rails.md)
30
+ - [How to use MailPlugger.plug_in method](https://github.com/MailToolbox/mail_plugger/blob/main/docs/usage_of_plug_in_method.md)
31
+ - [How to use MailPlugger::DeliveryMethod class](https://github.com/MailToolbox/mail_plugger/blob/main/docs/usage_of_delivery_method.md)
32
+ - [How to use MailPlugger in a Ruby script or IRB console](https://github.com/MailToolbox/mail_plugger/blob/main/docs/usage_in_script_or_console.md)
33
+ - [How to use MailPlugger in Ruby on Rails](https://github.com/MailToolbox/mail_plugger/blob/main/docs/usage_in_ruby_on_rails.md)
34
+ - [How to add API specific options to the mailer method in Ruby on Rails](https://github.com/MailToolbox/mail_plugger/blob/main/docs/usage_of_special_options_in_ruby_on_rails.md)
35
+ - [How to add attachments to the mailer method in Ruby on Rails](https://github.com/MailToolbox/mail_plugger/blob/main/docs/usage_of_attachments_in_ruby_on_rails.md)
36
+ - [How to use more delivey systems in Ruby on Rails](https://github.com/MailToolbox/mail_plugger/blob/main/docs/usage_of_more_delivery_system_in_ruby_on_rails.md)
37
+ - [How to use one delivey system with more send methods in Ruby on Rails](https://github.com/MailToolbox/mail_plugger/blob/main/docs/usage_of_one_delivery_system_with_more_send_methods_in_ruby_on_rails.md)
38
+ - [How to use AWS SES with MailPlugger in Ruby on Rails](https://github.com/MailToolbox/mail_plugger/blob/main/docs/usage_of_aws_ses_in_ruby_on_rails.md)
39
+ - [How to use SparkPost with MailPlugger in Ruby on Rails](https://github.com/MailToolbox/mail_plugger/blob/main/docs/usage_of_sparkpost_in_ruby_on_rails.md)
40
+ - [How to use SendGrid with MailPlugger in Ruby on Rails](https://github.com/MailToolbox/mail_plugger/blob/main/docs/usage_of_sendgrid_in_ruby_on_rails.md)
41
+ - [How to use Mandrill with MailPlugger in Ruby on Rails](https://github.com/MailToolbox/mail_plugger/blob/main/docs/usage_of_mandrill_in_ruby_on_rails.md)
42
+ - [How to use Postmark with MailPlugger in Ruby on Rails](https://github.com/MailToolbox/mail_plugger/blob/main/docs/usage_of_postmark_in_ruby_on_rails.md)
43
+ - [How to use Mailgun with MailPlugger in Ruby on Rails](https://github.com/MailToolbox/mail_plugger/blob/main/docs/usage_of_mailgun_in_ruby_on_rails.md)
44
+
45
+ # F<img src="https://raw.githubusercontent.com/MailToolbox/mail_plugger/main/images/fake_plugger800x500.png" height="22" />kePlugger
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.
48
+
49
+ ## Usage
50
+
51
+ - [How to use FakePlugger::DeliveryMethod class](https://github.com/MailToolbox/mail_plugger/blob/main/docs/usage_of_fake_plugger_delivery_method.md)
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
+ - [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)
44
54
 
45
55
  ## Development
46
56
 
47
57
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
48
58
 
49
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
59
+ To install this gem onto your local machine, run `bundle exec rake install`.
60
+
61
+ To release a new version:
62
+
63
+ - Update [CHANGELOG.md](https://github.com/MailToolbox/mail_plugger/blob/main/CHANGELOG.md)
64
+ - Update the version number in `version.rb` manually or use `gem-release` gem and run `gem bump -v major|minor|patch|rc|beta`.
65
+ - Build gem with `bundle exec rake build`.
66
+ - Run `bundle install` and `bundle exec appraisal install` to update gemfiles and commit the changes.
67
+ - Run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
50
68
 
51
69
  ## Contributing
52
70
 
53
- Bug reports and pull requests are welcome. Please read [CONTRIBUTING.md](https://github.com/norbertszivos/mail_plugger/blob/main/CONTRIBUTING.md) if you would like to contribute to this project.
71
+ Bug reports and pull requests are welcome. Please read [CONTRIBUTING.md](https://github.com/MailToolbox/mail_plugger/blob/main/CONTRIBUTING.md) if you would like to contribute to this project.
54
72
 
55
73
  ## Inspiration
56
74
 
@@ -61,4 +79,4 @@ Bug reports and pull requests are welcome. Please read [CONTRIBUTING.md](https:/
61
79
 
62
80
  ## License
63
81
 
64
- The gem is available as open source under the terms of the [MIT License](https://github.com/norbertszivos/mail_plugger/blob/main/LICENSE.txt).
82
+ The gem is available as open source under the terms of the [MIT License](https://github.com/MailToolbox/mail_plugger/blob/main/LICENSE.txt).
@@ -0,0 +1,164 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FakePlugger
4
+ class DeliveryMethod < MailPlugger::DeliveryMethod
5
+ # Initialize FakePlugger delivery method attributes. If we are using
6
+ # MailPlugger.plug_in method, then these attributes can be nil, if not then
7
+ # we should set these attributes.
8
+ #
9
+ # @param [Hash] options check options below
10
+ # @option options [Class/Hash] client
11
+ # e.g. DefinedApiClientClass or { 'key' => DefinedApiClientClass }
12
+ #
13
+ # @option options [Array/Hash] delivery_options
14
+ # e.g. [:to, :from, :subject, :body] or
15
+ # { 'key' => [:to, :from, :subject, :body] }
16
+ #
17
+ # @option options [Hash] delivery_settings
18
+ # e.g. { return_response: true }
19
+ #
20
+ # @option options [String/Symbol] default_delivery_system
21
+ # e.g. 'defined_api'
22
+ #
23
+ # @option options [Boolean] debug
24
+ # if true it will show debug informations
25
+ #
26
+ # @option options [Boolean] raw_message
27
+ # if true it will show raw message
28
+ #
29
+ # @option options [String/Symbol/Array/Hash] response
30
+ # the deliver! method will return with this value or if this value is nil
31
+ # then it will return with the client object
32
+ def initialize(options = {})
33
+ super
34
+
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]
39
+ end
40
+
41
+ # Mock send message with the given client if the message parameter is a
42
+ # Mail::Message object. If 'response' parameter is nil then it will extract
43
+ # those information from the Mail::Message object which was provided in the
44
+ # 'delivery_options'. After that it generates a hash with these data and
45
+ # returns with the provided client class which has a 'deliver' method, but
46
+ # it won't call the 'deliver' method.
47
+ # If the 'response' parameter is a hash with 'return_delivery_data: true'
48
+ # then it will retrun with the extracted delivery data.
49
+ # If the 'response' parameter is not nil then retruns with that given data
50
+ # without call any other methods.
51
+ # Except if 'debug' is true. In this case it will call those methods which
52
+ # is calling in normal operation as well.
53
+ # If 'debug' is true then it prints out some debug informations.
54
+ # If 'raw_message' is true then it prints out raw message.
55
+ #
56
+ # @param [Mail::Message] message what we would like to send
57
+ #
58
+ # @return [Mail::Message/Hash] depends on the given value
59
+ #
60
+ # @example
61
+ #
62
+ # MailPlugger.plug_in('test_api_client') do |api|
63
+ # api.delivery_options = %i[from to subject body]
64
+ # api.delivery_settings = {
65
+ # fake_plugger_debug: true,
66
+ # fake_plugger_raw_message: true,
67
+ # fake_plugger_response: { response: 'OK' }
68
+ # }
69
+ # api.client = DefinedApiClientClass
70
+ # end
71
+ #
72
+ # message = Mail.new(from: 'from@example.com', to: 'to@example.com',
73
+ # subject: 'Test email', body: 'Test email body')
74
+ #
75
+ # FakePlugger::DeliveryMethod.new.deliver!(message)
76
+ #
77
+ # # or
78
+ #
79
+ # message = Mail.new(from: 'from@example.com', to: 'to@example.com',
80
+ # subject: 'Test email', body: 'Test email body')
81
+ #
82
+ # FakePlugger::DeliveryMethod.new(
83
+ # delivery_options: %i[from to subject body],
84
+ # client: DefinedApiClientClass,
85
+ # debug: true,
86
+ # raw_message: true,
87
+ # response: { response: 'OK' }
88
+ # ).deliver!(message)
89
+ #
90
+ def deliver!(message)
91
+ unless message.is_a?(Mail::Message)
92
+ raise MailPlugger::Error::WrongParameter,
93
+ 'The given parameter is not a Mail::Message'
94
+ end
95
+
96
+ @message = message
97
+
98
+ show_debug_info if @debug
99
+ show_raw_message if @raw_message
100
+
101
+ return_with_response
102
+ end
103
+
104
+ private
105
+
106
+ # Return with a response which depends on the conditions.
107
+ def return_with_response
108
+ return client.new(delivery_data) if @response.nil?
109
+ if @response.is_a?(Hash) && @response[:return_delivery_data]
110
+ return delivery_data
111
+ end
112
+
113
+ @response
114
+ end
115
+
116
+ # Show debug informations from variables and methods.
117
+ def show_debug_info
118
+ puts <<~DEBUG_INFO
119
+
120
+ ===================== FakePlugger::DeliveryMethod =====================
121
+
122
+ ------------------------------ Variables ------------------------------
123
+
124
+ ==> @client: #{@client.inspect}
125
+
126
+ ==> @delivery_options: #{@delivery_options.inspect}"
127
+
128
+ ==> @delivery_settings: #{@delivery_settings.inspect}"
129
+
130
+ ==> @default_delivery_system: #{@default_delivery_system.inspect}
131
+
132
+ ==> @message: #{@message.inspect}
133
+
134
+ ------------------------------- Methods -------------------------------
135
+
136
+ ==> client: #{client.inspect}
137
+
138
+ ==> delivery_system: #{delivery_system.inspect}
139
+
140
+ ==> delivery_options: #{delivery_options.inspect}
141
+
142
+ ==> delivery_data: #{delivery_data.inspect}
143
+
144
+ ==> settings: #{settings.inspect}
145
+
146
+ =======================================================================
147
+
148
+ DEBUG_INFO
149
+ end
150
+
151
+ # Show raw message for debug purpose.
152
+ def show_raw_message
153
+ puts <<~RAW_MESSAGE
154
+
155
+ ============================ Mail::Message ============================
156
+
157
+ #{@message}
158
+
159
+ =======================================================================
160
+
161
+ RAW_MESSAGE
162
+ end
163
+ end
164
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FakePlugger
4
+ class Railtie < Rails::Railtie
5
+ initializer 'fake_plugger.add_delivery_method' do
6
+ ActiveSupport.on_load :action_mailer do
7
+ ActionMailer::Base.add_delivery_method(
8
+ :fake_plugger,
9
+ FakePlugger::DeliveryMethod
10
+ )
11
+ end
12
+ end
13
+ end
14
+ end
data/lib/mail_plugger.rb CHANGED
@@ -7,6 +7,10 @@ require 'mail_plugger/delivery_method'
7
7
  require 'mail_plugger/railtie' if defined?(Rails)
8
8
  require 'mail_plugger/version'
9
9
 
10
+ require 'fake_plugger/delivery_method'
11
+ # If we are using this gem outside of Rails then do not load this code.
12
+ require 'fake_plugger/railtie' if defined?(Rails)
13
+
10
14
  module MailPlugger
11
15
  class << self
12
16
  attr_reader :client, :delivery_options, :delivery_settings
@@ -15,9 +19,10 @@ module MailPlugger
15
19
  #
16
20
  # @param [String/Symbol] delivery_system the name of the API
17
21
  #
18
- # @example using Rails config/initializers/mail_plugger.rb
22
+ # @example using Rails `config/initializers/mail_plugger.rb`
19
23
  #
20
- # The defined API class should have an 'initializer' and a 'deliver' method.
24
+ # # The defined API class should have an 'initialize' and a 'deliver'
25
+ # # method.
21
26
  # class DefinedApiClientClass
22
27
  # def initialize(options = {})
23
28
  # @settings = { api_key: '12345' }
@@ -89,6 +94,10 @@ module MailPlugger
89
94
 
90
95
  private
91
96
 
97
+ # Check 'delivery_system' is valid or not. If it's not valid then
98
+ # it will raise an error.
99
+ #
100
+ # @param [String/Symbol] delivery_system the name of the API
92
101
  def check_value(delivery_system)
93
102
  if delivery_system.nil?
94
103
  raise Error::WrongDeliverySystem, '"delivery_system" is nil'
@@ -8,7 +8,7 @@ module MailPlugger
8
8
  # method, then these attributes can be nil, if not then we should set these
9
9
  # attributes.
10
10
  #
11
- # @param [Hash] options below
11
+ # @param [Hash] options check options below
12
12
  # @option options [Class/Hash] client
13
13
  # e.g. DefinedApiClientClass or { 'key' => DefinedApiClientClass }
14
14
  #
@@ -58,7 +58,7 @@ module MailPlugger
58
58
  #
59
59
  # MailPlugger::DeliveryMethod.new.deliver!(message)
60
60
  #
61
- # or
61
+ # # or
62
62
  #
63
63
  # message = Mail.new(from: 'from@example.com', to: 'to@example.com',
64
64
  # subject: 'Test email', body: 'Test email body')
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MailPlugger
4
- VERSION = '1.0.0.rc1'
4
+ VERSION = '1.2.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.0.0.rc1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Norbert Szivós
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-13 00:00:00.000000000 Z
11
+ date: 2021-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mail
@@ -30,61 +30,30 @@ email:
30
30
  - sysqa@yahoo.com
31
31
  executables: []
32
32
  extensions: []
33
- extra_rdoc_files: []
33
+ extra_rdoc_files:
34
+ - LICENSE.txt
35
+ - README.md
34
36
  files:
35
- - ".github/ISSUE_TEMPLATE/bug_report.md"
36
- - ".github/ISSUE_TEMPLATE/feature_request.md"
37
- - ".gitignore"
38
- - ".rspec"
39
- - ".rubocop.yml"
40
- - ".travis.yml"
41
- - Appraisals
42
37
  - CHANGELOG.md
43
- - CODE_OF_CONDUCT.md
44
- - CONTRIBUTING.md
45
- - Gemfile
46
- - Gemfile.lock
47
38
  - LICENSE.txt
48
39
  - README.md
49
- - Rakefile
50
- - bin/console
51
- - bin/setup
52
- - docs/usage_in_ruby_on_rails.md
53
- - docs/usage_in_script_or_console.md
54
- - docs/usage_of_attachments_in_ruby_on_rails.md
55
- - docs/usage_of_aws_ses_in_ruby_on_rails.md
56
- - docs/usage_of_delivery_method.md
57
- - docs/usage_of_mailgun_in_ruby_on_rails.md
58
- - docs/usage_of_mandrill_in_ruby_on_rails.md
59
- - docs/usage_of_more_delivery_system_in_ruby_on_rails.md
60
- - docs/usage_of_one_delivery_system_with_more_send_methods_in_ruby_on_rails.md
61
- - docs/usage_of_plug_in_method.md
62
- - docs/usage_of_postmark_in_ruby_on_rails.md
63
- - docs/usage_of_secial_options_in_ruby_on_rails.md
64
- - docs/usage_of_sendgrid_in_ruby_on_rails.md
65
- - docs/usage_of_sparkpost_in_ruby_on_rails.md
66
- - gemfiles/.bundle/config
67
- - gemfiles/mail_2.6.gemfile
68
- - gemfiles/mail_2.6.gemfile.lock
69
- - gemfiles/mail_2.7.0.gemfile
70
- - gemfiles/mail_2.7.0.gemfile.lock
71
- - gemfiles/mail_2.7.gemfile
72
- - gemfiles/mail_2.7.gemfile.lock
73
- - images/mail_plugger.png
40
+ - lib/fake_plugger/delivery_method.rb
41
+ - lib/fake_plugger/railtie.rb
74
42
  - lib/mail_plugger.rb
75
43
  - lib/mail_plugger/delivery_method.rb
76
44
  - lib/mail_plugger/error.rb
77
45
  - lib/mail_plugger/mail_helper.rb
78
46
  - lib/mail_plugger/railtie.rb
79
47
  - lib/mail_plugger/version.rb
80
- - mail_plugger.gemspec
81
- homepage: https://github.com/norbertszivos/mail_plugger
48
+ homepage: https://github.com/MailToolbox/mail_plugger
82
49
  licenses:
83
50
  - MIT
84
51
  metadata:
85
- homepage_uri: https://github.com/norbertszivos/mail_plugger
86
- source_code_uri: https://github.com/norbertszivos/mail_plugger
87
- changelog_uri: https://github.com/norbertszivos/mail_plugger/blob/main/CHANGELOG.md
52
+ homepage_uri: https://github.com/MailToolbox/mail_plugger
53
+ source_code_uri: https://github.com/MailToolbox/mail_plugger
54
+ changelog_uri: https://github.com/MailToolbox/mail_plugger/blob/main/CHANGELOG.md
55
+ bug_tracker_uri: https://github.com/MailToolbox/mail_plugger/issues
56
+ documentation_uri: https://rubydoc.info/gems/mail_plugger
88
57
  post_install_message:
89
58
  rdoc_options: []
90
59
  require_paths:
@@ -96,12 +65,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
96
65
  version: 2.5.0
97
66
  required_rubygems_version: !ruby/object:Gem::Requirement
98
67
  requirements:
99
- - - ">"
68
+ - - ">="
100
69
  - !ruby/object:Gem::Version
101
- version: 1.3.1
70
+ version: '0'
102
71
  requirements: []
103
72
  rubygems_version: 3.1.4
104
73
  signing_key:
105
74
  specification_version: 4
106
- summary: Plug in the required mailer API(s) with MailPlugger.
75
+ summary: Plug in required mailer API(s) with MailPlugger.
107
76
  test_files: []