influxdb/influxdb-ruby — pull request #67 by BarthV (2014-10-11 09:32:50+00:00)
Title: Adding shard_spaces creation & update support

## Support multiple shard_spaces at db create :100:
http://influxdb.com/docs/v0.8/advanced_topics/sharding_and_storage.html#configuration

**Code**
``` ruby
require 'influxdb'
influxdb = InfluxDB::Client.new host: "influxdb.mycompany.com"

influxdb.create_database('1_noconf')

options = {"spaces" => [
{"name" => "default", "regex" => "/.*/", "retentionPolicy" => "60d", "shardDuration" => "7d", "replicationFactor" => 1, "split" => 1}
]}
influxdb.create_database('2_customdefaults', options)

options = {"spaces" => [
{"name" => "shard", "regex" => "/.shard.*/", "retentionPolicy" => "60d", "shardDuration" => "30d", "replicationFactor" => 1, "split" => 1},
{"name" => "default", "regex" => "/.*/", "retentionPolicy" => "inf", "shardDuration" => "7d", "replicationFactor" => 1, "split" => 1}
]}
influxdb.create_database('3_multipleshards', options)
```

**Result**
![selection_011](https://cloud.githubusercontent.com/assets/1901955/4602188/8e690a3e-5129-11e4-8cf5-147fec89dff0.png)
![selection_012](https://cloud.githubusercontent.com/assets/1901955/4602182/472399aa-5129-11e4-83d4-59f3dd0b8dd8.png)

## Support shard_space update :
http://influxdb.com/docs/v0.8/advanced_topics/sharding_and_storage.html#updating-shard-spaces

**Code**

``` ruby
JSON.generate( influxdb.get_shard_space_list() )
```

``` json
[
{
"name":"default",
"database":"2_customdefault",
"regex":"/.*/",
"retentionPolicy":"60d",
"shardDuration":"7d",
"replicationFactor":1,
"split":1
},
{
"name":"default",
"database":"3_multipleshards",
"regex":"/.*/",
"retentionPolicy":"inf",
"shardDuration":"7d",
"replicationFactor":1,
"split":1
},
{
"name":"shard",
"database":"3_multipleshards",
"regex":"/.shard.*/",
"retentionPolicy":"60d",
"shardDuration":"30d",
"replicationFactor":1,
"split":1
}
]
```

``` ruby
options = {"regex" => "/.*/", "retentionPolicy" => "365d", "shardDuration" => "30d", "replicationFactor" => 1, "split" => 1}

influxdb.update_shard_space('2_customdefault', 'default', options)
```

**Result**
![selection_013](https://cloud.githubusercontent.com/assets/1901955/4602180/3d522ab8-5129-11e4-9922-fe731ae2075b.png)