-
Notifications
You must be signed in to change notification settings - Fork 186
Test mode implementation, #24 #66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@sixfeetover @michaelrkn Any ideas on this? |
|
This looks great! Thanks @pirogoeth! |
lib/mailgun/response.rb
Outdated
| } | ||
| end | ||
|
|
||
| self.new resp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can I suggest using an OpenStruct here? Then if there ever was a time where you wanted more than body and code methods, you'll get them for free.
require 'ostruct`
self.new OpenStruct.new(h)Whatever key values you pass into the from_hash method will be callable without checking if the key exists and defining a method for it if it does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh absolutely! Thanks!
|
This looks great, thank you. 👍 |
| api_version = 'v3', | ||
| ssl = true) | ||
| ssl = true, | ||
| test_mode = false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this default to Mailgun.test_mode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kpandya91 So actually that's a really good point. It looks like Mailgun.test_mode was defined in an earlier commit but was never actually used? So this actually could make use of that field. I'll dig through the code again to make sure it's unused and add that as the default value. Thanks!
Super basic implementation of a "test mode" allowing users to easily stub calls that send emails.
Initially, it is just for stubbing the message sending routine, but can be expanded to stub other API calls if necessary.
Test mode is also tested. 😂
EDIT: Version has also been bumped to 1.1.2 for this feature.