Is there any exception notification gem for ruby project? - ruby

I am developing a ruby project, not rails project. Is there any exception notification gem for this case? thanks!

Although quite young, the following is an intentionally non-Rails exception notification gem: https://github.com/Moove-it/rusen

The simpliest solution depends from wich method did you like to send mails.
If you have for example already installed sendmail - in this case to send the mail with notification log you can call it with params. It depend on your system settings.

Related

Padrino send errors automatically via email

Can anyone suggest a way to have any application errors in a Padrino app send these errors via email?
I already have the Padrino Mailer configured properly and can send test emails, I just have no idea how to configure the app to send me a report via mail (as well as logging it, of course) whenever an error occurs.
Thanks.
I ended up using the padrino-contrib gem. With it, you can install the plugin you need (of course you can do it manually also):
padrino-gen plugin exception_notifier
Which will add it to your gem file and also edit your app/app.rb and boot.rb files to load this gem.
Then in app/app.rb you put something like:
register Padrino::Contrib::ExceptionNotifier
set :exceptions_from, "noreply#domain.com"
set :exceptions_to, "your_address.domain.com"
And that's it.
The nice thing about letting the plugin install it for you is that if you're more familiar with Rails than Padrino (as is my case) this will not only set things up for you, but also show you were the directives need to go.
Hope this helps someone else.
A good approach should be using exception handlers. Adding a begin..rescue block to your code, and if there is an exception, you send the email and continue to the desired behavior.
def some_action
begin
# some code that could go wrong
rescue SomeExceptionClass => some_variable
# here you send the email with the errors
# render stuff, redirect stuff, etc
end
end

What methods exist to auto-generate ruby client stubs from WSDL files?

I'm using Ruby and the Savon gem to interact with SOAP/WS and would like to auto-generate the client request methods from the WSDL in Ruby.
Before I do this, I'd like to know if there's any other Ruby/SOAP library that does this?
Edit: Please note, I already know this isn't available in Savon out the box, in fact my intention is to add in the feature, I'm in the process checking if this exists somewhere else written in Ruby.
Since it's only few days since you asked this question, and I've run into same problem I've decided to create small script to do that.
Download - save as objects.rb for example and run with _bunde exec objects.rb path_to.wsdl_
https://gist.github.com/4622792
Let me know if it works ^^
Take a look at Savon's spec, it has pretty rich testing environment
I think ads_common by Google is relevant to you.
google-api-ads-ruby/ads_common at master ยท googleads/google-api-ads-ruby
rake generate can create the client libraries automatically from WSDL.
It is specialized for Google Ads, but this notion would be helpful to create a versatile client library automatically from WSDL in Ruby.

How do I ignore requests to a certain route in Sinatra when using NewRelic?

We're using NewRelic to monitor a Sinatra app. We don't want the probe URL varnish uses to check if the app is online to be instrumented by NewRelic. How do we tell NewRelic to ignore a certain Sinatra route? (The documentation only seems to refer to how to do this in Rails: https://newrelic.com/docs/ruby/blocking-controller-instrumentation)
You could try calling NewRelic::Agent.abort_transaction! within the code path for the probe request. See the API docs for details.
Have you tried what their docs suggest https://newrelic.com/docs/ruby/sinatra-support-in-the-ruby-agent
newrelic_ignore '/ping'
As of version 3.6.3 of the NewRelic gem, you can should be able to use the 'newrelic_ignore' method to ignore endpoints. If you are using Sinatra, you may need to call this class method explicitly, like so:
NewRelic::Agent::Instrumentation::Sinatra::newrelic_ignore('/route/to/ignore')
But, it doesn't work as expected. I am filing a bug report with NewRelic.

Ruby on Rails with chargify

I want to integrate chargify to my rails app. I have user object and I want the user to be able to subscribe for one month and update the boolean column on user object. I prefer to use the API not hosted pages. How can I do that?
Is there any example for chargify on ruby on rails for handling subscriptions but with details about mvc for newbies?
Based on this thread and the Googles it looks like there is not a whole lot out there.
You could try looking at the Rails 2 example here and converting it or use the gem here (gem "chargify", "~> 0.3.0").
I know none of this is aimed at newbies but the info seems to sparse.
This might get you going. It seems that Chartify itself is written in Rails, and therfore their API is ruby code, which you can use...

Growl Notifications: How to push Growl notifications from a website?

I'm wondering how I can push desktop Growl notifications from my web application to the user of my web application. I would like to use javascript, if possible, otherwise a language like Ruby or PHP would be my second choice.
Have you implemented something like this before? How can it be done?
I figured out how to use Ruby to push Growl notifications. I would still like to find a JavaScript solution, but if there is no way to use JavaScript, then here is a Ruby solution:
Use the ruby-growl gem:
gem install ruby-growl
Then in your Ruby script:
require 'ruby-growl'
g = Growl.new "localhost", "ruby-growl", ["ruby-growl Notification"]
g.notify "ruby-growl Notification", "It Came From Ruby-Growl", "Greetings!"
Also, in order for this to work, you have to enable "Listen for incoming notifications" and "Allow remote application registration" on the Network tab of the Growl Preference Pane
You can send Growl notifications from Javascript (with a bit of Flash as a helper, but that part is behind the scenes). Here is a test page: http://www.growlforwindows.com/gfw/examples/js/
Note that this only currently works on Windows - the Javascript/Flash support in Growl on the Mac is currently broken as noted here: https://groups.google.com/forum/?fromgroups=#!topic/growl-development/BNF8tcUE1kM

Resources