theckman/tunnelbroker — pull request #17 by theckman (2014-04-13 01:36:22+00:00)
Title: try to improve TunnelBroker::Client

The `build_messenger_config()` method was seen as being too complex in CodeClimate so this attempts to address that. Also, increase release version to `0.0.11`.

I've reduced `build_messenger_config()` to just iterate over the config fields. For each item it calls `config_hash_item()` and merges the result of that in to the running config hash.

`config_hash_item()` returns a Hash to be merged in to the config hash:
- When given an invalid config key it raises a NoMethodError (maybe this should be a custom Exception)
- When the key is `:url` and config.url is unset, it defaults to the `ENDPOINT` constant
- When the config key is valid, and set, it returns a Hash with `{ :keyname => config.keyname }`
- When the config key is unset, and not url, return an empty Hash