fix rerun of socket port

When using puppet it always returns returns as sync, the value of port
is an int in the file on disk but in the catalouge it's a string. This
commit uses insync?(is) to always convert socket[:port] to an integer
Make integers come out in JSON as integers.

There are places (for example if you pass keepalive/threshold values to
the keepalive check in custom_client) where it matters about the type
of the variable coming from the JSON - Sensu looks for .is_a?(Integer)
and so if you quote the integers in the client config then it breaks.

In puppet everything is a string (except when it isn't - however you
cannot sanely predict when integers are going to be integers or strings)
and this it's necessary to make sure that anything which can become an
intger without harm is so, so that it's not quoted in the final JSON
we generate.

There was already a to_type method which kinda did this, so I've just
made that generic + recursive and reused by all of the providers, and
called it whenever we have a custom= block (for internal data
comparisons) and whenever we write the file out. Note we don't call
it on reading the file in, otherwise it won't notice (and therefore
won't fix) things which are currently quoted.