cottus 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +12 -6
- data/lib/cottus/client.rb +3 -1
- data/lib/cottus/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ecc4ff9c7665bc9c8dd0bfd2f823b75cad6274e2
|
4
|
+
data.tar.gz: 0689ac0d84036f71550017bde201bb533215a8fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e297a556782028c264222df3e6a3edaf657ddc9e4eaa243f238fae2188eb512e6635827edadf05a31f24350f8b4cf5ccecaa3880cc9acfcb7c5e357dafdb2b5b
|
7
|
+
data.tar.gz: bd848b6c1b94e89a97e16bf701086251bdf5cfe65af1c0a75d03782ab271ad9792134dda673186e061b45da9adc18356a18c5a2d4907db16de11149cbec21915
|
data/README.md
CHANGED
@@ -28,11 +28,11 @@ require 'cottus'
|
|
28
28
|
client = Cottus::Client.new(['http://n1.com', 'http://n2.com', 'http://n3.com'])
|
29
29
|
|
30
30
|
# This request will be made against http://n1.com
|
31
|
-
response = client.get('/any/path', query
|
31
|
+
response = client.get('/any/path', :query => {:id => 1337})
|
32
32
|
puts response.body, response.code, response.message, response.headers.inspect
|
33
33
|
|
34
34
|
# This request will be made against http://n2.com
|
35
|
-
response = client.post('/any/path', query
|
35
|
+
response = client.post('/any/path', :query => {:id => 1337}, :body => { :attribute => 'cool'})
|
36
36
|
puts response.body, response.code, response.message, response.headers.inspect
|
37
37
|
```
|
38
38
|
|
@@ -87,7 +87,7 @@ options hash as you create your instance, as such:
|
|
87
87
|
```ruby
|
88
88
|
require 'cottus'
|
89
89
|
|
90
|
-
client = Cottus::Client.new(['http://n1.com', 'http://n2.com'], strategy
|
90
|
+
client = Cottus::Client.new(['http://n1.com', 'http://n2.com'], :strategy => MyStrategy)
|
91
91
|
```
|
92
92
|
|
93
93
|
Want some additional options passed when your strategy is initialized?
|
@@ -98,8 +98,14 @@ hash to the client.
|
|
98
98
|
```ruby
|
99
99
|
require 'cottus'
|
100
100
|
|
101
|
-
|
102
|
-
|
101
|
+
options = {
|
102
|
+
:strategy => MyStrategy,
|
103
|
+
:strategy_options => {
|
104
|
+
:an_option => 'cool stuff!'
|
105
|
+
}
|
106
|
+
}
|
107
|
+
|
108
|
+
client = Cottus::Client.new(['http://n1.com', 'http://n2.com'], options)
|
103
109
|
```
|
104
110
|
|
105
111
|
The options will be passed as an options hash to the strategy, as explained
|
@@ -107,7 +113,7 @@ above.
|
|
107
113
|
|
108
114
|
Boom! That's all there is, for the moment.
|
109
115
|
|
110
|
-
##
|
116
|
+
## cottus?
|
111
117
|
|
112
118
|
Cottus was one of the Hecatonchires of Greek mythology.
|
113
119
|
The Hecatonchires, "Hundred-Handed Ones" (also with 50 heads) were figures in an
|
data/lib/cottus/client.rb
CHANGED
@@ -53,7 +53,9 @@ module Cottus
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def create_strategy(options)
|
56
|
-
|
56
|
+
strategy_options = options[:strategy_options] || {}
|
57
|
+
strategy_impl = options[:strategy] || RoundRobinStrategy
|
58
|
+
strategy_impl.new(hosts, http, strategy_options)
|
57
59
|
end
|
58
60
|
end
|
59
61
|
end
|
data/lib/cottus/version.rb
CHANGED