god icon indicating copy to clipboard operation
god copied to clipboard

Added Twilio Contact

Open jonmarkgo opened this issue 12 years ago • 13 comments

Hi all, I wrote a Twilio contact lib so that you can get notified by SMS when a monitoring event occurs (like if your website goes down!) - tested it out and it all works as expected. Let me know if anything looks wonky in the merge and I'll be happy to correct it

jonmarkgo avatar Jan 13 '12 01:01 jonmarkgo

This is looking good. Would you mind adding a few test cases for this?

mojombo avatar Jan 13 '12 20:01 mojombo

Should be solid now, let me know if you need anything else from my end

jonmarkgo avatar Jan 13 '12 21:01 jonmarkgo

Hey @mojombo - got proper tests in there now

jonmarkgo avatar Jan 18 '12 19:01 jonmarkgo

@jonmarkgo I'm getting a test failure on this, can you check it out?

  1) Failure:
test_notify(TestTwilio) [test/test_twilio.rb:19]:
not all expectations were satisfied
unsatisfied expectations:
- expected exactly once, not yet invoked: #<Mock:0x7fe8fbacdb90>.create(:from => '1234567890', :to => '9876543210', :body => 'msg')
satisfied expectations:
- expected exactly once, invoked once: #<Mock:0x7fe8fbacd2d0>.messages(any_parameters)
- expected exactly once, invoked once: #<Mock:0x7fe8fbacc8d0>.sms(any_parameters)
- expected exactly once, invoked once: #<Mock:0x7fe8fbacbef8>.account(any_parameters)
- expected exactly once, invoked once: Twilio::REST::Client.new('ACXXXXX', 'YYYYYY')

mojombo avatar Jan 21 '12 21:01 mojombo

Also, the dependency should be set as development like the others. God takes care of telling you what gems to install if you do indeed use that contact. The idea is that God won't install a bunch of deps you don't need unless you actually use that functionality.

mojombo avatar Jan 21 '12 21:01 mojombo

"Development dependencies are not installed by default, and are not activated when the gem is."

@mojombo i definitely understand and agree with wanting to keep requiring possibly unused libraries to a minimum, but what is the point of them being in the gemspec then? is it to merely indicate that it's a dependency, but it's on the user to satisfy it manually?

stevegraham avatar Jan 22 '12 07:01 stevegraham

Development dependencies are needed in order to develop the software and run the test suite.

mojombo avatar Jan 22 '12 08:01 mojombo

yes that's obviously what a development dependency is for, but what happens when someone wants to use god with the twilio contact? there is no dependency, so it will blow up with a loaderror unless they already have the twilio-ruby gem installed. may i suggest adding gem 'twilio-ruby' to give a more descriptive error, if you want to keep runtime dependencies lean?

stevegraham avatar Jan 22 '12 08:01 stevegraham

Hey @mojombo - are there still issues with this?

jonmarkgo avatar Feb 08 '12 15:02 jonmarkgo

@stevegraham God has a loading mechanism that catches LoadError and informs the user that a dependency needs to be installed. This has been designed so that upon installing God you don't need to also install 20 gems that you'll never use.

See https://github.com/mojombo/god/blob/master/lib/god.rb#L367-375

mojombo avatar Feb 13 '12 18:02 mojombo

solid. we'll take it out then. cheers @mojombo :)

stevegraham avatar Feb 13 '12 20:02 stevegraham

Should be all good now @mojombo

jonmarkgo avatar Feb 14 '12 16:02 jonmarkgo

Hey guys, this looks really useful. Any reason not to merge?

wiktorschmidt avatar Aug 19 '12 19:08 wiktorschmidt